Christian Montel
2011-Nov-20 12:16 UTC
[R] ltm: Simplified approach to bootstrapping 2PL-Models?
Dear R-List, to assess the model fit for 2PL-models, I tried to mimic the bootstrap-approach chosen in the GoF.rasch()-function. Not being a statistician, I was wondering whether the following simplification (omit the "chi-squared-expressed model fit-step") would be appropriate: GoF.ltm <- function(object, B = 50, ...){ liFits <- list() for(i in 1:B){ rndDat <- rmvlogis(nrow(object$X), coef(object)) liFits[[i]] <- ltm(rndDat ~ z1) } distr <- sort(sapply(liFits, function(x)return(x$log.Lik))) return(max(which(distr <= object$log.Lik))/length(distr)) } The rationale behind was to directly use the sorted sequence of (log)likelihoods of models fitted to 2PL-fitting-datasets where the parameters of <object> hold. The return value was intented to roughly mirror how many 2PL-Datasets which demonstrably fit the model fit worse or better than the model in question. Any comments which may help me figure out whether I'm on the right track are greatly appreciated. Thank you in advance, best regards, Christian Dr. Christian Montel E-Mail: christian.montel at eligo.de eligo GmbH -- B?ro Berlin Tel.: +49 (0) 30 695 399 95-2 Arndtstr. 34 Fax: +49 (0) 30 695 399 95-1 10965 Berlin
Christian Montel
2011-Nov-20 12:33 UTC
[R] ltm: Simplified approach to bootstrapping 2PL-Models?
Dear R-List, to assess the model fit for 2PL-models, I tried to mimic the bootstrap-approach chosen in the GoF.rasch()-function. Not being a statistician, I was wondering whether the following simplification (omit the "chi-squared-expressed model fit-step") would be appropriate: GoF.ltm <- function(object, B = 50, ...){ liFits <- list() for(i in 1:B){ rndDat <- rmvlogis(nrow(object$X), coef(object)) liFits[[i]] <- ltm(rndDat ~ z1) } distr <- sort(sapply(liFits, function(x)return(x$log.Lik))) return(max(which(distr <= object$log.Lik))/length(distr)) } fit <- ltm(Abortion ~ z1, control = list(GHk = 20, iter.em = 20)) GoF.ltm(fit) The rationale behind was to directly use the sorted sequence of (log)likelihoods of models fitted to 2PL-fitting-datasets where the parameters of <object> hold. The return value was intented to roughly mirror how many 2PL-Datasets which demonstrably fit the model fit worse or better than the model in question. Any comments which may help me figure out whether I'm on the right track are greatly appreciated. Thank you, best regards, Christian
Dimitris Rizopoulos
2011-Nov-20 13:54 UTC
[R] ltm: Simplified approach to bootstrapping 2PL-Models?
Note that you can also fit 2PL models using the gpcm() function that fits the Generalized Partial Credit Model, and therefore you can use the GoF.gpcm() function for goodness-of-fit, e.g., library(ltm) fit2PL.1 <- ltm(LSAT ~ z1) fit2PL.2 <- gpcm(LSAT) fit2PL.1 fit2PL.2 GoF.gpcm(fit2PL.2, B = 199) I hope it helps. Best, Dimitris On 11/20/2011 1:16 PM, Christian Montel wrote:> Dear R-List, > > to assess the model fit for 2PL-models, I tried to mimic the > bootstrap-approach chosen in the GoF.rasch()-function. Not being a > statistician, I was wondering whether the following simplification > (omit the "chi-squared-expressed model fit-step") would be appropriate: > > GoF.ltm<- function(object, B = 50, ...){ > liFits<- list() > for(i in 1:B){ > rndDat<- rmvlogis(nrow(object$X), coef(object)) > liFits[[i]]<- ltm(rndDat ~ z1) > } > distr<- sort(sapply(liFits, function(x)return(x$log.Lik))) > return(max(which(distr<= object$log.Lik))/length(distr)) > } > > The rationale behind was to directly use the sorted sequence of > (log)likelihoods of models fitted to 2PL-fitting-datasets where the > parameters of<object> hold. The return value was intented to roughly > mirror how many 2PL-Datasets which demonstrably fit the model fit > worse or better than the model in question. > > Any comments which may help me figure out whether I'm on the right > track are greatly appreciated. > > Thank you in advance, > best regards, > Christian > > > Dr. Christian Montel > E-Mail: christian.montel at eligo.de > eligo GmbH -- B?ro Berlin > Tel.: +49 (0) 30 695 399 95-2 > Arndtstr. 34 > Fax: +49 (0) 30 695 399 95-1 > 10965 Berlin > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.-- Dimitris Rizopoulos Assistant Professor Department of Biostatistics Erasmus University Medical Center Address: PO Box 2040, 3000 CA Rotterdam, the Netherlands Tel: +31/(0)10/7043478 Fax: +31/(0)10/7043014 Web: http://www.erasmusmc.nl/biostatistiek/