View source: R/update_stdmod.R
update.std_selected | R Documentation |
This should be used only to update the call to lm()
,
not to the call to std_selected()
or std_selected_boot()
.
## S3 method for class 'std_selected'
update(object, formula., ..., evaluate = TRUE)
object |
The output of the class |
formula. |
Changes to the formula. |
... |
Optional arguments to be changed. |
evaluate |
Whether the call will be evaluated. |
Although supported, it is not recommended to update an analysis
processed by std_selected()
or std_selected_boot()
. It is
recommended to call lm()
again and pass the output to
std_selected()
or std_selected_boot()
.
If evaluate
= TRUE
, it returns the updated fitted object,
otherwise, the updated call.
Shu Fai Cheung https://orcid.org/0000-0002-9871-9448
# Load a sample data set
dat <- test_x_1_w_1_v_1_cat1_n_500
head(dat)
# Do a moderated regression by lm
lm_raw <- lm(dv ~ iv*mod + v1 + cat1, dat)
summary(lm_raw)
# Standardize all variables except for categorical variables.
# Interaction terms are formed after standardization.
lm_std <- std_selected(lm_raw, to_scale = ~ .,
to_center = ~ .)
summary(lm_std)
# Update the model
lm_std2 <- update(lm_std, . ~ . - v1)
summary(lm_std2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.