diff --git a/DESCRIPTION b/DESCRIPTION index ba187a4..b18889f 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Package: TAM Type: Package Title: Test Analysis Modules -Version: 3.7-3 -Date: 2021-04-30 12:08:26 +Version: 3.7-5 +Date: 2021-05-16 13:48:06 Author: Alexander Robitzsch [aut,cre] (), Thomas Kiefer [aut], diff --git a/NAMESPACE b/NAMESPACE index 4ed45c5..34fae0d 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -188,6 +188,7 @@ export(tam_matrix2) export(tam_max_abs) export(tam_max_abs_list) export(tam_mml_se_quick) +export(tam_model_implied_means) export(tam_NA_pattern) export(tam_normalize_matrix_rows) export(tam_normalize_vector) diff --git a/R/RcppExports.R b/R/RcppExports.R index 6b72eb5..0dc7bde 100644 --- a/R/RcppExports.R +++ b/R/RcppExports.R @@ -1,5 +1,5 @@ ## File Name: RcppExports.R -## File Version: 3.007003 +## File Version: 3.007005 # Generated by using Rcpp::compileAttributes() -> do not edit by hand # Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393 diff --git a/R/tam.mml.2pl.R b/R/tam.mml.2pl.R index 8f7bd44..17f3da4 100644 --- a/R/tam.mml.2pl.R +++ b/R/tam.mml.2pl.R @@ -1,5 +1,5 @@ ## File Name: tam.mml.2pl.R -## File Version: 9.586 +## File Version: 9.588 tam.mml.2pl <- function( resp, Y=NULL, group=NULL, irtmodel="2PL", formulaY=NULL, dataY=NULL, @@ -338,7 +338,7 @@ tam.mml.2pl <- function( resp, Y=NULL, group=NULL, irtmodel="2PL", # cat("m step regression") ; a1 <- Sys.time(); print(a1-a0) ; a0 <- a1 beta <- resr$beta - variance <- resr$variance + variance <- resr$variance itemwt <- resr$itemwt variance_acceleration <- resr$variance_acceleration variance_change <- resr$variance_change @@ -471,7 +471,7 @@ tam.mml.2pl <- function( resp, Y=NULL, group=NULL, irtmodel="2PL", #*** collect item parameters item1 <- tam_itempartable( resp=resp, maxK=maxK, AXsi=AXsi, B=B, ndim=ndim, - resp.ind=resp.ind, rprobs=rprobs, n.ik=n.ik, pi.k=pi.k ) + resp.ind=resp.ind, rprobs=rprobs, n.ik=n.ik, pi.k=pi.k, pweights=pweights) #*** IRT parameterization item_irt <- tam_irt_parameterization(resp=resp, maxK=maxK, B=B, AXsi=AXsi, diff --git a/R/tam.mml.R b/R/tam.mml.R index aa93075..99ccba0 100644 --- a/R/tam.mml.R +++ b/R/tam.mml.R @@ -1,5 +1,5 @@ ## File Name: tam.mml.R -## File Version: 9.803 +## File Version: 9.804 tam.mml <- function( resp, Y=NULL, group=NULL, irtmodel="1PL", formulaY=NULL, dataY=NULL, @@ -425,7 +425,8 @@ tam.mml <- function( resp, Y=NULL, group=NULL, irtmodel="1PL", #*** collect item parameters item1 <- tam_itempartable( resp=resp, maxK=maxK, AXsi=AXsi, B=B, ndim=ndim, - resp.ind=resp.ind, rprobs=rprobs, n.ik=n.ik, pi.k=pi.k ) + resp.ind=resp.ind, rprobs=rprobs, n.ik=n.ik, pi.k=pi.k, + pweights=pweights) #*** IRT parameterization item_irt <- tam_irt_parameterization(resp=resp, maxK=maxK, B=B, AXsi=AXsi, diff --git a/R/tam.mml.mfr.R b/R/tam.mml.mfr.R index cea7c4a..8116930 100644 --- a/R/tam.mml.mfr.R +++ b/R/tam.mml.mfr.R @@ -1,5 +1,5 @@ ## File Name: tam.mml.mfr.R -## File Version: 9.943 +## File Version: 9.944 tam.mml.mfr <- function( resp, Y=NULL, group=NULL, irtmodel="1PL", formulaY=NULL, dataY=NULL, ndim=1, pid=NULL, xsi.fixed=NULL, @@ -480,7 +480,7 @@ tam.mml.mfr <- function( resp, Y=NULL, group=NULL, irtmodel="1PL", #--- collect item parameters item1 <- tam_itempartable( resp=gresp.noStep, maxK=maxK, AXsi=AXsi, B=B, ndim=ndim, resp.ind=gresp.noStep.ind, - rprobs=rprobs, n.ik=n.ik, pi.k=pi.k, order=TRUE ) + rprobs=rprobs, n.ik=n.ik, pi.k=pi.k, order=TRUE, pweights=pweights ) #--- collect all person statistics res <- tam_mml_person_posterior( pid=pid, nstud=nstud, pweights=pweights, diff --git a/R/tam.mml.wle.R b/R/tam.mml.wle.R index b48dc85..7a6d2a0 100644 --- a/R/tam.mml.wle.R +++ b/R/tam.mml.wle.R @@ -1,5 +1,5 @@ ## File Name: tam.mml.wle.R -## File Version: 0.26 +## File Version: 0.271 tam.mml.wle <- function( tamobj, score.resp=NULL, WLE=TRUE, adj=.3, Msteps=20, @@ -19,7 +19,8 @@ tam.mml.wle <- function( tamobj, score.resp=NULL, WLE=TRUE, adj=.3, Msteps=20, maxK <- res$maxK pweights <- res$pweights pid <- res$pid - + pweights <- tam_mml_wle_pweights(score.resp=score.resp, pweights=pweights) + #--- initial values and some design matrices res <- tam_mml_wle_theta_inits( WLE=WLE, adj=adj, nitems=nitems, maxK=maxK, resp=resp, resp.ind=resp.ind, B=B, ndim=ndim ) diff --git a/R/tam.mml.wle2.R b/R/tam.mml.wle2.R index 64182ed..9f11b95 100644 --- a/R/tam.mml.wle2.R +++ b/R/tam.mml.wle2.R @@ -1,5 +1,5 @@ ## File Name: tam.mml.wle2.R -## File Version: 0.851 +## File Version: 0.853 ################################################################ tam.mml.wle2 <- function( tamobj, score.resp=NULL, WLE=TRUE, adj=.3, Msteps=20, @@ -24,6 +24,7 @@ tam.mml.wle2 <- function( tamobj, score.resp=NULL, WLE=TRUE, adj=.3, Msteps=20, pid <- rep(NA, nrow(score.resp) ) } } + pweights <- tam_mml_wle_pweights(score.resp=score.resp, pweights=pweights) A <- res$A xsi <- res$xsi diff --git a/R/tam_itempartable.R b/R/tam_itempartable.R index 25f8c2d..5eb54f2 100644 --- a/R/tam_itempartable.R +++ b/R/tam_itempartable.R @@ -1,11 +1,12 @@ ## File Name: tam_itempartable.R -## File Version: 9.131 +## File Version: 9.133 #--- create table of item parameters tam_itempartable <- function( resp, maxK, AXsi, B, ndim, - resp.ind, rprobs=NULL, n.ik=NULL, pi.k=NULL, order=FALSE ) + resp.ind, rprobs=NULL, n.ik=NULL, pi.k=NULL, order=FALSE, + pweights=rep(1,nrow(resp) ) ) { if ( is.null(dimnames(B)[[1]] ) ){ @@ -13,8 +14,8 @@ tam_itempartable <- function( resp, maxK, AXsi, B, ndim, } item1 <- data.frame( "item"=dimnames(B)[[1]] ) - item1$N <- colSums(resp.ind) - item1$M <- colSums(resp.ind * resp, na.rm=TRUE) / colSums( resp.ind ) + item1$N <- colSums(resp.ind*pweights) + item1$M <- colSums(resp.ind * resp * pweights, na.rm=TRUE) / colSums( resp.ind*pweights ) maxKi <- rowSums( 1 - is.na(AXsi) ) - 1 I <- nrow(item1) item1$xsi.item <- - AXsi[ cbind(1:I, maxKi+1) ] / maxKi diff --git a/R/tam_mml_wle_pweights.R b/R/tam_mml_wle_pweights.R new file mode 100644 index 0000000..8696a58 --- /dev/null +++ b/R/tam_mml_wle_pweights.R @@ -0,0 +1,10 @@ +## File Name: tam_mml_wle_pweights.R +## File Version: 0.01 + +tam_mml_wle_pweights <- function(score.resp, pweights) +{ + if (!is.null(score.resp)){ + pweights <- rep(1,nrow(score.resp)) + } + return(pweights) +} diff --git a/R/tam_model_implied_means.R b/R/tam_model_implied_means.R new file mode 100644 index 0000000..9419547 --- /dev/null +++ b/R/tam_model_implied_means.R @@ -0,0 +1,28 @@ +## File Name: tam_model_implied_means.R +## File Version: 0.01 + + +tam_model_implied_means <- function(mod) +{ + hwt <- mod$hwt + pweights <- mod$pweights + rprobs <- mod$rprobs + resp <- mod$resp + I <- dim(rprobs)[1] + K <- dim(rprobs)[2] + TP <- dim(rprobs)[3] + M_implied <- rep(0,I) + names(M_implied) <- colnames(resp) + N <- nrow(hwt) + W <- sum(pweights) + + for (ii in 1:I){ + for (uu in 2:K){ + rpr <- matrix( rprobs[ii,uu,], nrow=N, ncol=TP, byrow=TRUE) + M_implied[ii] <- M_implied[ii] + sum( rpr*(uu-1)*pweights*hwt, na.rm=TRUE) + } + M_implied[ii] <- M_implied[ii] / W + } + return(M_implied) +} + diff --git a/README.md b/README.md index 699c6fe..680d161 100644 --- a/README.md +++ b/README.md @@ -22,9 +22,9 @@ The CRAN version can be installed from within R using: utils::install.packages("TAM") ``` -#### GitHub version `TAM` 3.7-3 (2021-04-30) +#### GitHub version `TAM` 3.7-5 (2021-05-16) -[![](https://img.shields.io/badge/github%20version-3.7--3-orange.svg)](https://github.com/alexanderrobitzsch/TAM)   +[![](https://img.shields.io/badge/github%20version-3.7--5-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: diff --git a/docs/404.html b/docs/404.html index 9cb2d3b..7b058c5 100644 --- a/docs/404.html +++ b/docs/404.html @@ -71,7 +71,7 @@ TAM - 3.7-3 + 3.7-5 diff --git a/docs/authors.html b/docs/authors.html index a92fa58..b9daa7d 100644 --- a/docs/authors.html +++ b/docs/authors.html @@ -71,7 +71,7 @@ TAM - 3.7-3 + 3.7-5 @@ -111,12 +111,12 @@

