sim_effect: Simulate Variable Effect

View source: R/votepath.r

sim_effectR Documentation

Simulate Variable Effect

Description

Simulate a variable's effect in a vote path analysis.

Usage

sim_effect(
  obj,
  data,
  varname,
  diffchange = c("unit", "sd"),
  vals = NULL,
  R = 100,
  ...
)

Arguments

obj

An object of class votepath

data

A data frame that contains all of the variables form the analysis.

varname

The name of a variable whose effect will be evaluated.

diffchange

The amount to change varname. Changes will be x-.5*diffchange and x+.5*diffchange. For categorical variables, the first and last categories will be chosen. The diffchange parameter defines the change so long as vals=NULL. If vals is not NULL, then those values will be used for everyone.

vals

A vector of length 2 giving the values that will be used to evaluate the effect size. This will override diffchange. The values must be of the same class as the variable being changed. For example, if the variable being changed is a factor, the vals vector also has to be a factor with the same levels as the variable in varname.

R

Number of simulations to be conducted.

...

Other arguments to be passed down.


davidaarmstrong/votepath documentation built on May 2, 2024, 4:13 a.m.