Learn R Programming

regrrr (version 0.1.3)

test_tilted_slopes: significance of regression slope (the marginal effect) under moderation testing restriction: the sig. of beta_x under the moderation of z1, with or without additional interaction terms (z2, z3, etc.)

Description

significance of regression slope (the marginal effect) under moderation testing restriction: the sig. of beta_x under the moderation of z1, with or without additional interaction terms (z2, z3, etc.)

Usage

test_tilted_slopes(
  reg.coef,
  v = NULL,
  model,
  x_var.name,
  moderator.name,
  mod.n.sd = 1,
  data,
  t.value.col = 3,
  Pr.col = 4
)

Arguments

reg.coef

a data.frame (or matrix) of regression result or a coeftest object, e.g. summary(lm_model)$coef, coeftest(lm_model, cluster.vcov(lm_model, cbind(data$group1, data$group2)))

v

a customized variance-covariance matrix

model

the model object, such as a "lm" object

x_var.name

main independent variable name in model, a string

moderator.name

moderator name in model, a string

mod.n.sd

specify the strength of the moderating effects, in the unit of s.d.s of the moderator, which can take negative values

data

data used for regression

t.value.col

col number of the t-score in reg.coef

Pr.col

col number of the Prob.(>|t|)) in reg.coef

Examples

Run this code
# NOT RUN {
data(mtcars)
m1 <- lm(mpg ~ vs + carb + hp + wt + wt * hp , data = mtcars)
test_tilted_slopes(reg.coef = summary(m1)$coef, model = m1, 
                   x_var.name = "wt", moderator.name = "hp", data = mtcars)

# }

Run the code above in your browser using DataLab