-
Notifications
You must be signed in to change notification settings - Fork 20
Closed
Description
Hi,
I'm updating my R textbook, and thinking of using interactions within it.
I've been trying to specify robust standard errors. The help file implies (to me at least) that you either set robust = TRUE to get HC3 or set it to the estimator you want (e.g., robust = "HC4"). Have I interpretted that correctly?
Look at the (reprex) code below. I use the following:
default (robust = FALSE)
robust = TRUE
robust = "HC3"
robust = "HC4"
All yield the same standard errors except for robust = TRUE
This makes me think I have misinterpretted the help files. If so, how do I change the estimator?
Thanks for the great package,,
andy
PS the link to this page from https://interactions.jacob-long.com/ is broken
## Load data and centre variables
vids_tib <- readr::read_csv("http://milton-the-cat.rocks/home/data/r_data/video_games.csv") %>%
dplyr::mutate(
caunts_cent = caunts - mean(caunts, na.rm = TRUE),
vid_game_cent = vid_game - mean(vid_game, na.rm = TRUE)
)
## Fitting the main model
aggress_lm <- lm(aggress ~ caunts_cent + vid_game_cent + caunts_cent:vid_game_cent, data = vids_tib)
## Simple slopes non-robust SEs
interactions::sim_slopes(
aggress_lm,
pred = vid_game_cent,
modx = caunts_cent,
confint = TRUE
)
## Simple slopes robust SEs
interactions::sim_slopes(
aggress_lm,
pred = vid_game_cent,
modx = caunts_cent,
robust = TRUE,
confint = TRUE
)
## Simple slopes HC3 specified
interactions::sim_slopes(
aggress_lm,
pred = vid_game_cent,
modx = caunts_cent,
robust = "HC3",
confint = TRUE
)
## Simple slopes HC4 specified
interactions::sim_slopes(
aggress_lm,
pred = vid_game_cent,
modx = caunts_cent,
robust = "HC3",
confint = TRUE
)
Metadata
Metadata
Assignees
Labels
No labels