From b74dcfb607439b1ed5ef2450d82a9d21094dd6ae Mon Sep 17 00:00:00 2001 From: arobitzsch Date: Mon, 28 Aug 2023 17:36:49 +0200 Subject: [PATCH] 4.2-11 --- DESCRIPTION | 4 ++-- R/RcppExports.R | 2 +- R/tam.fa.R | 6 +++--- R/tam.latreg.R | 8 +++++--- R/tam.mml.R | 7 ++----- R/tam_calc_posterior.R | 13 ++++++------- R/tam_mml_person_posterior.R | 17 +++++++++++++++-- README.md | 16 +++++++++------- docs/404.html | 2 +- docs/authors.html | 10 +++++----- docs/index.html | 2 +- docs/pkgdown.yml | 2 +- docs/reference/IRT.drawPV.html | 2 +- docs/reference/IRT.itemfit.html | 2 +- docs/reference/IRT.truescore.html | 2 +- docs/reference/data.cqc.html | 14 +++++++------- docs/reference/lavaanify.IRT.html | 4 ++-- docs/reference/msq.itemfit.html | 4 ++-- docs/reference/tam.fit.html | 10 +++++----- docs/reference/tam.latreg.html | 3 ++- docs/reference/tam.linking.html | 8 ++++---- docs/reference/tam.mml.html | 4 ++-- docs/reference/tam.modelfit.html | 2 +- docs/reference/tam.np.html | 2 +- docs/reference/tam.pv.html | 20 ++++++++++---------- inst/CITATION | 3 ++- inst/NEWS | 9 +++++++-- man/tam.latreg.Rd | 5 +++-- src/RcppExports.cpp | 2 +- src/init.c | 2 +- 30 files changed, 104 insertions(+), 83 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 51f13d3..9460deb 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Package: TAM Type: Package Title: Test Analysis Modules -Version: 4.2-1 -Date: 2022-08-29 11:02:47 +Version: 4.2-11 +Date: 2023-08-28 17:23:17.934842 Author: Alexander Robitzsch [aut,cre] (), Thomas Kiefer [aut], diff --git a/R/RcppExports.R b/R/RcppExports.R index df98303..9cacc60 100644 --- a/R/RcppExports.R +++ b/R/RcppExports.R @@ -1,5 +1,5 @@ ## File Name: RcppExports.R -## File Version: 4.002001 +## File Version: 4.002011 # Generated by using Rcpp::compileAttributes() -> do not edit by hand # Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393 diff --git a/R/tam.fa.R b/R/tam.fa.R index e13fb99..e249857 100644 --- a/R/tam.fa.R +++ b/R/tam.fa.R @@ -1,5 +1,5 @@ ## File Name: tam.fa.R -## File Version: 9.258 +## File Version: 9.261 #---- Exploratory Factor Analysis and Bifactor Models @@ -116,7 +116,7 @@ tam.fa <- function( resp, irtmodel, dims=NULL, nfactors=NULL, # oblimin rotation in exploratory factor analysis if (irtmodel=="efa"){ - res$efa.oblimin <- GPArotation::oblimin(L=B.stand) + res$efa.oblimin <- GPArotation::oblimin(A=B.stand) # Schmid Leiman transformation corrmatr <- tcrossprod( B.stand ) diag(corrmatr) <- 1 @@ -132,4 +132,4 @@ tam.fa <- function( resp, irtmodel, dims=NULL, nfactors=NULL, #--- output return(res) } -##################################################################### + diff --git a/R/tam.latreg.R b/R/tam.latreg.R index c464d47..5e85389 100644 --- a/R/tam.latreg.R +++ b/R/tam.latreg.R @@ -1,5 +1,5 @@ ## File Name: tam.latreg.R -## File Version: 9.341 +## File Version: 9.343 ################################################################### # latent regression @@ -244,6 +244,8 @@ tam.latreg <- function( like, theta=NULL, Y=NULL, group=NULL, hwtE=hwt, hwt=hwt, ndim=ndim, theta=theta ) person <- res$person EAP.rel <- res$EAP.rel + M_post <- res$M_post + SD_post <- res$SD_post #cat("person parameters") ; a1 <- Sys.time(); print(a1-a0) ; a0 <- a1 ############################################################ @@ -288,7 +290,7 @@ tam.latreg <- function( like, theta=NULL, Y=NULL, group=NULL, deviance.history <- deviance.history[ 1:iter, ] res <- list( "beta"=beta, "variance"=variance, "person"=person, pid=pid, "EAP.rel"=EAP.rel, - "post"=hwt, "theta"=theta, + "post"=hwt, M_post=M_post, SD_post=SD_post, "theta"=theta, "Y"=Y, "group"=group, "G"=if ( is.null(group)){1} else { length(unique( group ) )}, "groups"=if ( is.null(group)){1} else { groups }, @@ -303,7 +305,7 @@ tam.latreg <- function( like, theta=NULL, Y=NULL, group=NULL, "nnodes"=nnodes, "deviance"=deviance, "ic"=ic, thetasamp.density=thetasamp.density, "deviance.history"=deviance.history, - "control"=con1a, "iter"=iter, + "control"=con1a, "iter"=iter, "YSD"=YSD, CALL=CALL, latreg_stand=latreg_stand ) class(res) <- "tam.latreg" return(res) diff --git a/R/tam.mml.R b/R/tam.mml.R index 99ccba0..3dd7fe7 100644 --- a/R/tam.mml.R +++ b/R/tam.mml.R @@ -1,5 +1,5 @@ ## File Name: tam.mml.R -## File Version: 9.804 +## File Version: 9.863 tam.mml <- function( resp, Y=NULL, group=NULL, irtmodel="1PL", formulaY=NULL, dataY=NULL, @@ -81,9 +81,6 @@ tam.mml <- function( resp, Y=NULL, group=NULL, irtmodel="1PL", } nitems <- ncol(resp) # number of items - if (is.null(colnames(resp))){ - colnames(resp) <- paste0( "I", 100+1:nitems ) - } nstud <- nrow(resp) # number of students #***** nstud1 <- sum(1*( rowSums( 1 - is.na(resp) ) > 0 )) @@ -532,7 +529,7 @@ tam.mml <- function( resp, Y=NULL, group=NULL, irtmodel="1PL", "iter"=iter, "printxsi"=printxsi, "YSD"=YSD, CALL=CALL, latreg_stand=latreg_stand, - prior_list_xsi=prior_list_xsi, penalty_xsi=penalty_xsi ) + prior_list_xsi=prior_list_xsi, penalty_xsi=penalty_xsi) class(res) <- "tam.mml" return(res) } diff --git a/R/tam_calc_posterior.R b/R/tam_calc_posterior.R index 938014e..1788039 100644 --- a/R/tam_calc_posterior.R +++ b/R/tam_calc_posterior.R @@ -1,14 +1,13 @@ ## File Name: tam_calc_posterior.R -## File Version: 9.20 +## File Version: 9.218 - -########################################################### tam_calc_posterior <- function(rprobs, gwt, resp, nitems, resp.ind.list, normalization=TRUE, thetasamp.density=NULL, snodes=0, resp.ind=NULL, avoid.zerosum=FALSE, logprobs=FALSE ) { +a0 <- Sys.time() fx <- gwt tsd <- NULL # calculate individual 'sampling weight' @@ -23,9 +22,8 @@ tam_calc_posterior <- function(rprobs, gwt, resp, nitems, nstud <- nrow(fx) storage.mode(resp) <- "integer" fx0 <- fx +#cat("start calcfx") ; a1 <- Sys.time(); print(a1-a0) ; a0 <- a1 fx <- .Call('_TAM_calcfx', PACKAGE='TAM', fx, rprobs, resp.ind.list, resp) -# cat("nach calcfx") ; a1 <- Sys.time(); print(a1-a0) ; a0 <- a1 - if (avoid.zerosum ){ fxs <- rowSums( fx ) m1 <- max( min( fxs[ fxs > 0 ], na.rm=TRUE), 1E-200 ) / 1E3 / ncol(fx) @@ -42,17 +40,18 @@ tam_calc_posterior <- function(rprobs, gwt, resp, nitems, } else { hwt <- fx } - res <- list("hwt"=hwt, "rfx"=rfx ) +# cat("nach normalization") ; a1 <- Sys.time(); print(a1-a0) ; a0 <- a1 + res <- list(hwt=hwt, rfx=rfx ) res$fx1 <- fx / gwt if ( snodes > 0 ){ res[["swt" ]] <- fx res$gwt <- gwt } res$tsd <- tsd +# cat("before output") ; a1 <- Sys.time(); print(a1-a0) ; a0 <- a1 #--- output return(res) } -##################################################################### calc_posterior.v2 <- tam_calc_posterior diff --git a/R/tam_mml_person_posterior.R b/R/tam_mml_person_posterior.R index 566f671..6b90222 100644 --- a/R/tam_mml_person_posterior.R +++ b/R/tam_mml_person_posterior.R @@ -1,5 +1,5 @@ ## File Name: tam_mml_person_posterior.R -## File Version: 0.12 +## File Version: 0.15 tam_mml_person_posterior <- function(pid, nstud, pweights, resp, resp.ind, snodes, hwtE, hwt, ndim, theta ) @@ -32,7 +32,20 @@ tam_mml_person_posterior <- function(pid, nstud, pweights, colnames(person)[ which( cnp=="SD.EAP" ) ] <- paste("SD.EAP.Dim", dd, sep="") } } + + #*** means and standard deviations of posterior distributions + SD <- M <- rep(NA, ndim) + post <- hwtE + n <- nrow(post) + for (dd in 1L:ndim){ + theta_dim <- theta[,dd] + mt <- matrix( theta_dim, nrow=n, ncol=length(theta_dim), byrow=TRUE) + M[dd] <- sum( mt*post*pweights ) / sum(pweights) + M2 <- sum( mt^2*post*pweights ) / sum(pweights) + SD[dd] <- sqrt( M2 - M[dd]^2 ) + } + #----- OUTPUT - res <- list( person=person, EAP.rel=EAP.rel ) + res <- list( person=person, EAP.rel=EAP.rel, M_post=M, SD_post=SD ) return(res) } diff --git a/README.md b/README.md index 54c877e..552f285 100644 --- a/README.md +++ b/README.md @@ -4,11 +4,8 @@ If you use `TAM` and have suggestions for improvement or have found bugs, please email me at robitzsch@leibniz-ipn.de. Please always provide a minimal dataset, necessary to demonstrate the problem, a minimal runnable code necessary to reproduce the issue, which can be run on the given dataset, and -all necessary information on the used librarys, the R version, and the OS it is run on, perhaps a sessionInfo(). +all necessary information on the used librarys, the R version, and the OS it is run on, perhaps a ``sessionInfo()``. -#### Manual - -The manual may be found here [https://alexanderrobitzsch.github.io/TAM/](https://alexanderrobitzsch.github.io/TAM/) #### CRAN version `TAM` 4.1-4 (2022-08-28) @@ -24,13 +21,18 @@ The CRAN version can be installed from within R using: utils::install.packages("TAM") ``` -#### GitHub version `TAM` 4.2-1 (2022-08-29) +#### GitHub version `TAM` 4.2-11 (2023-08-28) -[![](https://img.shields.io/badge/github%20version-4.2--1-orange.svg)](https://github.com/alexanderrobitzsch/TAM)   +[![](https://img.shields.io/badge/github%20version-4.2--11-orange.svg)](https://github.com/alexanderrobitzsch/TAM)   The version hosted [here](https://github.com/alexanderrobitzsch/TAM) is the development version of `TAM`. -The GitHub version can be installed using `devtools` as: +The GitHub version can be installed using `devtools` as ```r devtools::install_github("alexanderrobitzsch/TAM") ``` +or alternatively use + +```r +utils::install.packages('TAM', repos = c('https://alexanderrobitzsch.r-universe.dev', 'https://cloud.r-project.org')) +``` diff --git a/docs/404.html b/docs/404.html index 8f04439..f77bc79 100644 --- a/docs/404.html +++ b/docs/404.html @@ -71,7 +71,7 @@ TAM - 4.2-1 + 4.2-2 diff --git a/docs/authors.html b/docs/authors.html index 1399ad4..7909b4c 100644 --- a/docs/authors.html +++ b/docs/authors.html @@ -71,7 +71,7 @@ TAM - 4.2-1 + 4.2-2 @@ -111,12 +111,12 @@

