Simulate Normal Population Scores for Multiple Items
calculate_proportion.Rd
This function allows you to create normal populations for data that would include repeated measures items. Additionally, the data can be rounded and/or truncated to ensure it matches a target scale - for example, a 1-7 type rating scale.
Arguments
- samples
The bootstrapped samples from your population
- cutoff
The cutoff score for an item to be well measured from the standard errors of your items
- grouping_items
The names of columns to group your data by for the cutoff calculation, usually this column is the item column
- score
The column of the score you wish to calculate for your cutoff score SE
Examples
# step 1 create data like what I think I'll get or use your own
pops <- simulate_population(mu = 4, mu_sigma = .2, sigma = 2,
sigma_sigma = .2, number_items = 30, number_scores = 20,
smallest_sigma = .02, min_score = 1, max_score = 7, digits = 0)
# step 2 calculate our cut off score
cutoff <- calculate_cutoff(population = pops,
grouping_items = "item",
score = "score",
minimum = 1,
maximum = 7)
cutoff$se_items
#> [1] 0.3692097 0.3118282 0.4500000 0.3871284 0.3661679 0.4381480 0.4057157
#> [8] 0.2890547 0.2562380 0.5040624 0.3618301 0.3788834 0.3524351 0.3871284
#> [15] 0.3026201 0.4236433 0.4039281 0.3872983 0.4031129 0.3234274 0.4223992
#> [22] 0.3732856 0.3900067 0.4161225 0.4945758 0.3118282 0.4328607 0.3361939
#> [29] 0.4750346 0.5160579
cutoff$sd_items
#> [1] 0.06356322
cutoff$cutoff
#> 40%
#> 0.3766443
cutoff$prop_var
#> [1] 0.02118774
# step 3 simulate bootstrapped samples
samples <- bootstrap_samples(start = 20, stop = 100,
increase = 5, population = pops,
replace = TRUE, grouping_items = "item")
# step 4 and 5
proportion_summary <- calculate_proportion(samples = samples,
cutoff = cutoff$cutoff,
grouping_items = "item",
score = "score")
proportion_summary
#> # A tibble: 17 × 2
#> sample_size percent_below
#> <dbl> <dbl>
#> 1 20 0.500
#> 2 25 0.717
#> 3 30 0.873
#> 4 35 0.954
#> 5 40 0.990
#> 6 45 0.999
#> 7 50 1
#> 8 55 1
#> 9 60 1
#> 10 65 1
#> 11 70 1
#> 12 75 1
#> 13 80 1
#> 14 85 1
#> 15 90 1
#> 16 95 1
#> 17 100 1