cjpwr_data: Simple Power Analysis and Sample Size Diagnostic for Conjoint...

Description Usage Arguments Details Value Examples

Description

Johnson's rule-of-thumb calculation for determining power of conjoint designs.

Usage

1

Arguments

data

A tidy, long-format conjoint dataframe.

formula

A formula like those passed to cj/amce/mm functions in 'cregg'. RHS variables are used to determine max feature levels.

id

A variable, within data, containing respondent IDs. Must be numeric.

Details

cjpwr_data finds and calculates n, t, a, and c from a tidy conjoint data input (with a formula and id, similar to other tidy conjoint analyses) and divides the product of n, t, and a by c, to give Johnson's rule-of-thumb estimation of conjoint design power. It returns a dataframe containing the inputs and result of this calculation, whether (yes/no) this exceeds the minimal minimum threshold (500) and ideal minimum threshold (1000), and the sample sizes (rounded up) necessary for minimum and ideal power thresholds. cjpwr_data uses features of tidyeval which mean variable names can be specified without quoting ("") and without referring back to the dataframe every time (via data$).

Value

A tibble with columns n (respondents), t (tasks), a (alternatives), c (cells, i.e. largest number of levels per feature), nta_c (nta/c), min_met (whether minimum threshold met y/n), ideal_met (whether ideal threshold met y/n), min_n (minimum n value to meet minimum threshold), and ideal_n (minimum n value to meet ideal threshold).

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
#load example datasets from {cregg} (Leeper 2019)
library(cregg)
data(immigration)
data(taxes)
#run cjpwr_data seamlessly on immigration dataset
#pre-specify formula
f1 <- ChosenImmigrant ~ Gender + Education + LanguageSkills +
CountryOfOrigin + Job + JobExperience + JobPlans +
ReasonForApplication + PriorEntry
cjpwr_data(immigration, f1, CaseID)
#same in taxes dataset but without pre-specified formula
power_tax <- cjpwr_data(taxes, chose_plan ~ taxrate1 + taxrate2 + taxrate3 +
taxrate4 + taxrate5 + taxrate6 + taxrev, ID, profile_no, contest_no)
## include interaction variable for a pair of features
library(tidyverse)
immigration %>% mutate(ints = interaction(Gender, PriorEntry, sep = "_"))
#specify new formula including interaction feature
f2 <- ChosenImmigrant ~ Gender + Education + LanguageSkills +
CountryOfOrigin + Job + JobExperience + JobPlans +
ReasonForApplication + PriorEntry + ints
#then just run cjpwr_data with the new formula
power_imm <- cjpwr_data(immigration, f2, CaseID)

mbarnfield/cjpwr documentation built on May 9, 2019, 2:57 p.m.