bootstrap_samples: Bootstrap Sample from a Population Grouped by Items

View source: R/bootstrap_samples.R

bootstrap_samplesR 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

bootstrap_samples(
  start = 20,
  stop = 100,
  increase = 5,
  population,
  replace = TRUE,
  nsim = 100,
  grouping_items = NULL
)

Arguments

start

Sample size for the smallest potential sample

stop

Sample size for the largest potential sample

increase

Number to increase the sample size with for each potential sample

population

The population data set or the pilot dataset

replace

A TRUE/FALSE value to bootstrap with replacement

nsim

The number of simulations/samples you want to return

grouping_items

The names of columns to group your data by for the simulation, usually this column is the item column

Value

  • "samples"The bootstrapped samples for each tested sample size.

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 3 simulate bootstrapped samples
samples <- bootstrap_samples(start = 20, stop = 100,
  increase = 5, population = pops,
  replace = TRUE, grouping_items = NULL)

# notice just 20 items
samples[[1]]

samples <- bootstrap_samples(start = 20, stop = 100,
  increase = 5, population = pops,
  replace = TRUE, grouping_items = "item")

# notice 20 rows per item
samples[[1]]


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