med_simple: Simple Mediation Model

Description Usage Arguments Author(s) Examples

View source: R/med.R

Description

Estimates the indirect effect in a simple mediation model, that is the product of α and β from M_i = δ_M + α X_i + ε_{M_i} and Y_i = δ_Y + τ^{\prime} X_i + β M_i + ε_{Y_i}.

Usage

1
med_simple(data, scale = FALSE, minimal = TRUE, s2 = FALSE, s2_est = "both")

Arguments

data

A matrix with variables X, M, and Y.

scale

Logical. If TRUE, scales the data before fitting the model.

minimal

Logical. If TRUE, returns the indirect effect of X on Y through M. If FALSE, returns all the regression coefficients estimated.

s2

Logical. If TRUE, estimates residual variance.

s2_est

String. Residual variance estimator. If "both", returns both OLS and ML estimates as a vector. If "ols", returns OLS estimate. If "ml", returns ML estimate. Ignored if s2 = FALSE.

Author(s)

Ivan Jacob Agaloos Pesigan

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
Sigma <- matrix(
  data = c(
    225, 112.50, 56.25,
    112.5, 225, 112.5,
    56.25, 112.50, 225
  ),
  ncol = 3
)
mu <- c(100, 100, 100)
data <- gendat_mvn(
  n = 100,
  Sigma = Sigma,
  mu = mu
)
med_simple(data = data, minimal = FALSE, s2 = TRUE)

jeksterslabds/jeksterslabRds documentation built on July 16, 2020, 3:41 p.m.