Skip to content

Commit 65d709b

Browse files
4.3-2
1 parent b74dcfb commit 65d709b

18 files changed

+107
-64
lines changed

DESCRIPTION

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
Package: TAM
22
Type: Package
33
Title: Test Analysis Modules
4-
Version: 4.2-11
5-
Date: 2023-08-28 17:23:17.934842
4+
Version: 4.3-2
5+
Date: 2024-02-20 00:16:18
66
Author:
77
Alexander Robitzsch [aut,cre] (<https://orcid.org/0000-0002-8226-3132>),
88
Thomas Kiefer [aut],
@@ -37,4 +37,4 @@ License: GPL (>= 2)
3737
URL:
3838
http://www.edmeasurementsurveys.com/TAM/Tutorials/,
3939
https://github.com/alexanderrobitzsch/TAM,
40-
https://sites.google.com/site/alexanderrobitzsch2/software
40+
https://sites.google.com/view/alexander-robitzsch/software

NAMESPACE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,7 @@ S3method(plot, tam.pv.mcmc)
295295
S3method(predict, tam.mml)
296296
S3method(predict, tam.mml.3pl)
297297
S3method(predict, tamaan)
298+
S3method(print, designMatrices)
298299
S3method(print, IRT.threshold)
299300
S3method(print, tam)
300301
S3method(print, tam_linking_2studies)

R/IRT.itemfit.R

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
## File Name: IRT.itemfit.R
2-
## File Version: 9.08
2+
## File Version: 9.091
33

44
###########################################################################
5-
IRT.itemfit.rmsea.default <- function( object )
5+
IRT_itemfit_rmsea_default <- function(object)
66
{
77
mod1 <- object
8-
probs <- IRT.irfprob( mod1 )
9-
n.ik <- IRT.expectedCounts( mod1 )
10-
pi.k <- attr( probs, "prob.theta")
11-
if ( is.vector( pi.k) ){
8+
probs <- IRT.irfprob(mod1)
9+
n.ik <- IRT.expectedCounts(mod1)
10+
pi.k <- attr(probs, "prob.theta")
11+
if ( is.vector(pi.k) ){
1212
pi.k <- matrix( pi.k, ncol=1 )
1313
}
1414
n.ik <- aperm( n.ik, c(3,1,2,4))
@@ -17,7 +17,7 @@ IRT.itemfit.rmsea.default <- function( object )
1717
return(res)
1818
}
1919
###########################################################################
20-
IRT.itemfit.tam.default <- function( object, method="RMSD", ... )
20+
IRT.itemfit.tam.default <- function(object, method="RMSD", ... )
2121
{
2222
res <- NULL
2323
if ( method %in% c("RMSD","rmsea") ){

R/IRT.modelfit.tam.R renamed to R/IRT_modelfit_TAM.R

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
## File Name: IRT.modelfit.tam.R
2-
## File Version: 9.06
1+
## File Name: IRT_modelfit_TAM.R
2+
## File Version: 9.122
33

44
###########################################################
55
# general model fit function for TAM objects
6-
IRT.modelfit.TAM <- function( object, mod )
6+
IRT_modelfit_TAM <- function( object, mod )
77
{
88
res <- tam.modelfit( object )
99
res$IRT.IC <- IRT.IC(object)
@@ -18,7 +18,7 @@ IRT.modelfit.TAM <- function( object, mod )
1818
IRT.modelfit.tam.mml <- function( object, ... )
1919
{
2020
cl <- paste(match.call())[2]
21-
res <- IRT.modelfit.TAM( object, mod=cl )
21+
res <- IRT_modelfit_TAM( object, mod=cl )
2222
return(res)
2323
}
2424
IRT.modelfit.tam.mml.3pl <- IRT.modelfit.tam.mml
@@ -34,9 +34,11 @@ summary.IRT.modelfit.TAM.helper <- function( object, ... )
3434
print(obji)
3535
cat("\nFit Statistics\n")
3636
obji <- object$statlist
37-
for (vv in seq(1,ncol(obji))){ obji[,vv] <- round( obji[,vv], 3 ) }
37+
for (vv in seq(1,ncol(obji))){
38+
obji[,vv] <- round( obji[,vv], 3 )
39+
}
3840
print(obji)
39-
}
41+
}
4042
#################################################################
4143

4244
summary.IRT.modelfit.tam.mml <- summary.IRT.modelfit.TAM.helper

R/RcppExports.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
## File Name: RcppExports.R
2-
## File Version: 4.002011
2+
## File Version: 4.003002
33
# Generated by using Rcpp::compileAttributes() -> do not edit by hand
44
# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393
55

R/designMatrices_aux.R

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
## File Name: designMatrices_aux.R
2-
## File Version: 9.104
2+
## File Version: 9.105
33

44
#############################################################
5-
print.designMatrices <-
6-
function( X, ... ){
7-
x <- X
5+
print.designMatrices <- function( x, ... ){
86
BB <- x$flatB
97
colnames(BB) <- paste("B_", colnames(BB), sep="")
108
out <- cbind( x$flatA, BB )

R/tam.mml.wle2.R

Lines changed: 35 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
## File Name: tam.mml.wle2.R
2-
## File Version: 0.853
2+
## File Version: 0.869
33

44
################################################################
55
tam.mml.wle2 <- function( tamobj, score.resp=NULL, WLE=TRUE, adj=.3, Msteps=20,
6-
convM=.0001, progress=TRUE, output.prob=FALSE, pid=NULL )
6+
convM=.0001, progress=TRUE, output.prob=FALSE, pid=NULL,
7+
theta_init=NULL)
78
{
89
CALL <- match.call()
10+
iweights <- NULL
911
#--- process input data
1012
res <- tam_mml_wle_proc_input_data( tamobj=tamobj, score.resp=score.resp )
1113
AXsi <- res$AXsi
@@ -37,23 +39,33 @@ tam.mml.wle2 <- function( tamobj, score.resp=NULL, WLE=TRUE, adj=.3, Msteps=20,
3739
col.index <- rep( 1:nitems, each=maxK )
3840
cResp <- resp[, col.index ]*resp.ind[, col.index ]
3941
cResp <- 1 * t( t(cResp)==rep(0:(maxK-1), nitems) )
40-
cB <- t( matrix( aperm( B, c(2,1,3) ), nrow=dim(B)[3], byrow=TRUE ) )
42+
if (!is.null(iweights)){
43+
B1 <- B*iweights
44+
} else {
45+
B1 <- B
46+
iweights <- rep(1, nitems)
47+
}
48+
49+
cB <- t( matrix( aperm( B1, c(2,1,3) ), nrow=dim(B)[3], byrow=TRUE ) )
4150
cB[is.na(cB)] <- 0
4251
#Compute person sufficient statistics (total score on each dimension)
4352
PersonScores <- cResp %*% cB
4453

4554
#Compute possible maximum score for each item on each dimension
46-
maxBi <- apply(B, 3, tam_rowMaxs, na.rm=TRUE)
55+
maxBi <- apply(B1, 3, tam_rowMaxs, na.rm=TRUE)
56+
4757

4858
#Compute possible maximum score for each person on each dimension
4959
PersonMax <- resp.ind %*% maxBi
5060
PersonMax[ PersonMax==0 ] <- 2 * adj
5161

5262
#Adjust perfect scores for each person on each dimension
53-
PersonScores[PersonScores==PersonMax] <- PersonScores[PersonScores==PersonMax] - adj
63+
ind_max <- which(PersonScores==PersonMax)
64+
PersonScores[ind_max] <- PersonScores[ind_max] - adj
5465

5566
#Adjust zero scores for each person on each dimension
56-
PersonScores[PersonScores==0] <- PersonScores[PersonScores==0] + adj
67+
ind0 <- which(PersonScores==0)
68+
PersonScores[ind0] <- PersonScores[ind0] + adj
5769

5870
#Calculate Axsi. Only need to do this once.
5971
# for (i in 1:nitems) {
@@ -63,7 +75,12 @@ tam.mml.wle2 <- function( tamobj, score.resp=NULL, WLE=TRUE, adj=.3, Msteps=20,
6375
# }
6476

6577
#Initialise theta (WLE) values for all students
66-
theta <- log((PersonScores+.5)/(PersonMax-PersonScores+1)) #log of odds ratio of raw score
78+
if (is.null(theta_init)){
79+
theta <- log((PersonScores+.5)/(PersonMax-PersonScores+1))
80+
#log of odds ratio of raw score
81+
} else {
82+
theta <- as.matrix( theta_init )
83+
}
6784

6885
######################################
6986
#Compute WLE
@@ -92,12 +109,13 @@ tam.mml.wle2 <- function( tamobj, score.resp=NULL, WLE=TRUE, adj=.3, Msteps=20,
92109
xsi=xsi, theta=theta, nnodes=nstud, maxK=maxK, recalc=FALSE,
93110
use_rcpp=TRUE, maxcat=max(maxK), avoid_outer=TRUE )
94111
rprobsWLE <- resWLE$rprobs
112+
95113
rprobsWLEL <- matrix(rprobsWLE, nrow=nitems*maxK, ncol=nstud )
96114
rprobsWLEL[is.na(rprobsWLEL)] <- 0
97115

98116
resB <- tam_rcpp_wle_suffstat( RPROBS=rprobsWLEL, CBL=BL, CBB=BBL,
99-
CBBB=BBBL, cndim=ndim, cnitems=nitems, cmaxK=maxK, cnstud=nstud,
100-
resp_ind=resp.ind )
117+
CBBB=BBBL, cndim=ndim, cnitems=nitems, cmaxK=maxK,
118+
cnstud=nstud, resp_ind=resp.ind )
101119
B_bari <- array(resB$B_bari, dim=c(nstud, nitems,ndim))
102120
BB_bari <- array(resB$BB_bari, dim=c(nstud, nitems, ndim, ndim))
103121
BBB_bari <- array(resB$BBB_bari, dim=c(nstud, nitems, ndim))
@@ -145,7 +163,7 @@ tam.mml.wle2 <- function( tamobj, score.resp=NULL, WLE=TRUE, adj=.3, Msteps=20,
145163
# dampening the increment
146164
for ( d1 in 1:ndim){
147165
# increment[,d1] <- ifelse( abs(increment[,d1]) > 3, sign( increment[,d1] )*3, increment[,d1] )
148-
ci <- ceiling( abs(increment[,d1]) / ( abs( old_increment[,d1]) + 10^(-10) ) )
166+
ci <- ceiling( abs(increment[,d1]) / ( abs( old_increment[,d1]) + 1e-10 ) )
149167
increment[,d1] <- ifelse( abs( increment[,d1]) > abs(old_increment[,d1]),
150168
increment[,d1]/(2*ci),
151169
increment[,d1] )
@@ -165,15 +183,16 @@ tam.mml.wle2 <- function( tamobj, score.resp=NULL, WLE=TRUE, adj=.3, Msteps=20,
165183
Miter <- Miter + 1
166184

167185
if (progress){
168-
cat( paste( "Iteration in WLE/MLE estimation ", Miter,
169-
" | Maximal change ", round( max(abs(increment)), 4), "\n" ) )
170-
utils::flush.console()
171-
}
186+
cat( paste( "Iteration in WLE/MLE estimation ", Miter,
187+
" | Maximal change ", round( max(abs(increment)), 4), "\n" ))
188+
utils::flush.console()
189+
}
172190
} # end of Newton-Raphson
173191

174192
res <- tam_mml_wle_postproc( ndim=ndim, err_inv=err_inv, theta=theta, pid=pid,
175193
resp.ind=resp.ind, PersonScores=PersonScores, PersonMax=PersonMax,
176-
adj=adj, WLE=WLE, rprobsWLE=rprobsWLE, output.prob=output.prob, progress=progress,
177-
pweights=pweights, CALL=CALL, B=B, score.resp=score.resp )
194+
adj=adj, WLE=WLE, rprobsWLE=rprobsWLE, output.prob=output.prob,
195+
progress=progress, pweights=pweights, CALL=CALL, B=B,
196+
score.resp=score.resp )
178197
return(res)
179198
}

R/tam_rbind_twomatrices.R

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
## File Name: tam_rbind_twomatrices.R
2-
## File Version: 9.06
2+
## File Version: 9.071
33

44
#########################################
55
# bind two matrices
@@ -13,4 +13,5 @@ tam_rbind_twomatrices <- function(X1, X2){
1313
}
1414
#########################################
1515

16-
rbind.twomatrices <- tam_rbind_twomatrices
16+
# rbind.twomatrices <- tam_rbind_twomatrices
17+
rbind_twomatrices <- tam_rbind_twomatrices

R/tampv2datalist.R

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,22 @@
11
## File Name: tampv2datalist.R
2-
## File Version: 9.13
2+
## File Version: 9.146
33

44

5-
##################################################################
5+
##*** converts a pv object into a list of datasets
66
tampv2datalist <- function( tam.pv.object, pvnames=NULL, Y=NULL,
77
Y.pid="pid", as_mids=FALSE, stringsAsFactors=FALSE )
88
{
99
pv <- tam.pv.object$pv
1010
ndim <- tam.pv.object$ndim
1111
nplausible <- tam.pv.object$nplausible
12-
Y00 <- data.frame( "pid"=tam.pv.object$pid, "pweights"=tam.pv.object$pweights,
12+
Y00 <- data.frame( pid=tam.pv.object$pid, pweights=tam.pv.object$pweights,
1313
stringsAsFactors=stringsAsFactors )
14+
1415
if ( ! is.null(Y) ){
1516
Y <- as.data.frame(Y)
1617
if( sum( colnames(Y) %in% Y.pid )==0 ){
17-
Y[, Y.pid] <- seq( 1, nrow(Y) )
18+
Y[, Y.pid] <- pv$pid
19+
1820
}
1921
}
2022
if ( is.null(pvnames) ){
@@ -39,4 +41,4 @@ tampv2datalist <- function( tam.pv.object, pvnames=NULL, Y=NULL,
3941

4042
return(datalist)
4143
}
42-
##################################################################
44+

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ a minimal runnable code necessary to reproduce the issue, which can be run on th
77
all necessary information on the used librarys, the R version, and the OS it is run on, perhaps a ``sessionInfo()``.
88

99

10-
#### CRAN version `TAM` 4.1-4 (2022-08-28)
10+
#### CRAN version `TAM` 4.2-21 (2024-02-19)
1111

1212

1313
[![CRAN_Status_Badge](http://www.r-pkg.org/badges/version-last-release/TAM)](https://cran.r-project.org/package=TAM)
@@ -21,9 +21,9 @@ The CRAN version can be installed from within R using:
2121
utils::install.packages("TAM")
2222
```
2323

24-
#### GitHub version `TAM` 4.2-11 (2023-08-28)
24+
#### GitHub version `TAM` 4.3-2 (2024-02-20)
2525

26-
[![](https://img.shields.io/badge/github%20version-4.2--11-orange.svg)](https://github.com/alexanderrobitzsch/TAM)&#160;&#160;
26+
[![](https://img.shields.io/badge/github%20version-4.3--2-orange.svg)](https://github.com/alexanderrobitzsch/TAM)&#160;&#160;
2727

2828
The version hosted [here](https://github.com/alexanderrobitzsch/TAM) is the development version of `TAM`.
2929
The GitHub version can be installed using `devtools` as

inst/CITATION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ citHeader( paste0( "To cite the '", pkg , "' package in publications use:") )
2626
bibentry(key = paste0(pkg, "_", meta$Version),
2727
bibtype = "Manual",
2828
title = paste0( pkg , ": " , pkg_title ) ,
29-
author = personList( person_list1 ),
29+
author = c( person_list1 ),
3030
year = year,
3131
note = vers,
3232
url = paste0( "https://CRAN.R-project.org/package=", pkg) ,

inst/NEWS

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,22 +42,37 @@ http://www.edmeasurementsurveys.com/TAM/Tutorials/
4242

4343

4444
-------------------------------------------------------------
45-
VERSIONS TAM 4.2 | 2023-08-28 | Last: TAM 4.2-11
45+
VERSIONS TAM 4.3 | 2024-02-20 | Last: TAM 4.3-2
46+
-------------------------------------------------------------
47+
48+
xxx * ...
49+
50+
51+
DATA * included/modified datasets: ---
52+
EXAMP * included/modified examples: ---
53+
54+
55+
56+
57+
-------------------------------------------------------------
58+
VERSIONS TAM 4.2 | 2024-02-19 | Last: TAM 4.2-21
4659
-------------------------------------------------------------
4760

4861
NOTE * included output values 'M_post' and 'SD_post' in
4962
tam.latreg()
5063
FIXED * fixed a bug in tam.fa() due to changes in the GPArotation
5164
package (thanks to @StegmannK, @thkiefer, @bernaard;
52-
https://github.com/alexanderrobitzsch/TAM/issues/22)
53-
54-
65+
https://github.com/alexanderrobitzsch/TAM/issues/22;
66+
https://github.com/alexanderrobitzsch/TAM/issues/23)
67+
NOTE * included argument 'theta_init' in tam.mml.wle2() to
68+
provide initial theta estimates (which is also available
69+
in tam.wle())
70+
NOTE * fixed a typo in ?tam.mml (thanks to Nan Wang)
71+
NOTE * minor changes in code due to CRAN requests
5572

5673
DATA * included/modified datasets: ---
5774
EXAMP * included/modified examples: ---
5875

59-
60-
6176
-------------------------------------------------------------
6277
VERSIONS TAM 4.1 | 2022-08-28 | Last: TAM 4.1-4
6378
-------------------------------------------------------------

man/designMatrices.Rd

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
%% File Name: designMatrices.Rd
2-
%% File Version: 2.222
2+
%% File Version: 2.228
33

44
\name{designMatrices}
55

@@ -23,7 +23,7 @@ Generate design matrices, and display them at console.
2323
designMatrices(modeltype=c("PCM", "RSM"), maxKi=NULL, resp=resp,
2424
ndim=1, A=NULL, B=NULL, Q=NULL, R=NULL, constraint="cases",...)
2525

26-
print.designMatrices(X, ...)
26+
\method{print}{designMatrices}(x, \dots)
2727

2828
designMatrices.mfr(resp, formulaA=~ item + item:step, facets=NULL,
2929
constraint=c("cases", "items"), ndim=1, Q=NULL, A=NULL, B=NULL,
@@ -73,6 +73,10 @@ rownames.design(X)
7373
}
7474
\item{R}{
7575
This argument is not used
76+
}
77+
\item{x}{
78+
Object generated by \code{designMatrices}. This argument is used in
79+
\code{print.designMatrices} and \code{rownames.design}.
7680
}
7781
\item{X}{
7882
Object generated by \code{designMatrices}. This argument is used in
@@ -135,8 +139,8 @@ items with differing number of response options.
135139

136140
\seealso{
137141
See \code{\link{data.sim.mfr}} for some examples for creating design matrices.
138-
%% ~~objects to See Also as \code{\link{help}}, ~~~
139142
}
143+
%% ~~objects to See Also as \code{\link{help}}, ~~~
140144

141145

142146
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

0 commit comments

Comments
 (0)