From 4896964ae882011ada74638d72d36129a8b173ab Mon Sep 17 00:00:00 2001 From: Robitzsch Date: Fri, 14 Feb 2020 17:30:39 +0100 Subject: [PATCH] 3.4-15 --- DESCRIPTION | 7 +- NAMESPACE | 1 + R/RcppExports.R | 80 +- R/plot.tam.R | 27 +- R/plot_tam_grouped_wle.R | 8 +- R/tam.mml.R | 2 +- R/tam_downcode.R | 21 + R/tam_mml_ic.R | 6 +- R/tam_mml_mstep_regression.R | 18 +- R/tamaan.R | 38 +- R/tamaanify.R | 33 +- R/tamaanify.create.A.R | 8 +- ...aanify.create.Q.R => tamaanify_create_Q.R} | 20 +- ...anmodel.R => tamaanify_proc_lavaanmodel.R} | 13 +- ...nce.fixed.R => tamaanify_variance_fixed.R} | 11 +- README.md | 6 +- docs/404.html | 135 ++ docs/authors.html | 38 +- docs/index.html | 31 +- docs/pkgdown.css | 46 +- docs/pkgdown.js | 14 +- docs/pkgdown.yml | 4 +- docs/reference/DescribeBy.html | 40 +- docs/reference/IRT.WrightMap.html | 177 +-- docs/reference/IRT.cv.html | 38 +- docs/reference/IRT.data.tam.html | 61 +- docs/reference/IRT.drawPV.html | 51 +- docs/reference/IRT.expectedCounts.tam.html | 69 +- docs/reference/IRT.factor.scores.tam.html | 67 +- docs/reference/IRT.frequencies.tam.html | 67 +- docs/reference/IRT.informationCurves.html | 131 +- docs/reference/IRT.irfprob.tam.html | 71 +- docs/reference/IRT.itemfit.html | 99 +- docs/reference/IRT.likelihood.tam.html | 111 +- docs/reference/IRT.linearCFA.html | 109 +- docs/reference/IRT.residuals.html | 65 +- docs/reference/IRT.simulate.html | 156 +-- docs/reference/IRT.threshold.html | 107 +- docs/reference/IRT.truescore.html | 86 +- docs/reference/IRTLikelihood.cfa.html | 73 +- docs/reference/IRTLikelihood.ctt.html | 74 +- docs/reference/Scale.html | 40 +- docs/reference/TAM-defunct.html | 38 +- docs/reference/TAM-package.html | 53 +- docs/reference/TAM-utilities.html | 46 +- docs/reference/WLErel.html | 55 +- docs/reference/anova.tam.html | 124 +- docs/reference/cfa.extract.itempars.html | 88 +- docs/reference/data.cqc.html | 197 +-- docs/reference/data.ctest.html | 43 +- docs/reference/data.examples.html | 57 +- docs/reference/data.fims.Aus.Jpn.html | 64 +- docs/reference/data.geiser.html | 104 +- docs/reference/data.gpcm.html | 48 +- docs/reference/data.janssen.html | 70 +- docs/reference/data.mc.html | 37 +- docs/reference/data.numeracy.html | 95 +- docs/reference/data.sim.mfr.html | 86 +- docs/reference/data.sim.rasch.html | 75 +- docs/reference/data.timssAusTwn.html | 107 +- docs/reference/designMatrices.html | 65 +- docs/reference/doparse.html | 51 +- docs/reference/index.html | 51 +- docs/reference/lavaanify.IRT.html | 103 +- docs/reference/msq.itemfit.html | 185 +-- docs/reference/plot.tam.html | 98 +- docs/reference/plotDevianceTAM.html | 43 +- docs/reference/predict.html | 59 +- docs/reference/tam.ctt.html | 75 +- docs/reference/tam.fa.html | 93 +- docs/reference/tam.fit.html | 160 +-- docs/reference/tam.jml.html | 158 ++- docs/reference/tam.latreg.html | 186 +-- docs/reference/tam.linking.html | 229 ++-- docs/reference/tam.mml.3pl.html | 830 +----------- docs/reference/tam.mml.html | 1168 ++++++++--------- docs/reference/tam.modelfit.html | 158 +-- docs/reference/tam.np.html | 147 ++- docs/reference/tam.personfit.html | 51 +- docs/reference/tam.pv.html | 344 ++--- docs/reference/tam.se.html | 72 +- docs/reference/tam.threshold.html | 94 +- docs/reference/tam.wle.html | 142 +- docs/reference/tam_NA_pattern.html | 51 +- docs/reference/tam_downcode.html | 189 +++ docs/reference/tam_irf_3pl.html | 51 +- docs/reference/tamaan.html | 166 +-- docs/reference/tamaanify.html | 80 +- docs/reference/tampv2datalist.html | 40 +- docs/reference/weighted_Stats.html | 157 +-- inst/NEWS | 13 +- man/TAM-package.Rd | 12 +- man/plot.tam.Rd | 23 +- man/tam.mml.3pl.Rd | 4 +- man/tam.mml.Rd | 5 +- man/tam_downcode.Rd | 78 ++ src/RcppExports.cpp | 6 +- src/init.c | 2 +- 98 files changed, 4373 insertions(+), 4712 deletions(-) create mode 100644 R/tam_downcode.R rename R/{tamaanify.create.Q.R => tamaanify_create_Q.R} (60%) rename R/{tamaanify.proc.lavaanmodel.R => tamaanify_proc_lavaanmodel.R} (58%) rename R/{tamaanify.variance.fixed.R => tamaanify_variance_fixed.R} (74%) create mode 100644 docs/404.html create mode 100644 docs/reference/tam_downcode.html create mode 100644 man/tam_downcode.Rd diff --git a/DESCRIPTION b/DESCRIPTION index cc605db..75e096e 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,11 +1,11 @@ Package: TAM Type: Package Title: Test Analysis Modules -Version: 3.4-5 -Date: 2019-10-24 15:51:29 +Version: 3.4-15 +Date: 2020-02-14 17:10:51 Author: Alexander Robitzsch [aut, cre], Thomas Kiefer [aut], Margaret Wu [aut] -Maintainer: Alexander Robitzsch +Maintainer: Alexander Robitzsch Description: Includes marginal maximum likelihood estimation and joint maximum likelihood estimation for unidimensional and multidimensional @@ -36,4 +36,3 @@ URL: http://www.edmeasurementsurveys.com/TAM/Tutorials/, https://github.com/alexanderrobitzsch/TAM, https://sites.google.com/site/alexanderrobitzsch2/software -RoxygenNote: 6.1.1 diff --git a/NAMESPACE b/NAMESPACE index 255f477..4ed45c5 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -176,6 +176,7 @@ export(tam_cov_wt) export(tam_cor_wt) export(tam_csink) export(tam_difference_quotient) +export(tam_downcode) export(tam_dmvnorm) export(tam_ginv) export(tam_ginv_scaled) diff --git a/R/RcppExports.R b/R/RcppExports.R index b63b81e..53b40ae 100644 --- a/R/RcppExports.R +++ b/R/RcppExports.R @@ -1,159 +1,161 @@ +## File Name: RcppExports.R +## File Version: 3.004015 # Generated by using Rcpp::compileAttributes() -> do not edit by hand # Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393 tam_rcpp_calc_exp <- function(NP, rprobs, A, INDEXIPNO, INDEXIPLIST2, ESTXSIINDEX, C, ITEMWT, NR, TP) { - .Call('_TAM_tam_rcpp_calc_exp', PACKAGE = 'TAM', NP, rprobs, A, INDEXIPNO, INDEXIPLIST2, ESTXSIINDEX, C, ITEMWT, NR, TP) + .Call('_TAM_tam_rcpp_calc_exp', PACKAGE='TAM', NP, rprobs, A, INDEXIPNO, INDEXIPLIST2, ESTXSIINDEX, C, ITEMWT, NR, TP) } tam_rcpp_calc_exp_redefine_vector_na <- function(A, val) { - .Call('_TAM_tam_rcpp_calc_exp_redefine_vector_na', PACKAGE = 'TAM', A, val) + .Call('_TAM_tam_rcpp_calc_exp_redefine_vector_na', PACKAGE='TAM', A, val) } tam_rcpp_calc_prob_subtract_max <- function(rr0M, NI, NK, TP) { - .Call('_TAM_tam_rcpp_calc_prob_subtract_max', PACKAGE = 'TAM', rr0M, NI, NK, TP) + .Call('_TAM_tam_rcpp_calc_prob_subtract_max', PACKAGE='TAM', rr0M, NI, NK, TP) } tam_rcpp_calc_prob_subtract_max_exp <- function(rr0, dim_rr) { - .Call('_TAM_tam_rcpp_calc_prob_subtract_max_exp', PACKAGE = 'TAM', rr0, dim_rr) + .Call('_TAM_tam_rcpp_calc_prob_subtract_max_exp', PACKAGE='TAM', rr0, dim_rr) } tam_rcpp_calc_prob <- function(A, dimA, xsi, maxcat, AXsi0, iIndex, theta, B) { - .Call('_TAM_tam_rcpp_calc_prob', PACKAGE = 'TAM', A, dimA, xsi, maxcat, AXsi0, iIndex, theta, B) + .Call('_TAM_tam_rcpp_calc_prob', PACKAGE='TAM', A, dimA, xsi, maxcat, AXsi0, iIndex, theta, B) } tam_rcpp_tam_mml_calc_prob_R_outer_Btheta <- function(Btheta, B_dd, theta_dd, dim_Btheta) { - .Call('_TAM_tam_rcpp_tam_mml_calc_prob_R_outer_Btheta', PACKAGE = 'TAM', Btheta, B_dd, theta_dd, dim_Btheta) + .Call('_TAM_tam_rcpp_tam_mml_calc_prob_R_outer_Btheta', PACKAGE='TAM', Btheta, B_dd, theta_dd, dim_Btheta) } tam_rcpp_tam_mml_calc_prob_R_normalize_rprobs <- function(rr, dim_rr) { - .Call('_TAM_tam_rcpp_tam_mml_calc_prob_R_normalize_rprobs', PACKAGE = 'TAM', rr, dim_rr) + .Call('_TAM_tam_rcpp_tam_mml_calc_prob_R_normalize_rprobs', PACKAGE='TAM', rr, dim_rr) } tam_rcpp_calc_suff_stat <- function(resp, resp_ind, maxK, nitems, pweights, cA) { - .Call('_TAM_tam_rcpp_calc_suff_stat', PACKAGE = 'TAM', resp, resp_ind, maxK, nitems, pweights, cA) + .Call('_TAM_tam_rcpp_calc_suff_stat', PACKAGE='TAM', resp, resp_ind, maxK, nitems, pweights, cA) } tam_rcpp_ctt2 <- function(TDAT, WLE, MAXK, EST_WLE, prg) { - .Call('_TAM_tam_rcpp_ctt2', PACKAGE = 'TAM', TDAT, WLE, MAXK, EST_WLE, prg) + .Call('_TAM_tam_rcpp_ctt2', PACKAGE='TAM', TDAT, WLE, MAXK, EST_WLE, prg) } tam_rcpp_ctt3 <- function(TDAT, WLE, MAXK, EST_WLE, prg) { - .Call('_TAM_tam_rcpp_ctt3', PACKAGE = 'TAM', TDAT, WLE, MAXK, EST_WLE, prg) + .Call('_TAM_tam_rcpp_ctt3', PACKAGE='TAM', TDAT, WLE, MAXK, EST_WLE, prg) } tam_rcpp_fit_simul <- function(rn1M, c_hwt, Ax, xbar, var1, Uz2, Vz2, nstud_ip, pweights) { - .Call('_TAM_tam_rcpp_fit_simul', PACKAGE = 'TAM', rn1M, c_hwt, Ax, xbar, var1, Uz2, Vz2, nstud_ip, pweights) + .Call('_TAM_tam_rcpp_fit_simul', PACKAGE='TAM', rn1M, c_hwt, Ax, xbar, var1, Uz2, Vz2, nstud_ip, pweights) } tam_rcpp_theta_sq <- function(theta) { - .Call('_TAM_tam_rcpp_theta_sq', PACKAGE = 'TAM', theta) + .Call('_TAM_tam_rcpp_theta_sq', PACKAGE='TAM', theta) } tam_rcpp_interval_index <- function(MATR, RN) { - .Call('_TAM_tam_rcpp_interval_index', PACKAGE = 'TAM', MATR, RN) + .Call('_TAM_tam_rcpp_interval_index', PACKAGE='TAM', MATR, RN) } tam_rcpp_irt_likelihood_cfa <- function(data, nu, psi, L, theta) { - .Call('_TAM_tam_rcpp_irt_likelihood_cfa', PACKAGE = 'TAM', data, nu, psi, L, theta) + .Call('_TAM_tam_rcpp_irt_likelihood_cfa', PACKAGE='TAM', data, nu, psi, L, theta) } tam_rcpp_mml_2pl_mstep_item_slopes_suffstat <- function(rprobs, items_temp, theta, dd, LIT, TP, nitems, maxcat, maxK, itemwt, xxf_, xbar_, xbar2_, irtmodel, xtemp_, items_conv) { - .Call('_TAM_tam_rcpp_mml_2pl_mstep_item_slopes_suffstat', PACKAGE = 'TAM', rprobs, items_temp, theta, dd, LIT, TP, nitems, maxcat, maxK, itemwt, xxf_, xbar_, xbar2_, irtmodel, xtemp_, items_conv) + .Call('_TAM_tam_rcpp_mml_2pl_mstep_item_slopes_suffstat', PACKAGE='TAM', rprobs, items_temp, theta, dd, LIT, TP, nitems, maxcat, maxK, itemwt, xxf_, xbar_, xbar2_, irtmodel, xtemp_, items_conv) } tam_rcpp_mml_3pl_calc_Fdes <- function(XDES, dimXdes) { - .Call('_TAM_tam_rcpp_mml_3pl_calc_Fdes', PACKAGE = 'TAM', XDES, dimXdes) + .Call('_TAM_tam_rcpp_mml_3pl_calc_Fdes', PACKAGE='TAM', XDES, dimXdes) } tam_rcpp_mml_3pl_slca_deriv <- function(XdesM, dimXdes, Xlambda, probs, nik, Nik, guess, probs0) { - .Call('_TAM_tam_rcpp_mml_3pl_slca_deriv', PACKAGE = 'TAM', XdesM, dimXdes, Xlambda, probs, nik, Nik, guess, probs0) + .Call('_TAM_tam_rcpp_mml_3pl_slca_deriv', PACKAGE='TAM', XdesM, dimXdes, Xlambda, probs, nik, Nik, guess, probs0) } tam_rcpp_mml_3pl_calcexp <- function(NP, rprobs, A, INDEXIPNO, INDEXIPLIST2, ESTXSIINDEX, C, ITEMWT, rprobs0, GUESS, nik, ni) { - .Call('_TAM_tam_rcpp_mml_3pl_calcexp', PACKAGE = 'TAM', NP, rprobs, A, INDEXIPNO, INDEXIPLIST2, ESTXSIINDEX, C, ITEMWT, rprobs0, GUESS, nik, ni) + .Call('_TAM_tam_rcpp_mml_3pl_calcexp', PACKAGE='TAM', NP, rprobs, A, INDEXIPNO, INDEXIPLIST2, ESTXSIINDEX, C, ITEMWT, rprobs0, GUESS, nik, ni) } tam_rcpp_mml_3pl_compute_B <- function(Edes, gammaslope, dimE) { - .Call('_TAM_tam_rcpp_mml_3pl_compute_B', PACKAGE = 'TAM', Edes, gammaslope, dimE) + .Call('_TAM_tam_rcpp_mml_3pl_compute_B', PACKAGE='TAM', Edes, gammaslope, dimE) } tam_rcpp_mml_3pl_nonzero_entries <- function(E, dimE) { - .Call('_TAM_tam_rcpp_mml_3pl_nonzero_entries', PACKAGE = 'TAM', E, dimE) + .Call('_TAM_tam_rcpp_mml_3pl_nonzero_entries', PACKAGE='TAM', E, dimE) } tam_rcpp_mml_mfr_gresp_extend <- function(gresp, xstep) { - .Call('_TAM_tam_rcpp_mml_mfr_gresp_extend', PACKAGE = 'TAM', gresp, xstep) + .Call('_TAM_tam_rcpp_mml_mfr_gresp_extend', PACKAGE='TAM', gresp, xstep) } tam_rcpp_mml_mfr_gresp_na_facets <- function(gresp, rnfacets, rnx) { - .Call('_TAM_tam_rcpp_mml_mfr_gresp_na_facets', PACKAGE = 'TAM', gresp, rnfacets, rnx) + .Call('_TAM_tam_rcpp_mml_mfr_gresp_na_facets', PACKAGE='TAM', gresp, rnfacets, rnx) } tam_rcpp_mml_mfr_a_matrix_cumsum <- function(index_matr, mm, SG) { - .Call('_TAM_tam_rcpp_mml_mfr_a_matrix_cumsum', PACKAGE = 'TAM', index_matr, mm, SG) + .Call('_TAM_tam_rcpp_mml_mfr_a_matrix_cumsum', PACKAGE='TAM', index_matr, mm, SG) } tam_rcpp_mml_mfr_colsums_gresp <- function(gresp) { - .Call('_TAM_tam_rcpp_mml_mfr_colsums_gresp', PACKAGE = 'TAM', gresp) + .Call('_TAM_tam_rcpp_mml_mfr_colsums_gresp', PACKAGE='TAM', gresp) } tam_rcpp_mml_maxcat <- function(A, dimA) { - .Call('_TAM_tam_rcpp_mml_maxcat', PACKAGE = 'TAM', A, dimA) + .Call('_TAM_tam_rcpp_mml_maxcat', PACKAGE='TAM', A, dimA) } tam_rcpp_modelfit_q3 <- function(residM, resp_bool) { - .Call('_TAM_tam_rcpp_modelfit_q3', PACKAGE = 'TAM', residM, resp_bool) + .Call('_TAM_tam_rcpp_modelfit_q3', PACKAGE='TAM', residM, resp_bool) } tam_rcpp_modelfit_counts <- function(resp0, resp_bool, rprobs, hwt, maxKi, maxK) { - .Call('_TAM_tam_rcpp_modelfit_counts', PACKAGE = 'TAM', resp0, resp_bool, rprobs, hwt, maxKi, maxK) + .Call('_TAM_tam_rcpp_modelfit_counts', PACKAGE='TAM', resp0, resp_bool, rprobs, hwt, maxKi, maxK) } tam_rcpp_modelfit_ccov <- function(counts, scorematrix, adjust) { - .Call('_TAM_tam_rcpp_modelfit_ccov', PACKAGE = 'TAM', counts, scorematrix, adjust) + .Call('_TAM_tam_rcpp_modelfit_ccov', PACKAGE='TAM', counts, scorematrix, adjust) } tam_rcpp_modelfit_residuals <- function(rprobs, resp, I, TP, maxK, maxKi, hwt, resp_bool) { - .Call('_TAM_tam_rcpp_modelfit_residuals', PACKAGE = 'TAM', rprobs, resp, I, TP, maxK, maxKi, hwt, resp_bool) + .Call('_TAM_tam_rcpp_modelfit_residuals', PACKAGE='TAM', rprobs, resp, I, TP, maxK, maxKi, hwt, resp_bool) } tam_rcpp_msq_itemfit <- function(resp, irf1, K, TP, post1, FIT, fitIndexM, resp_bool) { - .Call('_TAM_tam_rcpp_msq_itemfit', PACKAGE = 'TAM', resp, irf1, K, TP, post1, FIT, fitIndexM, resp_bool) + .Call('_TAM_tam_rcpp_msq_itemfit', PACKAGE='TAM', resp, irf1, K, TP, post1, FIT, fitIndexM, resp_bool) } tam_rcpp_prior_normal_density_unequal_means <- function(theta, mu, varInverse, COEFF) { - .Call('_TAM_tam_rcpp_prior_normal_density_unequal_means', PACKAGE = 'TAM', theta, mu, varInverse, COEFF) + .Call('_TAM_tam_rcpp_prior_normal_density_unequal_means', PACKAGE='TAM', theta, mu, varInverse, COEFF) } tam_rcpp_prior_normal_density_equal_means <- function(theta, mu, varInverse, COEFF) { - .Call('_TAM_tam_rcpp_prior_normal_density_equal_means', PACKAGE = 'TAM', theta, mu, varInverse, COEFF) + .Call('_TAM_tam_rcpp_prior_normal_density_equal_means', PACKAGE='TAM', theta, mu, varInverse, COEFF) } tam_rcpp_pv_mcmc_likelihood <- function(probs, resp, resp_ind_bool, maxK, nstud, nitems) { - .Call('_TAM_tam_rcpp_pv_mcmc_likelihood', PACKAGE = 'TAM', probs, resp, resp_ind_bool, maxK, nstud, nitems) + .Call('_TAM_tam_rcpp_pv_mcmc_likelihood', PACKAGE='TAM', probs, resp, resp_ind_bool, maxK, nstud, nitems) } tam_rcpp_pv_mcmc_calc_probs_irf_3pl <- function(theta, B, I, maxK, resp_ind, AXsi) { - .Call('_TAM_tam_rcpp_pv_mcmc_calc_probs_irf_3pl', PACKAGE = 'TAM', theta, B, I, maxK, resp_ind, AXsi) + .Call('_TAM_tam_rcpp_pv_mcmc_calc_probs_irf_3pl', PACKAGE='TAM', theta, B, I, maxK, resp_ind, AXsi) } tam_rcpp_pv_sample_theta_multidim <- function(post, theta) { - .Call('_TAM_tam_rcpp_pv_sample_theta_multidim', PACKAGE = 'TAM', post, theta) + .Call('_TAM_tam_rcpp_pv_sample_theta_multidim', PACKAGE='TAM', post, theta) } tam_rcpp_rowCumsums <- function(input) { - .Call('_TAM_tam_rcpp_rowCumsums', PACKAGE = 'TAM', input) + .Call('_TAM_tam_rcpp_rowCumsums', PACKAGE='TAM', input) } tam_rcpp_tam_np_posterior <- function(dat2, dat_resp, probs0, pi_k, pweights, K1) { - .Call('_TAM_tam_rcpp_tam_np_posterior', PACKAGE = 'TAM', dat2, dat_resp, probs0, pi_k, pweights, K1) + .Call('_TAM_tam_rcpp_tam_np_posterior', PACKAGE='TAM', dat2, dat_resp, probs0, pi_k, pweights, K1) } tam_rcpp_wle_suffstat <- function(RPROBS, CBL, CBB, CBBB, cndim, cnitems, cmaxK, cnstud, resp_ind) { - .Call('_TAM_tam_rcpp_wle_suffstat', PACKAGE = 'TAM', RPROBS, CBL, CBB, CBBB, cndim, cnitems, cmaxK, cnstud, resp_ind) + .Call('_TAM_tam_rcpp_wle_suffstat', PACKAGE='TAM', RPROBS, CBL, CBB, CBBB, cndim, cnitems, cmaxK, cnstud, resp_ind) } tam_rcpp_wle_errinv <- function(myERR, cndim, cnstud) { - .Call('_TAM_tam_rcpp_wle_errinv', PACKAGE = 'TAM', myERR, cndim, cnstud) + .Call('_TAM_tam_rcpp_wle_errinv', PACKAGE='TAM', myERR, cndim, cnstud) } diff --git a/R/plot.tam.R b/R/plot.tam.R index 7fc9da8..6875fed 100644 --- a/R/plot.tam.R +++ b/R/plot.tam.R @@ -1,5 +1,5 @@ ## File Name: plot.tam.R -## File Version: 9.283 +## File Version: 9.2873 #--- plotting tam expected scores curves plot.tam <- function(x, items=1:x$nitems, type="expected", @@ -7,7 +7,7 @@ plot.tam <- function(x, items=1:x$nitems, type="expected", wle=NULL, export=TRUE, export.type="png", export.args=list(), observed=TRUE, overlay=FALSE, ask=FALSE, package="lattice", - fix.devices=TRUE, ...) + fix.devices=TRUE, nnodes=100, ...) { require_namespace_msg("grDevices") if ( package=="lattice"){ @@ -46,13 +46,10 @@ plot.tam <- function(x, items=1:x$nitems, type="expected", } nitems <- tamobj$nitems - nnodes <- 100 if (ndim==1 ){ theta <- matrix(seq(low, high, length=nnodes), nrow=nnodes, ncol=ndim) } else { - # theta <- tamobj$theta - nnodes <- 40 nodes <- seq(low, high, length=nnodes) theta <- as.matrix( expand.grid( as.data.frame( matrix( rep(nodes, ndim), ncol=ndim ) ) ) ) nnodes <- nrow(theta) @@ -78,6 +75,10 @@ plot.tam <- function(x, items=1:x$nitems, type="expected", AXsi <- res[["AXsi"]] cat <- 1:maxK - 1 + #@@@ define initial empty objects + expScore <- obScore <- wle_intervals <- NULL + theta2 <- NULL + #**** type='expected' if ( type=="expected" ){ expScore <- sapply(1:nitems, function(i) colSums(cat*rprobs[i,,], na.rm=TRUE)) @@ -91,6 +92,7 @@ plot.tam <- function(x, items=1:x$nitems, type="expected", d2 <- res$d2 groupnumber <- res$groupnumber ngroups <- res$ngroups + wle_intervals <- res$wle_intervals #-- compute observed scores obScore <- apply(d2,2, function(x){ stats::aggregate(x, list(groupnumber), mean, na.rm=TRUE) @@ -130,6 +132,8 @@ plot.tam <- function(x, items=1:x$nitems, type="expected", #************************************************* # begin plot function + probs_plot <- as.list(1:nitems) + names(probs_plot) <- items for (i in (1:nitems)[items]) { #*********************************************************** @@ -161,8 +165,9 @@ plot.tam <- function(x, items=1:x$nitems, type="expected", } } #*********************************************************** - if ( type=="items"){ + + if ( type=="items"){ rprobs.ii <- rprobs[i,,] rprobs.ii <- rprobs.ii[ rowMeans( is.na(rprobs.ii) ) < 1, ] K <- nrow(rprobs.ii) @@ -177,6 +182,7 @@ plot.tam <- function(x, items=1:x$nitems, type="expected", theta0 <- rprobs0.ii[,1,drop=FALSE] rprobs.ii <- t( rprobs0.ii[,-1] ) } + probs_plot[[i]] <- rprobs.ii #************** for (kk in 1:K){ dat2a <- data.frame( "Theta"=theta0[,1], "cat"=kk, "P"=rprobs.ii[kk,] ) @@ -410,7 +416,14 @@ plot.tam <- function(x, items=1:x$nitems, type="expected", file.path(getwd(), "Plots")) ; utils::flush.console() } } - + # option output + res_exp <- list(obScore=obScore, expScore=expScore, ngroups=ngroups, + wle_intervals=wle_intervals, theta=theta, + wle_obs_plotted=theta2) + res_items <- list(items=items, nitems=nitems, obScore=obScore, theta=theta0, + probs_plot=probs_plot) + res <- list(type_expected=res_exp, res_items=res_items) + invisible(res) } plot.tam.mml <- plot.tam diff --git a/R/plot_tam_grouped_wle.R b/R/plot_tam_grouped_wle.R index e1a248f..df8eaf7 100644 --- a/R/plot_tam_grouped_wle.R +++ b/R/plot_tam_grouped_wle.R @@ -1,5 +1,5 @@ ## File Name: plot_tam_grouped_wle.R -## File Version: 0.11 +## File Version: 0.123 plot_tam_grouped_wle <- function( tamobj, tammodel, wle, ngroups, resp) @@ -14,7 +14,8 @@ plot_tam_grouped_wle <- function( tamobj, tammodel, wle, ngroups, resp) } q1 <- 1 / ngroups quant <- unique( stats::quantile(wle, probs=seq(q1, 1 - q1, by=q1), na.rm=TRUE ) ) - groupnumber <- as.numeric( cut( wle, breaks=c( -Inf, quant, Inf) ) ) + wle_intervals <- c( -Inf, quant, Inf) + groupnumber <- as.numeric( cut( wle, breaks=wle_intervals ) ) aggr <- stats::aggregate(wle, list(groupnumber), mean, na.rm=TRUE) theta2 <- aggr$x ngroups <- length(theta2) @@ -23,6 +24,7 @@ plot_tam_grouped_wle <- function( tamobj, tammodel, wle, ngroups, resp) d2 <- d1[-1] #--- output res <- list(wle=wle, theta2=theta2, d=d, d1=d1, d2=d2, - groupnumber=groupnumber, ngroups=ngroups) + groupnumber=groupnumber, ngroups=ngroups, + wle_intervals=wle_intervals) return(res) } diff --git a/R/tam.mml.R b/R/tam.mml.R index 9269fbf..3d388e9 100644 --- a/R/tam.mml.R +++ b/R/tam.mml.R @@ -1,5 +1,5 @@ ## File Name: tam.mml.R -## File Version: 9.795 +## File Version: 9.797 tam.mml <- function( resp, Y=NULL, group=NULL, irtmodel="1PL", formulaY=NULL, dataY=NULL, diff --git a/R/tam_downcode.R b/R/tam_downcode.R new file mode 100644 index 0000000..c5171ef --- /dev/null +++ b/R/tam_downcode.R @@ -0,0 +1,21 @@ +## File Name: tam_downcode.R +## File Version: 0.03 + +tam_downcode <- function(dat) +{ + res <- NULL + dat1 <- NA*dat + I <- ncol(dat) + + for (ii in 1L:I){ + v1 <- dat[,ii] + vals_ii <- sort(unique(v1)) + n_ii <- length(vals_ii) + ind_ii <- match(v1, vals_ii) + dat1[,ii] <- ind_ii-1 + rec_ii <- data.frame(item=colnames(dat)[ii], orig=vals_ii, rec=0:(n_ii-1) ) + rec <- rbind(rec, rec_ii) + } + res <- list(dat=dat1, rec=rec) + return(res) +} diff --git a/R/tam_mml_ic.R b/R/tam_mml_ic.R index 5d10e30..2e4ed6f 100644 --- a/R/tam_mml_ic.R +++ b/R/tam_mml_ic.R @@ -1,5 +1,5 @@ ## File Name: tam_mml_ic.R -## File Version: 9.194 +## File Version: 9.196 #--- information criteria @@ -57,7 +57,7 @@ tam_mml_ic <- function( nstud, deviance, xsi, xsi.fixed, if ( irtmodel=="GPCM" ){ nB <- length(B.fixed[ B.fixed[,2]==2,1]) } - ic$NparsB <- ic$NparsB - nB + ic$NparsB <- max(ic$NparsB - nB, 0) } # beta regression parameters @@ -70,7 +70,7 @@ tam_mml_ic <- function( nstud, deviance, xsi, xsi.fixed, if ( ! est.variance ){ ic$Nparscov <- ic$Nparscov - ndim } - if ( ! is.null( variance.fixed) ){ + if ( ! is.null(variance.fixed) ){ ic$Nparscov <- max(0, ic$Nparscov - nrow(variance.fixed ) ) } diff --git a/R/tam_mml_mstep_regression.R b/R/tam_mml_mstep_regression.R index 37e1b3b..a50c3c2 100644 --- a/R/tam_mml_mstep_regression.R +++ b/R/tam_mml_mstep_regression.R @@ -1,5 +1,5 @@ ## File Name: tam_mml_mstep_regression.R -## File Version: 9.48 +## File Version: 9.497 # mstep.regression @@ -50,28 +50,26 @@ tam_mml_mstep_regression <- function( resp, hwt, resp.ind, sumbeta <- crossprod( Y, thetabar*pweights ) sumsig2 <- as.vector( crossprod( colSums( pweights * hwt ), theta2 ) ) } - #---------------------------------------- - # calculation of variance and regression coefficients + + #--- calculation of variance and regression coefficients beta <- YYinv %*% sumbeta # updated beta sumsig2 <- matrix(sumsig2, nrow=ndim, ncol=ndim) if (G==1){ variance <- (sumsig2- crossprod( sumbeta, beta ) )/nstud #new variance } - #---------------------------------------- - # fixed beta coefficients + + #--- fixed beta coefficients if ( ! is.null( beta.fixed )){ beta[ beta.fixed[,1:2,drop=FALSE] ] <- beta.fixed[,3] beta <- as.matrix( beta, ncol=ndim ) } - #---------------------------------------- - # fixed covariance matrix entries + + #--- fixed covariance matrix entries if ( ! is.null(variance.fixed) ){ variance[ variance.fixed[,1:2,drop=FALSE] ] <- variance.fixed[,3] variance[ variance.fixed[,c(2,1),drop=FALSE] ] <- variance.fixed[,3] } - #---------------------------------------- - #**************************************** ###### Multiple Groups ############## if ( G > 1){ # begin multiple groups if ( snodes > 0 ){ @@ -143,5 +141,3 @@ tam_mml_mstep_regression <- function( resp, hwt, resp.ind, mstep.regression <- tam_mml_mstep_regression - - diff --git a/R/tamaan.R b/R/tamaan.R index fc64626..64663aa 100644 --- a/R/tamaan.R +++ b/R/tamaan.R @@ -1,8 +1,8 @@ ## File Name: tamaan.R -## File Version: 9.19 +## File Version: 9.214 -########################################################## -# tamaan function + +#--- tamaan function tamaan <- function( tammodel, resp, tam.method=NULL, control=list(), doparse=TRUE, ... ) { @@ -46,14 +46,13 @@ tamaan <- function( tammodel, resp, tam.method=NULL, con[ names(control) ] <- control Lcon <- length(con) - con1a <- con1 <- con ; + con1a <- con1 <- con names(con1) <- NULL for (cc in 1:Lcon ){ assign( names(con)[cc], con1[[cc]], envir=e1 ) } - #****************************** - # tam.mml + #--- tam.mml if ( res0$method=="tam.mml" ){ res <- tam.mml( resp=res0$resp, A=res0$A, xsi.fixed=res0$xsi.fixed, Q=res0$Q, variance.fixed=res0$variance.fixed, @@ -61,8 +60,7 @@ tamaan <- function( tammodel, resp, tam.method=NULL, res$tamaan.method <- "tam.mml" } - #****************************** - # tam.mml.2pl + #--- tam.mml.2pl if ( res0$method=="tam.mml.2pl" ){ res <- tam.mml.2pl( resp=res0$resp, A=res0$A, xsi.fixed=res0$xsi.fixed, Q=res0$Q, variance.fixed=res0$variance.fixed, @@ -70,40 +68,31 @@ tamaan <- function( tammodel, resp, tam.method=NULL, control=con, ... ) res$tamaan.method <- "tam.mml.2pl" } - #****************************** - # 3PL: latent class analysis + + #--- 3PL: latent class analysis if ( ( res0$method=="tam.mml.3pl" ) & ( anal.list$type=="LCA" ) ){ res <- tamaan.3pl.lca( res0=res0, anal.list=anal.list, con=con, ... ) } - #*********************************** - #****************************** - # 3PL: ordered latent class analysis + #--- 3PL: ordered latent class analysis if ( ( res0$method=="tam.mml.3pl" ) & ( anal.list$type=="OLCA" ) ){ res <- tamaan.3pl.olca( res0=res0, anal.list=anal.list, con=con, ... ) } - #*********************************** - #****************************** - # 3PL: trait model + #--- 3PL: trait model if ( ( res0$method=="tam.mml.3pl" ) & ( anal.list$type=="TRAIT" ) ){ res <- tamaan.3pl.trait( res0=res0, anal.list=anal.list, con=con, ... ) } - #*********************************** - #****************************** - # 3PL: located latent class analysis + #--- 3PL: located latent class analysis if ( ( res0$method=="tam.mml.3pl" ) & ( anal.list$type=="LOCLCA" ) ){ res <- tamaan.3pl.loclca( res0=res0, anal.list=anal.list, con=con, ... ) } - #*********************************** - #****************************** - # 3PL: mixture distribution models + #--- 3PL: mixture distribution models if ( ( res0$method=="tam.mml.3pl" ) & ( anal.list$type=="MIXTURE" ) ){ res <- tamaan.3pl.mixture( res0=res0, anal.list=anal.list, con=con, ... ) } - #*********************************** s1 <- Sys.time() time1 <- c( s0, s1, s1-s0) @@ -116,8 +105,5 @@ tamaan <- function( tammodel, resp, tam.method=NULL, res$anal.list <- anal.list class(res) <- "tamaan" res$CALL <- cl - return(res) } -########################################################### - diff --git a/R/tamaanify.R b/R/tamaanify.R index 18e8266..8507ccf 100644 --- a/R/tamaanify.R +++ b/R/tamaanify.R @@ -1,8 +1,8 @@ ## File Name: tamaanify.R -## File Version: 9.19 +## File Version: 9.216 -###################################################### -# tamaanify + +#--- tamaanify function tamaanify <- function( tammodel, resp, tam.method=NULL, doparse=TRUE ) { dat <- resp @@ -43,7 +43,7 @@ tamaanify <- function( tammodel, resp, tam.method=NULL, doparse=TRUE ) res <- tamaanify.proc.analysis( res ) #*** extract lavaan model - res <- tamaanify.proc.lavaanmodel(res, resp ) + res <- tamaanify_proc_lavaanmodel(res=res, resp=resp) #*** item characteristics res <- tamaanify.proc.items( res, resp) @@ -57,7 +57,7 @@ tamaanify <- function( tammodel, resp, tam.method=NULL, doparse=TRUE ) #****** # add response dataset cols <- paste(res$items$item) - resp <- resp[, cols ] + resp <- resp[, cols] res$resp <- resp #********** @@ -68,34 +68,33 @@ tamaanify <- function( tammodel, resp, tam.method=NULL, doparse=TRUE ) } #*** A matrix - res <- tamaanify.create.A( res ) + res <- tamaanify.create.A(res=res) #*** Q matrix - res <- tamaanify.create.Q( res ) + res <- tamaanify_create_Q(res=res) #*** fixed loadings in tam.mml.2pl (B.fixed) - res <- tamaanify.proc.loadings.B.fixed(res) + res <- tamaanify.proc.loadings.B.fixed(res=res) #*** model constraints loadings - res <- tamaanify.modelconstraints.loadings(res) + res <- tamaanify.modelconstraints.loadings(res=res) #*** variance fixings - res <- tamaanify.variance.fixed( res) + res <- tamaanify_variance_fixed(res=res) #*** define design matrices for tam.mml.3pl method - res <- tamaanify.tam.mml.3pl.designMatrices(res) + res <- tamaanify.tam.mml.3pl.designMatrices(res=res) #*** delta design matrix - res <- tamaanify.tam.mml.3pl.deltadesign(res) + res <- tamaanify.tam.mml.3pl.deltadesign(res=res) #**** model prior - res <- tamaanify.modelprior( res ) + res <- tamaanify.modelprior(res=res) #*** define method - res <- tamaanify.define.method(res, tam.method ) + res <- tamaanify.define.method(res=res, tam.method=tam.method) - #************************************************+ - # OUTPUT + #--- OUTPUT return(res) } -############################################################### + diff --git a/R/tamaanify.create.A.R b/R/tamaanify.create.A.R index 88a8282..a207ec0 100644 --- a/R/tamaanify.create.A.R +++ b/R/tamaanify.create.A.R @@ -1,11 +1,9 @@ ## File Name: tamaanify.create.A.R -## File Version: 9.09 +## File Version: 9.11 - -######################################################### -# create A matrix -tamaanify.create.A <- function( res ) +#-- create A matrix +tamaanify.create.A <- function(res) { resp <- res$resp lavpartable <- res$lavpartable diff --git a/R/tamaanify.create.Q.R b/R/tamaanify_create_Q.R similarity index 60% rename from R/tamaanify.create.Q.R rename to R/tamaanify_create_Q.R index 3342014..b6ee65a 100644 --- a/R/tamaanify.create.Q.R +++ b/R/tamaanify_create_Q.R @@ -1,11 +1,11 @@ -## File Name: tamaanify.create.Q.R -## File Version: 9.06 +## File Name: tamaanify_create_Q.R +## File Version: 9.12 -############################################################# -# create Q matrix -tamaanify.create.Q <- function( res ){ +#--- create Q matrix +tamaanify_create_Q <- function( res ) +{ lavpartable <- res$lavpartable resp <- res$resp ind <- which( lavpartable$op=="=~" ) @@ -22,14 +22,12 @@ tamaanify.create.Q <- function( res ){ rownames(Q) <- items colnames(Q) <- facs for (ff in 1:NF){ - # ff <- 1 - ind.ff <- intersect( which( paste(lavpartable$lhs)==facs[ff] ), ind ) + ind.ff <- intersect( which( paste(lavpartable$lhs)==facs[ff] ), ind ) lff <- lavpartable[ ind.ff, ] Q[ rownames(Q) %in% paste(lff$rhs), ff ] <- lff$ustart - } + } res$Q <- Q res$lavpartable <- lavpartable - # res <- list( "Q"=Q, "lavpartable"=lavpartable ) return(res) - } -############################################################# +} + diff --git a/R/tamaanify.proc.lavaanmodel.R b/R/tamaanify_proc_lavaanmodel.R similarity index 58% rename from R/tamaanify.proc.lavaanmodel.R rename to R/tamaanify_proc_lavaanmodel.R index 2596e8f..e609c33 100644 --- a/R/tamaanify.proc.lavaanmodel.R +++ b/R/tamaanify_proc_lavaanmodel.R @@ -1,9 +1,9 @@ -## File Name: tamaanify.proc.lavaanmodel.R -## File Version: 9.08 +## File Name: tamaanify_proc_lavaanmodel.R +## File Version: 9.14 -############################################################ -# process lavaan model -tamaanify.proc.lavaanmodel <- function(res, resp ) + +#--- process lavaan model +tamaanify_proc_lavaanmodel <- function(res, resp ) { tam1 <- res$tammodel.dfr ind1 <- which( paste(tam1$syn)=="LAVAANMODEL:" ) @@ -11,9 +11,8 @@ tamaanify.proc.lavaanmodel <- function(res, resp ) lavmodel <- paste( tam1[ which( tam1$part_begin==index1 )[-1], "syn" ] ) lavmodel <- paste0( lavmodel, collapse="\n") res$LAVAANMODEL <- lavmodel - # process lavaan model + #** process lavaan model lavres <- lavaanify.IRT( lavmodel=res$LAVAANMODEL, data=resp ) res$lavpartable <- lavres$lavpartable return(res) } -########################################################## diff --git a/R/tamaanify.variance.fixed.R b/R/tamaanify_variance_fixed.R similarity index 74% rename from R/tamaanify.variance.fixed.R rename to R/tamaanify_variance_fixed.R index 35a04af..76550b2 100644 --- a/R/tamaanify.variance.fixed.R +++ b/R/tamaanify_variance_fixed.R @@ -1,12 +1,10 @@ -## File Name: tamaanify.variance.fixed.R -## File Version: 9.07 +## File Name: tamaanify_variance_fixed.R +## File Version: 9.202 - -########################################################## -# variance constraints -tamaanify.variance.fixed <- function( res ) +#--- variance constraints +tamaanify_variance_fixed <- function( res ) { lavpartable <- res$lavpartable Q <- res$Q @@ -29,4 +27,3 @@ tamaanify.variance.fixed <- function( res ) res$variance.fixed <- variance.fixed return(res) } -########################################################## diff --git a/README.md b/README.md index 2b91982..12011de 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ #### Test Analysis Modules -If you use `TAM` and have suggestions for improvement or have found bugs, please email me at robitzsch@leibniz-ipn.de. +If you use `TAM` and have suggestions for improvement or have found bugs, please email me at robitzsch@ipn.uni-kiel.de. #### Manual @@ -22,9 +22,9 @@ The CRAN version can be installed from within R using: utils::install.packages("TAM") ``` -#### GitHub version `TAM` 3.4-5 (2019-10-24) +#### GitHub version `TAM` 3.4-15 (2020-02-14) -[![](https://img.shields.io/badge/github%20version-3.4--5-orange.svg)](https://github.com/alexanderrobitzsch/TAM)   +[![](https://img.shields.io/badge/github%20version-3.4--15-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 new file mode 100644 index 0000000..fd313f8 --- /dev/null +++ b/docs/404.html @@ -0,0 +1,135 @@ + + + + + + + + +Page not found (404) • TAM + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + +
+ +
+
+ + +Content not found. Please use links in the navbar. + +
+ +
+ + + +
+ + +
+

Site built with pkgdown 1.4.1.

+
+ +
+
+ + + + + + + + diff --git a/docs/authors.html b/docs/authors.html index 37f028e..cdf4325 100644 --- a/docs/authors.html +++ b/docs/authors.html @@ -8,21 +8,25 @@ Citation and Authors • TAM + + - + + - - + + + @@ -30,10 +34,12 @@ + + @@ -44,6 +50,7 @@ + @@ -60,7 +67,7 @@ TAM - 3.4.5 + 3.4.15 @@ -68,7 +75,7 @@ -