Skip to contents

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.

Usage

calculate_proportion(samples, cutoff, grouping_items = NULL, score)

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

Value

summary_DF

Summary of the proportion of items below the standard error cutoff score.

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.3831998 0.4039281 0.4405439 0.4604060 0.3015312 0.4638228 0.4723959
#>  [8] 0.4004931 0.3332456 0.4861232 0.3574397 0.3900067 0.3991768 0.3423987
#> [15] 0.3925289 0.3515005 0.3634629 0.4806793 0.3661679 0.5175855 0.4436689
#> [22] 0.4259664 0.4070109 0.3913539 0.3938675 0.3620119 0.3439324 0.3032716
#> [29] 0.4222434 0.4638228
cutoff$sd_items
#> [1] 0.05510047
cutoff$cutoff
#>       40% 
#> 0.3908151 
cutoff$prop_var
#> [1] 0.01836682

# step 3 simulate samples
samples <- simulate_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.529
#>  2          25         0.747
#>  3          30         0.903
#>  4          35         0.98 
#>  5          40         0.999
#>  6          45         1    
#>  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