[R] weird --no 'dimnames' attribute for array-- error for R lordif package

Debs Majumdar debs_stata at yahoo.com
Wed Jun 20 01:17:04 CEST 2012


Hi All,

  I am trying to use the lordif package in R and can't figure out the reason for the above error when I try to run the calctheta() function. 


##################
# read data using foreign package - must be Stata 11 or earlier 
racedata<- read.dta("race.dta")    

# item responses 
resp.data<-racedata[,-c(1:2)] 

# grouping variable is in the second column 
af<-racedata[,2] 

# run lordif 
>race.dif<-lordif(resp.data, af, criterion="Chisqr", alpha=0.05, minCell=1) 
>attributes(race.dif) 
>ipar1 <- race.dif$ipar 
> class(ipar1) 
[1] "data.frame" 
> class(resp.data) 
[1] "data.frame" 

> head(ipar1) 
          a      cb1 
I1 2.565834 1.959045 
I2 2.033049 1.389847 
I3 2.693962 1.951471 
I4 1.772003 1.864188 
I5 3.478853 2.091705 
I6 1.479415 2.586945 

> head(resp.data) 
  satis dropact empty bored spirits afraid 
1   Yes      No    No    No     Yes     No 
2   Yes      No    No    No     Yes     No 
3    No     Yes   Yes   Yes      No     No 
4   Yes      No    No    No     Yes     No 
5   Yes      No    No    No     Yes     No 
6   Yes      No    No    No     Yes     No 

theta_race <- calctheta(ipar1, resp.data, seq(-4,4,.1),
prior.mean=0,prior.sd=1)
Error in t(pp[, i, resp]) : no 'dimnames' attribute for array 


What am I doing wrong here?

Thanks,

Debs


##################




More information about the R-help mailing list