ghost_par_ests {phantSEM}R Documentation

Provide parameter estimates from sensitivity analysis function

Description

ghost_par_ests() Selects certain parameter estimates from the output of the sensitivity analysis.

Usage

ghost_par_ests(step3, parameter_label, remove_NA = FALSE)

Arguments

step3

The object returned from SA_step3.

parameter_label

The label used for the parameter in the lavaan code.

remove_NA

Remove rows for combinations of phantom variable parameters that resulted in inadmissable solutions in lavaan.

Value

A dataframe of the parameter estimates from the lavaan model.

Examples

# example code

covmatrix <- matrix(c(
  0.25, 0.95, 0.43,
  0.95, 8.87, 2.66,
  0.43, 2.66, 10.86
), nrow = 3, byrow = TRUE)
colnames(covmatrix) <- c("X", "M2", "Y2")

# lavann syntax for observed model
observed <- " M2 ~ X
             Y2 ~ M2+X "

# lavaan output
obs_output <- lavaan::sem(model = observed, sample.cov = covmatrix, sample.nobs = 200)

# lavaan syntax for phantom variable model
phantom <- " M2 ~ M1 + Y1 + a*X
               Y2 ~ M1 + Y1 + b*M2 + cp*X "

Step1 <- SA_step1(
  lavoutput = obs_output,
  mod_obs = observed,
  mod_phant = phantom
)

phantom_assignment <- list(
  "CovM1X" = 0,
  "CovY1M1" = "CovY2M2",
  "CovY1X" = 0,
  "VarM1" = 1,
  "VarY1" = 1,
  "CovM1M2" = seq(.4, .6, .1),
  "CovY1Y2" = "CovM1M2",
  "CovY1M2" = seq(.2, .4, .1),
  "CovM1Y2" = "CovY1M2"
)
Step2 <- SA_step2(
  phantom_assignment = phantom_assignment,
  step1 = Step1
)
Step3 <- SA_step3(
  step2 = Step2,
  n = 200
)

b_results <- ghost_par_ests(
  step3 = Step3,
  parameter_label = "b",
  remove_NA = TRUE
)

[Package phantSEM version 1.0.0.0 Index]