tmatta / lsasim

Simulate large scale assessment data
6 stars 5 forks source link

questionnaire (..., cat_prop = cat_pr1, ...) #3

Closed ylinglw closed 8 years ago

ylinglw commented 8 years ago

The first list of cat_pr1 has always to be 1.

cat_pr1

[[1]] [1] 1

[[2]] [1] 0.78 1.00

.... ....

It got error messages when the first list of cat_pr1 is not 1. However, when using the marginal distribution from empirical data (only has categorical data varaibles), the first list might not be 1.

cat_pr1 <- marginal.dist(freq[,-1]) # from PISA cat_pr1

[[1]] [1] 0.5185185 1.0000000

[[2]] [1] 0.95253 1.00000

[[3]] [1] 0.8273344 1.0000000

[[4]] [1] 0.6051122 1.0000000

[[5]] [1] 0.5852895 1.0000000

... ...

surv1 <- questionnaire(n = n_subj[I], cat_prop = cat_pr1, cor_matrix = q1) #generate questionnaire data

Error in [.data.frame(discrete_df, , c("subject", "theta", xtra_cols)) : undefined columns selected In addition: Warning message: In colnames(discrete_df)[which(colnames(discrete_df) != "theta")] <- xtra_cols : number of items to replace is not a multiple of replacement length

tmatta commented 8 years ago

I added an argument to the questionnaire function that enables to user to say if they want their first continuous variable in the dataset to be labeled "theta" (theta = FALSE for default). If theta = FALSE, then regardless of the data, the function will not try labeled the first continuous variable "theta." If theta = TRUE but all data are discrete, an error will alert the user to the problem.

ylinglw commented 8 years ago

Thanks!

On Thu, Nov 10, 2016 at 8:45 AM, Tyler Matta notifications@github.com wrote:

I added an argument to the questionnaire function that enables to user to say if they want their first continuous variable in the dataset to be labeled "theta" (theta = FALSE for default). If theta = FALSE, then regardless of the data, the function will not try labeled the first continuous variable "theta." If theta = TRUE but all data are discrete, an error will alert the user to the problem.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/tmatta/ilsasim/issues/3#issuecomment-259622480, or mute the thread https://github.com/notifications/unsubscribe-auth/AVt9_3KHVRFF-cdwgztt4-hbiJEZelmvks5q8suNgaJpZM4Ktt0v .

Yuan-Ling Linda Liaw, PhD Measurement & Statistics College of Education | University of Washington