[R] ordglm -- simple question

Anders Schwartz Corr corr at fas.harvard.edu
Tue Jun 7 15:48:13 CEST 2005


My attempt to test a model using ordglm code is running into problems, and
I thought if you have a moment you might illucidate the situation.

Here is the data:

http://www.people.fas.harvard.edu/~corr/6.4.05.RData

Here is the code:

# I coerce tcn8 matrix data to a vector, because ordglm will not accept
matrix data.
y<-as.vector(tcn8[,62])
x<-as.vector(tcn8[,60])
wt<-as.vector(tcn8[,61])
cbind(y,x,wt)->tc
colnames(tc) <- c("y","x","wt")
ordglm(y ~ x, weights=wt, data=tc, link = "logit")

Here is the output:

> y<-as.vector(tcn8[,62])
> x<-as.vector(tcn8[,60])
> wt<-as.vector(tcn8[,61])
> cbind(y,x,wt)->tc
> colnames(tc) <- c("y","x","wt")
> ordglm(y ~ x, weights=wt, data=tc, link = "logit")
Error in model.frame.default(mt, data, na.action = na.fail) :
        `data' must be a data.frame, not a matrix or  array
>

Perhaps it is a problem of having NAs and NaNs in my data? I appreciate
any pointers. Do I need to set model.frame first?

Thanks,

Anders Corr




More information about the R-help mailing list