Learn R Programming

stdmod (version 0.2.11)

update.std_selected: The 'update' Method for a 'std_selected' Class Object

Description

This should be used only to update the call to lm(), not to the call to std_selected() or std_selected_boot().

Usage

# S3 method for std_selected
update(object, formula., ..., evaluate = TRUE)

Value

If evaluate = TRUE, it returns the updated fitted object, otherwise, the updated call.

Arguments

object

The output of the class std_selected().

formula.

Changes to the formula.

...

Optional arguments to be changed.

evaluate

Whether the call will be evaluated.

Details

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().

Examples

Run this code

# 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)

Run the code above in your browser using DataLab