tmatta / lsasim

Simulate large scale assessment data
6 stars 5 forks source link

rand_cum_proportions #2

Closed ylinglw closed 8 years ago

ylinglw commented 8 years ago

=== Parameters ===============================================================

n_subj <- 100 # number of students n_vars <- 20 # number of questionnaire variables n_forms <- 1 # number of test forms form_len <- 10 # number of items per form n_items <- n_forms * form_len # number of total items

=== Survey data ==============================================================

--- Generate marginal probabilities

cat_pr1 <- rand_cum_proportions(n_var = n_vars, cat_options = 2, cat_proportions = c(1.0))

Error in sample.int(x, size, replace, prob) : incorrect number of probabilities

--- Generate correlation matrix

q1 <- rand_pd_corr(n_var = n_vars)

--- Generate questionnaire data

surv1 <- questionnaire(n = n_subj, cat_prop = cat_pr1, cor_matrix = q1)

Error in questionnaire(n = n_subj, cat_prop = cat_pr1, cor_matrix = q1) : object 'cat_pr1' not found

tmatta commented 8 years ago

I rewrote the function (now called gen_proportions) so the user specifies the number of items corresponding to each cat_options rather than specifying proportions of items corresponding to each cat_options.