[R] How to write random effect in MCMCglmm

Belle ping.yi at gmail.com
Wed Jun 1 23:53:51 CEST 2011


Hi All,

The data set that I have is a cluster data, and I want to run a HLM mixed
model with multi-level response. Here is my data set:
response:
   - Level (num:  1, 2, 3, 4, 5 - 5 levels)
Covariates:
   - Type (Factor: A, B, C - 3 levels)
   - yr (num: 2006, 2007, ...)
   - Male (num: 0=not Male, 1=Male - 2 levels)
   - Ethnicity (Factor: A, B, H, ..., - 7 levels)
   - ELL (num: 0, 1, - 2 levels)
   - Disability (num: 0, 1, - 2levels)
   - avgTransfers (num with missing values)
   - sdTransfers (num with missing values)
   - agec (num with missing values)
   - PctELL (num)
   - PctDisability (num)
   - PctMale (num)
Random Effects:
   - Schoolid, Teacherid, Studentid

library(MCMCglmm)
y <- MCMCglmm(factor(Level) ~ Type+factor(yr>=2006)+Male+Ethnicity+ELL+
         
avgTransfers+sdTransfers+agec+Disability+ELL*pctELL+Disability*pctDisability+
          pctMale+factor(yr>=2008)*factor(Grade),
random=~Schoolid+Teacherid+Studentid, 
          family="categorical", data=data[data$Grade>=4,])

Error in MCMCglmm(FCATprofLevel ~ transferTypeCat + factor(yr >= 2008) +  : 
please use idh(trait):units, us(trait):units or trait:units for error
structures involving catgeorical data with more than 2 categories

Does anyone know how I can fix it?

Thanks


--
View this message in context: http://r.789695.n4.nabble.com/How-to-write-random-effect-in-MCMCglmm-tp3567056p3567056.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list