Citation

Source: inst/CITATION -

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

-
@Manual{TAM_3.7-3,
+    

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

+
@Manual{TAM_3.7-5,
   title = {TAM: Test Analysis Modules},
   author = {Alexander Robitzsch and Thomas Kiefer and Margaret Wu},
   year = {2021},
-  note = {R package version 3.7-3},
+  note = {R package version 3.7-5},
   url = {https://CRAN.R-project.org/package=TAM},
 }
diff --git a/docs/index.html b/docs/index.html index 0960462..a6af804 100644 --- a/docs/index.html +++ b/docs/index.html @@ -43,7 +43,7 @@ TAM - 3.7-3 + 3.7-5 diff --git a/docs/pkgdown.yml b/docs/pkgdown.yml index 8a31877..b8736e2 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: 2021-04-30T10:24Z +last_built: 2021-05-16T12:09Z diff --git a/docs/reference/TAM-utilities.html b/docs/reference/TAM-utilities.html index de11404..912531b 100644 --- a/docs/reference/TAM-utilities.html +++ b/docs/reference/TAM-utilities.html @@ -119,6 +119,8 @@

Utility Functions in TAM

## RISE item fit statistic of two models
 IRT.RISE( mod_p, mod_np, use_probs=TRUE )
+## model-implied means
+tam_model_implied_means(mod)
 
 ## information about used package version
 tam_packageinfo(pack)
@@ -198,6 +200,10 @@ 

Arg mod_np

Fitted model

+ + mod +

Fitted model

+ use_probs

Logical

diff --git a/docs/reference/index.html b/docs/reference/index.html index f15de10..b23a023 100644 --- a/docs/reference/index.html +++ b/docs/reference/index.html @@ -385,7 +385,7 @@

IRT.RISE() tam_packageinfo() tam_print_call() tam_rsessinfo() tam_args_CALL_search() require_namespace_msg() add.lead() tam_round_data_frame() tam_round_data_frame_print() tam_osink() tam_csink() tam_matrix2() tam_outer() tam_normalize_matrix_rows() tam_normalize_vector() tam_aggregate() tam_interval_index() tam_rowCumsums() tam_dmvnorm() tam_bayesian_bootstrap() tam_cov_wt() tam_cor_wt() tam_ginv() tam_ginv_scaled() tam_remove_missings() tam_AXsi_compute() tam_AXsi_fit() tam_max_abs() tam_max_abs_list() tam_trim_increment() tam_difference_quotient() tam_assign_list_elements()

+

IRT.RISE() tam_model_implied_means() tam_packageinfo() tam_print_call() tam_rsessinfo() tam_args_CALL_search() require_namespace_msg() add.lead() tam_round_data_frame() tam_round_data_frame_print() tam_osink() tam_csink() tam_matrix2() tam_outer() tam_normalize_matrix_rows() tam_normalize_vector() tam_aggregate() tam_interval_index() tam_rowCumsums() tam_dmvnorm() tam_bayesian_bootstrap() tam_cov_wt() tam_cor_wt() tam_ginv() tam_ginv_scaled() tam_remove_missings() tam_AXsi_compute() tam_AXsi_fit() tam_max_abs() tam_max_abs_list() tam_trim_increment() tam_difference_quotient() tam_assign_list_elements()

Utility Functions in TAM

diff --git a/inst/NEWS b/inst/NEWS index bb9e97b..2334e68 100644 --- a/inst/NEWS +++ b/inst/NEWS @@ -42,12 +42,16 @@ http://www.edmeasurementsurveys.com/TAM/Tutorials/ ------------------------------------------------------------- -VERSIONS TAM 3.7 | 2021-04-30 | Last: TAM 3.7-3 +VERSIONS TAM 3.7 | 2021-05-16 | Last: TAM 3.7-5 ------------------------------------------------------------- NOTE * changed computation of AXsi and xsi.item in outputs to prevent numerical differences with xsi (thanks to Rudolf Debelak) +NOTE * included utility function tam_model_implied_means() for + computation of model-implied means +FIXED * fixed a bug in tam.mml.wle() and tam.mml.wle2() if argument + 'score.resp' is used (thanks to Fu Liu) DATA * included/modified datasets: --- diff --git a/man/TAM-utilities.Rd b/man/TAM-utilities.Rd index c2738d4..909bf8e 100644 --- a/man/TAM-utilities.Rd +++ b/man/TAM-utilities.Rd @@ -1,5 +1,5 @@ %% File Name: TAM-utilities.Rd -%% File Version: 0.663 +%% File Version: 0.666 \name{TAM-utilities} \alias{TAM-utilities} @@ -35,7 +35,7 @@ \alias{tam_max_abs} \alias{tam_max_abs_list} \alias{IRT.RISE} - +\alias{tam_model_implied_means} \title{Utility Functions in \pkg{TAM}} @@ -46,6 +46,8 @@ Utility functions in \pkg{TAM}. \usage{ ## RISE item fit statistic of two models IRT.RISE( mod_p, mod_np, use_probs=TRUE ) +## model-implied means +tam_model_implied_means(mod) ## information about used package version tam_packageinfo(pack) @@ -118,6 +120,7 @@ tam_assign_list_elements(x, envir) \arguments{ \item{mod_p}{Fitted model} \item{mod_np}{Fitted model} +\item{mod}{Fitted model} \item{use_probs}{Logical} \item{pack}{An \R package} \item{CALL}{An \R call} diff --git a/src/RcppExports.cpp b/src/RcppExports.cpp index 87a9a85..306018b 100644 --- a/src/RcppExports.cpp +++ b/src/RcppExports.cpp @@ -1,5 +1,5 @@ //// File Name: RcppExports.cpp -//// File Version: 3.007003 +//// File Version: 3.007005 // Generated by using Rcpp::compileAttributes() -> do not edit by hand // Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393 diff --git a/src/init.c b/src/init.c index e07e822..cd07912 100644 --- a/src/init.c +++ b/src/init.c @@ -1,5 +1,5 @@ //// File Name: init.c -//// File Version: 3.007003 +//// File Version: 3.007005 #include #include #include // for NULL