Skip to contents

This function allows you to bootstrap samples across various sample sizes when the data (optionally) has repeated measures items.

Usage

calculate_correction(
  proportion_summary,
  pilot_sample_size,
  proportion_variability,
  power_levels = c(80, 85, 90, 95)
)

Arguments

proportion_summary

Summary from proportion of items below the cutoff score.

pilot_sample_size

Number of participants from the pilot sample, note: not the number of items, but the number of people per item.

proportion_variability

Proportion of variability found between items standard errors.

power_levels

Power levels to calculate the required sample size.

Value

corrected_summary

The corrected sample size for the number of people needed for accurately measured items.

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.4524786 0.4441135 0.4308804 0.4622599 0.3544826 0.4838171 0.3879772
#>  [8] 0.4103913 0.3871284 0.4097496 0.4134260 0.3346247 0.4464774 0.3589092
#> [15] 0.4707217 0.4672146 0.3282730 0.3346247 0.3727564 0.3670652 0.3670652
#> [22] 0.4071725 0.3973597 0.3776660 0.4558104 0.4639646 0.3111946 0.5083513
#> [29] 0.3561490 0.4672146
cutoff$sd_items
#> [1] 0.05297054
cutoff$cutoff
#>       40% 
#> 0.3876377 
cutoff$prop_var
#> [1] 0.01765685

# 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.457
#>  2          25         0.693
#>  3          30         0.873
#>  4          35         0.979
#>  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    

# step 6 final calculation
corrected_summary <- calculate_correction(proportion_summary = proportion_summary,
  pilot_sample_size = 20,
  proportion_variability = cutoff$prop_var,
  power_levels = c(80, 85, 90, 95))

corrected_summary
#> # A tibble: 4 × 3
#>   percent_below sample_size corrected_sample_size
#>           <dbl>       <dbl>                 <dbl>
#> 1          87.3          30                  25.2
#> 2          87.3          30                  25.2
#> 3          97.9          35                  33.8
#> 4          97.9          35                  33.8