R/RcppExports.R
sim_RT.Rd
Simulate a cube of subjects' response times across time points according to a variant of the logNormal model
sim_RT(alphas, Q_matrix, Design_array, RT_itempars, taus, phi, G_version)
An N-by-K-by-T array
of attribute patterns of all persons across T time points
A J-by-K Q-matrix for the test
A N-by-J-by-L array indicating whether item j is administered to examinee i at l time point.
A J-by-2 matrix
of item time discrimination and time intensity parameters
A length N vector
of latent speed of each person
A scalar
of slope of increase in fluency over time due to covariates (G)
An int
of the type of covariate for increased fluency (1: G is dichotomous depending on whether all skills required for
current item are mastered; 2: G cumulates practice effect on previous items using mastered skills; 3: G is a time block effect invariant across
subjects with different attribute trajectories)
A cube
of response times of subjects on each item across time
N = dim(Design_array)[1]
J = nrow(Q_matrix)
K = ncol(Q_matrix)
L = dim(Design_array)[3]
class_0 <- sample(1:2^K, N, replace = TRUE)
Alphas_0 <- matrix(0,N,K)
mu_thetatau = c(0,0)
Sig_thetatau = rbind(c(1.8^2,.4*.5*1.8),c(.4*.5*1.8,.25))
Z = matrix(rnorm(N*2),N,2)
thetatau_true = Z%*%chol(Sig_thetatau)
thetas_true = thetatau_true[,1]
taus_true = thetatau_true[,2]
G_version = 3
phi_true = 0.8
for(i in 1:N){
Alphas_0[i,] <- inv_bijectionvector(K,(class_0[i]-1))
}
lambdas_true <- c(-2, .4, .055)
Alphas <- sim_alphas(model="HO_joint",
lambdas=lambdas_true,
thetas=thetas_true,
Q_matrix=Q_matrix,
Design_array=Design_array)
RT_itempars_true <- matrix(NA, nrow=J, ncol=2)
RT_itempars_true[,2] <- rnorm(J,3.45,.5)
RT_itempars_true[,1] <- runif(J,1.5,2)
ETAs <- ETAmat(K,J,Q_matrix)
L_sim <- sim_RT(Alphas,Q_matrix,Design_array,RT_itempars_true,taus_true,phi_true,G_version)