calculate_correction: Bootstrap Sample from a Population Grouped by Items

View source: R/calculate_correction.R

calculate_correctionR Documentation

Bootstrap Sample from a Population Grouped by Items

Description

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
cutoff$sd_items
cutoff$cutoff
cutoff$prop_var

# 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

# 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


SemanticPriming/semanticprimeR documentation built on Feb. 26, 2024, 8:30 p.m.