Citation

Source: inst/CITATION -

Robitzsch, A., Kiefer, T., & Wu, M. (2022). TAM: Test Analysis Modules. R package version 4.2-1. https://CRAN.R-project.org/package=TAM

-
@Manual{TAM_4.2-1,
+    

Robitzsch, A., Kiefer, T., & Wu, M. (2023). TAM: Test Analysis Modules. R package version 4.2-2. https://CRAN.R-project.org/package=TAM

+
@Manual{TAM_4.2-2,
   title = {TAM: Test Analysis Modules},
   author = {Alexander Robitzsch and Thomas Kiefer and Margaret Wu},
-  year = {2022},
-  note = {R package version 4.2-1},
+  year = {2023},
+  note = {R package version 4.2-2},
   url = {https://CRAN.R-project.org/package=TAM},
 }
diff --git a/docs/index.html b/docs/index.html index 0276eb2..33810ec 100644 --- a/docs/index.html +++ b/docs/index.html @@ -43,7 +43,7 @@ TAM - 4.2-1 + 4.2-2 diff --git a/docs/pkgdown.yml b/docs/pkgdown.yml index 807f3d6..4330535 100644 --- a/docs/pkgdown.yml +++ b/docs/pkgdown.yml @@ -2,5 +2,5 @@ pandoc: 1.13.1 pkgdown: 1.5.1 pkgdown_sha: ~ articles: [] -last_built: 2022-08-29T09:18Z +last_built: 2023-01-25T12:12Z diff --git a/docs/reference/IRT.drawPV.html b/docs/reference/IRT.drawPV.html index f14b639..35ebd08 100644 --- a/docs/reference/IRT.drawPV.html +++ b/docs/reference/IRT.drawPV.html @@ -154,7 +154,7 @@

Examp dat <- data.read # fit Rasch model -mod <- rasch.mml2(dat) +mod <- rasch.mml2(dat) # draw 10 plausible values pv1 <- TAM::IRT.drawPV(mod, NPV=10) }

diff --git a/docs/reference/IRT.itemfit.html b/docs/reference/IRT.itemfit.html index 249226c..6908dc0 100644 --- a/docs/reference/IRT.itemfit.html +++ b/docs/reference/IRT.itemfit.html @@ -205,7 +205,7 @@

Examp a <- rep(1,I) a[c(3,8)] <- c( 1.7, .4 ) # simulate 2PL data -dat <- sirt::sim.raschtype( theta=rnorm(N), b=b, fixed.a=a) +dat <- sirt::sim.raschtype( theta=rnorm(N), b=b, fixed.a=a) # fit 1PL model mod <- TAM::tam.mml( dat ) diff --git a/docs/reference/IRT.truescore.html b/docs/reference/IRT.truescore.html index 643de1b..c3d8983 100644 --- a/docs/reference/IRT.truescore.html +++ b/docs/reference/IRT.truescore.html @@ -157,7 +157,7 @@

Value

true scores \(\tau( \theta ) \).

See also

-

See also sirt::truescore.irt +

See also sirt::truescore.irt for a conversion function for generalized partial credit models.

Examples

diff --git a/docs/reference/data.cqc.html b/docs/reference/data.cqc.html index 667522c..b633fac 100644 --- a/docs/reference/data.cqc.html +++ b/docs/reference/data.cqc.html @@ -180,7 +180,7 @@

FormatSee also

-

See the sirt::R2conquest function +

See the sirt::R2conquest function for running ConQuest software from within R.

See the WrightMap package for functions connected to reading ConQuest files and creating Wright maps. @@ -219,16 +219,16 @@

Examp #------- ConQuest # estimate model -cmod01 <- sirt::R2conquest( dat, name="mod01", path.conquest=path.conquest) +cmod01 <- sirt::R2conquest( dat, name="mod01", path.conquest=path.conquest) summary(cmod01) # summary output # read shw file with some terms -shw01a <- sirt::read.show( "mod01.shw" ) +shw01a <- sirt::read.show( "mod01.shw" ) cmod01$shw.itemparameter # read person item maps -pi01a <- sirt::read.pimap( "mod01.shw" ) +pi01a <- sirt::read.pimap( "mod01.shw" ) cmod01$shw.pimap # read plausible values (npv=10 plausible values) -pv01a <- sirt::read.pv(pvfile="mod01.pv", npv=10) +pv01a <- sirt::read.pv(pvfile="mod01.pv", npv=10) cmod01$person # read ConQuest model @@ -256,7 +256,7 @@

Examp #--- ConQuest # estimate model maxK <- max( dat, na.rm=TRUE ) -cmod02a <- sirt::R2conquest( dat, itemcodes=0:maxK, model="item+item*step", +cmod02a <- sirt::R2conquest( dat, itemcodes=0:maxK, model="item+item*step", name="mod02a", path.conquest=path.conquest) summary(cmod02a) # summary output @@ -290,7 +290,7 @@

Examp X <- data.cqc03[,"rater",drop=FALSE] X$rater <- as.numeric(substring( X$rater, 2 )) # convert 'rater' in numeric format maxK <- max( resp, na.rm=TRUE) -cmod03a <- sirt::R2conquest( resp, X=X, regression="", model="item+step+rater", +cmod03a <- sirt::R2conquest( resp, X=X, regression="", model="item+step+rater", name="mod03a", path.conquest=path.conquest, set.constraints="cases" ) summary(cmod03a) # summary output diff --git a/docs/reference/lavaanify.IRT.html b/docs/reference/lavaanify.IRT.html index 80a7734..c2ea76c 100644 --- a/docs/reference/lavaanify.IRT.html +++ b/docs/reference/lavaanify.IRT.html @@ -197,10 +197,10 @@

See a

lavaan::lavaanify

-

See sirt::tam2mirt for +

See sirt::tam2mirt for converting objects of class tam into mirt objects.

-

See sirt::lavaan2mirt +

See sirt::lavaan2mirt for estimating models in the mirt package using lavaan syntax.

See doparse for the DO and DO2 statements.

diff --git a/docs/reference/msq.itemfit.html b/docs/reference/msq.itemfit.html index 306e5f1..aab8627 100644 --- a/docs/reference/msq.itemfit.html +++ b/docs/reference/msq.itemfit.html @@ -196,7 +196,7 @@

Examp # create some misfitting items a[c(1,3)] <- c(.5, 1.5 ) # simulate data -dat <- sirt::sim.raschtype( rnorm(N), b=b, fixed.a=a ) +dat <- sirt::sim.raschtype( rnorm(N), b=b, fixed.a=a ) #*** estimate Rasch model mod1 <- TAM::tam.mml(resp=dat) # compute WLEs @@ -218,7 +218,7 @@

Examp library(mirt) mod1b <- mirt::mirt( dat, model=1, itemtype="Rasch", verbose=TRUE ) print(mod1b) -sirt::mirt.wrapper.coef(mod1b) +sirt::mirt.wrapper.coef(mod1b) fmod1b <- mirt::itemfit(mod1b, Theta=as.matrix(wmod1,ncol=1), Zh=TRUE, X2=FALSE, S_X2=FALSE ) cbind( fit2a$fit_data, fmod1b ) diff --git a/docs/reference/tam.fit.html b/docs/reference/tam.fit.html index 58cd605..5864efd 100644 --- a/docs/reference/tam.fit.html +++ b/docs/reference/tam.fit.html @@ -219,7 +219,7 @@

See a for models fitted with JML.

See tam.personfit for computing person fit statistics.

Item fit and person fit based on estimated person parameters can also be -calculated using the sirt::pcm.fit function +calculated using the sirt::pcm.fit function in the sirt package (see Example 1 and Example 2).

Examples

@@ -251,7 +251,7 @@

Examp # extract item parameters b1 <- - mod1$AXsi[, -1 ] # assess item fit and person fit -fit1a <- sirt::pcm.fit(b=b1, theta=wle$theta, data.sim.rasch ) +fit1a <- sirt::pcm.fit(b=b1, theta=wle$theta, data.sim.rasch ) fit1a$item # item fit statistic fit1a$person # person fit statistic @@ -279,7 +279,7 @@

Examp # extract item parameters b1 <- - mod2$AXsi[, -1 ] # assess fit -fit1a <- sirt::pcm.fit(b=b1, theta=wle$theta, dat) +fit1a <- sirt::pcm.fit(b=b1, theta=wle$theta, dat) fit1a$item ############################################################################# @@ -335,7 +335,7 @@

Examp # create some misfitting items a[c(1,3)] <- c(.5, 1.5 ) # simulate data -dat <- sirt::sim.raschtype( rnorm(N), b=b, fixed.a=a ) +dat <- sirt::sim.raschtype( rnorm(N), b=b, fixed.a=a ) #*** estimate Rasch model mod1 <- TAM::tam.mml(resp=dat) #*** assess item fit by infit and outfit statistic @@ -347,7 +347,7 @@

Examp library(sirt) mod1c <- mirt::mirt( dat, model=1, itemtype="Rasch", verbose=TRUE) print(mod1c) # model summary -sirt::mirt.wrapper.coef(mod1c) # estimated parameters +sirt::mirt.wrapper.coef(mod1c) # estimated parameters fit1c <- mirt::itemfit(mod1c, method="EAP") # model fit in mirt package # compare results of TAM and mirt dfr <- cbind( "TAM"=fit1, "mirt"=fit1c[,-c(1:2)] ) diff --git a/docs/reference/tam.latreg.html b/docs/reference/tam.latreg.html index 3e1046b..9c074af 100644 --- a/docs/reference/tam.latreg.html +++ b/docs/reference/tam.latreg.html @@ -255,7 +255,8 @@

Arg

Value

-

Subset of values of tam.mml

+

Subset of values of tam.mml. In addition, +means (M_post) and standard deviations (SD_post) are computed.

See also

See also tam.pv for plausible value imputation.

diff --git a/docs/reference/tam.linking.html b/docs/reference/tam.linking.html index 988a96c..a7c0588 100644 --- a/docs/reference/tam.linking.html +++ b/docs/reference/tam.linking.html @@ -304,8 +304,8 @@

See a

Linking or equating of item response models can be also conducted with plink (Weeks, 2010), equate, equateIRT (Battauz, 2015), equateMultiple, kequate and irteQ packages.

-

See also the sirt::linking.haberman, -sirt::invariance.alignment and sirt::linking.haebara functions +

See also the sirt::linking.haberman, +sirt::invariance.alignment and sirt::linking.haebara functions in the sirt package.

Examples

@@ -452,9 +452,9 @@

Examp I <- 30 # number of items b <- seq(-2,2, length=I) # data for group 1 -dat1 <- sirt::sim.raschtype( rnorm(N, mean=0, sd=1), b=b ) +dat1 <- sirt::sim.raschtype( rnorm(N, mean=0, sd=1), b=b ) # data for group 2 -dat2 <- sirt::sim.raschtype( rnorm(N, mean=1, sd=.6), b=b ) +dat2 <- sirt::sim.raschtype( rnorm(N, mean=1, sd=.6), b=b ) # fit group 1 mod1 <- TAM::tam.mml.2pl( resp=dat1 ) diff --git a/docs/reference/tam.mml.html b/docs/reference/tam.mml.html index aabeb63..574560b 100644 --- a/docs/reference/tam.mml.html +++ b/docs/reference/tam.mml.html @@ -642,7 +642,7 @@

See a

Standard errors are estimated by a rather crude (but quick) approximation. Use tam.se for improved standard errors.

For model comparisons see anova.tam.

-

See sirt::tam2mirt for converting +

See sirt::tam2mirt for converting tam objects into objects of class mirt::mirt in the mirt package.

@@ -2072,7 +2072,7 @@

Examp I <- 100 # number of items set.seed(987) # simulate data according to the Rasch model -dat <- sirt::sim.raschtype( stats::rnorm(N), b=seq(-2,2,len=I) ) +dat <- sirt::sim.raschtype( stats::rnorm(N), b=seq(-2,2,len=I) ) # estimate models mod1n <- TAM::tam.mml( resp=dat, control=list( acceleration="none") ) # no acceler. mod1y <- TAM::tam.mml( resp=dat, control=list( acceleration="Yu") ) # Yu acceler. diff --git a/docs/reference/tam.modelfit.html b/docs/reference/tam.modelfit.html index 95863ca..1320be4 100644 --- a/docs/reference/tam.modelfit.html +++ b/docs/reference/tam.modelfit.html @@ -333,7 +333,7 @@

Examp I <- 20 # number of items # simulate responses library(sirt) -dat <- sirt::sim.raschtype( stats::rnorm(N), b=seq(-1.5,1.5,len=I) ) +dat <- sirt::sim.raschtype( stats::rnorm(N), b=seq(-1.5,1.5,len=I) ) #*** estimation mod1 <- TAM::tam.mml( dat ) summary(dat) diff --git a/docs/reference/tam.np.html b/docs/reference/tam.np.html index c8d3ad0..ddd9cc3 100644 --- a/docs/reference/tam.np.html +++ b/docs/reference/tam.np.html @@ -361,7 +361,7 @@

Examp a <- rep(1,I) a[c(3,8)] <- c(.5, 2) theta <- stats::rnorm(N, sd=1) -dat <- sirt::sim.raschtype(theta, b=b, fixed.a=a) +dat <- sirt::sim.raschtype(theta, b=b, fixed.a=a) #- 1PL model mod1 <- TAM::tam.mml(dat) diff --git a/docs/reference/tam.pv.html b/docs/reference/tam.pv.html index c597c72..d63815d 100644 --- a/docs/reference/tam.pv.html +++ b/docs/reference/tam.pv.html @@ -399,7 +399,7 @@

Examp # fix item parameters for plausible value imputation # fix item intercepts by defining xsi.fixed xsi0 <- mod2a$xsi$xsi -xsi.fixed <- cbind( seq(1,length(xsi0)), xsi0 ) +xsi.fixed <- cbind( seq(1,length(xsi0)), xsi0 ) # fix item slopes using mod2$B # matrix of latent regressors female, hisei and migra Y <- dat[, c("female", "hisei", "migra") ] @@ -485,7 +485,7 @@

Examp mids1 <- miceadds::datalist2mids( datlist1 ) # fit linear regression mod1c <- with( mids1, stats::lm( PVREAD ~ migra + hisei ) ) -summary( mice::pool(mod1c) ) +summary( mice::pool(mod1c) ) ############################################################################# # EXAMPLE 3: Multidimensional plausible value imputation @@ -495,7 +495,7 @@

Examp set.seed(6778) library(mvtnorm) N <- 1000 -Y <- cbind( stats::rnorm(N), stats::rnorm(N) ) +Y <- cbind( stats::rnorm(N), stats::rnorm(N) ) theta <- mvtnorm::rmvnorm( N, mean=c(0,0), sigma=matrix( c(1,.5,.5,1), 2, 2 )) theta[,1] <- theta[,1] + .4 * Y[,1] + .2 * Y[,2] # latent regression model theta[,2] <- theta[,2] + .8 * Y[,1] + .5 * Y[,2] # latent regression model @@ -504,12 +504,12 @@

Examp resp1 <- 1 * ( p1 > matrix( stats::runif( N*I ), nrow=N, ncol=I ) ) p1 <- stats::plogis( outer( theta[,2], seq( -2, 2, len=I ), "-" ) ) resp2 <- 1 * ( p1 > matrix( stats::runif( N*I ), nrow=N, ncol=I ) ) -resp <- cbind(resp1,resp2) +resp <- cbind(resp1,resp2) colnames(resp) <- paste("I", 1:(2*I), sep="") # (2) define loading Matrix Q <- array( 0, dim=c( 2*I, 2 )) -Q[cbind(1:(2*I), c( rep(1,I), rep(2,I) ))] <- 1 +Q[cbind(1:(2*I), c( rep(1,I), rep(2,I) ))] <- 1 # (3) fit latent regression model mod <- TAM::tam.mml( resp=resp, Y=Y, Q=Q ) @@ -536,7 +536,7 @@

Examp summary(mod1, standardized=TRUE, rsquare=TRUE) # (7) draw plausible values with tam.pv.mcmc function -Y1 <- cbind( 1, Y ) +Y1 <- cbind( 1, Y ) pv2 <- TAM::tam.pv.mcmc( tamobj=mod, Y=Y1, n.iter=1000, n.burnin=200 ) # (8) group-specific plausible values @@ -573,7 +573,7 @@

Examp theta <- .5*X[,1] + .4*X[,2] + rnorm( N, sd=.5 ) # simulate item responses itemdiff <- seq( -2, 2, length=I) # item difficulties -dat <- sirt::sim.raschtype( theta, b=itemdiff ) +dat <- sirt::sim.raschtype( theta, b=itemdiff ) #*********************** #*** Model 0: Regression model with true variables @@ -582,7 +582,7 @@

Examp #*********************** #*** Model 1: latent regression model with true covariates X -xsi.fixed <- cbind( 1:I, itemdiff ) +xsi.fixed <- cbind( 1:I, itemdiff ) mod1 <- TAM::tam.mml( dat, xsi.fixed=xsi.fixed, Y=X) summary(mod1) @@ -702,14 +702,14 @@

Examp data.init$X2 <- X.err[,"X2"] #-- imputation using the mice and miceadds package -imp1 <- mice::mice( as.matrix(data), predictorMatrix=predictorMatrix, m=4, maxit=6, +imp1 <- mice::mice( as.matrix(data), predictorMatrix=predictorMatrix, m=4, maxit=6, method=imputationMethod, allow.na=TRUE, theta=theta, like=like, data.init=data.init ) summary(imp1) # compute linear regression mod4a <- with( imp1, stats::lm( PVA ~ X1 + X2 ) ) -summary( mice::pool(mod4a) ) +summary( mice::pool(mod4a) ) }