alexanderrobitzsch / TAM

Test Analysis Modules
https://alexanderrobitzsch.github.io/TAM/
15 stars 9 forks source link

Error in .A.matrix2 while running the many facet Rasch model using tam.mml.mfr function #15

Closed huacheng1985 closed 4 years ago

huacheng1985 commented 4 years ago

Dear Dr. Robitzsch,

I am trying to use tam.mml.mfr() function to run a many-facet Rasch model on Guilford's Facet data. This dataset could be found in here.

Here are the R codes

## Guilford Facets
# Type in the data
data1 <- matrix(c(1,1,5,5,3,5,3,
1,2,9,7,5,8,5,
1,3,3,3,3,7,1,
1,4,7,3,1,3,3,
1,5,9,7,7,8,5,
1,6,3,5,3,5,1,
1,7,7,7,5,5,5,
2,1,6,5,4,6,3,
2,2,8,7,5,7,2,
2,3,4,5,3,6,6,
2,4,5,6,4,5,5,
2,5,2,4,3,2,3,
2,6,4,4,6,4,2,
2,7,3,3,5,5,4,
3,1,5,5,5,7,3,
3,2,7,7,5,7,5,
3,3,3,5,5,5,5,
3,4,5,3,3,3,1,
3,5,9,7,7,7,7,
3,6,3,3,3,5,3,
3,7,7,7,7,5,7),ncol=7,byrow=TRUE)
data1 <- as.data.frame(data1)
colnames(data1) <- c("subjects","raters","Trait_a","Trait_b","Trait_c","Trait_d","Trait_e")
data1.facet <- data1[,"raters",drop=FALSE]
data1.pid <- data1$subjects
data1.resp <- data1[,-c(1:2)]
data1.formulaA <- ~ item * raters      # formula
data.model <- tam.mml.mfr(resp=data1.resp,facets=data1.facet,formulaA=data1.formulaA,pid=data1.pid)

Then the R throws an error code as follows:

Error in .A.matrix2(resp, formulaA = formulaA, facets = facets, constraint = constraint,  : 
  object 'xsi.elim' not found

Could you please tell me what's wrong with my code?

Thank you so much for your help. I really appreciate that your work on the "TAM" package. This is a powerful package that running the different kinds of Rasch models. Thank you for your contributions to the Rasch community.

thkiefer commented 4 years ago

Since the guilford facets data contains polychotomous rather than dichotomous items, you would need to specify step parameters (cf. Example 9 in the manual for the tam.mml.* methods). For example, assuming you are interessted in a two way interaction of item and rater,

data1.formulaA <- ~ item * raters + step

or

data1.formulaA <- ~ item * raters + item:step

huacheng1985 commented 4 years ago

Thank you, so much. Problem solved!

alexanderrobitzsch commented 4 years ago

Thanks @thkiefer