Skip to contents

Print the summary generated by summary() on the output of std_selected() or std_selected_boot().

Usage

# S3 method for summary.std_selected
print(
  x,
  ...,
  est_digits = 4,
  t_digits = 4,
  pvalue_less_than = 0.001,
  default_style = FALSE
)

Arguments

x

The output of summary().

...

Arguments to be passed to summary().

est_digits

The number of digits after the decimal to be displayed for the coefficient estimates, their standard errors, and bootstrap confidence intervals (if present). Note that the values will be rounded to this number of digits before printing. If all digits at this position are zero for all values, the values may be displayed with fewer digits. Note that the coefficient table is printed by stats::printCoefmat(). If some numbers are vary large, the number of digits after the decimal may be smaller than est_digits due to a limit on the column width. This value also determines the number of digits for displayed R-squared if default_style is FALSE. Default if 4.

t_digits

The number of digits after the decimal to be displayed for the t statistic (in the column "t value"). This value also determines the number of digits for the F statistic for the R-squared if default_style is FALSE. Default is 4.

pvalue_less_than

If a p-value is less than this value, it will be displayed with "<(this value)". For example, if pvalue_less_than is .001, the default, p-values less than .001 will be displayed as <.001. This value also determines the printout of the p-value of the F statistic if default_style is FALSE. (This argument does what eps.Pvalue does in stats::printCoefmat().)

default_style

Logical. If FALSE, the default, R-squared and F statistic will be displayed in a more readable style. If TRUE, then the default style in the printout of the summary of lm() output will be used.

Value

x is returned invisibly.

Examples


# Load a sample data set

dat <- test_x_1_w_1_v_1_cat1_n_500

# Do a moderated regression by lm
lm_raw <- lm(dv ~ iv*mod + v1 + cat1, dat)

# 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)
#> 
#> Call to std_selected():
#> std_selected(lm_out = lm_raw, to_scale = ~., to_center = ~.)
#> 
#> Selected variable(s) are centered by mean and/or scaled by SD
#> - Variable(s) centered: dv iv mod v1 cat1
#> - Variable(s) scaled: dv iv mod v1 cat1
#> 
#>      centered_by   scaled_by                            Note
#> dv    6565.02965 1094.244465 Standardized (mean = 0, SD = 1)
#> iv      15.01576    2.039154 Standardized (mean = 0, SD = 1)
#> mod    100.39502    5.040823 Standardized (mean = 0, SD = 1)
#> v1      10.13884    2.938932 Standardized (mean = 0, SD = 1)
#> cat1          NA          NA Nonnumeric                     
#> 
#> Note:
#> - Categorical variables will not be centered or scaled even if
#>   requested.
#> 
#> Call:
#> lm(formula = dv ~ iv * mod + v1 + cat1, data = dat_mod)
#> 
#> Residuals:
#>      Min       1Q   Median       3Q      Max 
#> -1.96117 -0.39474 -0.02285  0.37579  2.11040 
#> 
#> Coefficients:
#>             Estimate Std. Error t value Pr(>|t|)    
#> (Intercept)   0.0646     0.0483  1.3385  0.18136    
#> iv            0.7374     0.0274 26.9480  < 0.001 ***
#> mod           0.2599     0.0274  9.4962  < 0.001 ***
#> v1           -0.0343     0.0273 -1.2542  0.21037    
#> cat1gp2      -0.1450     0.0656 -2.2089  0.02764 *  
#> cat1gp3      -0.0394     0.0688 -0.5734  0.56664    
#> iv:mod        0.0321     0.0255  1.2608  0.20799    
#> ---
#> Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
#> 
#> Residual standard error: 0.6077 on 493 degrees of freedom
#> 
#> R-squared                : 0.6352
#> Adjusted R-squared       : 0.6307
#> ANOVA test of R-squared  : F(6, 493) = 143.047, p < 0.001
#> 
#> = Test the highest order term =
#> The highest order term             : iv:mod
#> R-squared increase adding this term: 0.0012
#> F test of R-squared increase       : F(1, 493) = 1.5895, p = 0.208
#> 
#> Note:
#> - Estimates and their statistics are based on the data after
#>   mean-centering, scaling, or standardization.
#> - One or more variables are scaled by SD or standardized. OLS standard
#>   errors and confidence intervals may be biased for their coefficients.
#>   Please use `std_selected_boot()`.
#> 

# With bootstrapping
# nboot = 100 just for illustration. nboot >= 2000 should be used in read
# research.
lm_std_boot <- std_selected_boot(lm_raw, to_scale = ~ .,
                                         to_center = ~ .,
                                         nboot = 100)
summary(lm_std_boot)
#> 
#> Call to std_selected_boot():
#> std_selected_boot(lm_out = lm_raw, to_scale = ~., to_center = ~., 
#>     nboot = 100)
#> 
#> Selected variable(s) are centered by mean and/or scaled by SD
#> - Variable(s) centered: dv iv mod v1 cat1
#> - Variable(s) scaled: dv iv mod v1 cat1
#> 
#>      centered_by   scaled_by                            Note
#> dv    6565.02965 1094.244465 Standardized (mean = 0, SD = 1)
#> iv      15.01576    2.039154 Standardized (mean = 0, SD = 1)
#> mod    100.39502    5.040823 Standardized (mean = 0, SD = 1)
#> v1      10.13884    2.938932 Standardized (mean = 0, SD = 1)
#> cat1          NA          NA Nonnumeric                     
#> 
#> Note:
#> - Categorical variables will not be centered or scaled even if
#>   requested.
#> - Nonparametric bootstrapping 95% confidence intervals computed.
#> - The number of bootstrap samples is 100.
#> 
#> Call:
#> lm(formula = dv ~ iv * mod + v1 + cat1, data = dat_mod)
#> 
#> Residuals:
#>      Min       1Q   Median       3Q      Max 
#> -1.96117 -0.39474 -0.02285  0.37579  2.11040 
#> 
#> Coefficients:
#>             Estimate CI Lower CI Upper Std. Error t value Pr(>|t|)    
#> (Intercept)   0.0646  -0.0155   0.1478     0.0483  1.3385  0.18136    
#> iv            0.7374   0.6969   0.7777     0.0274 26.9480  < 0.001 ***
#> mod           0.2599   0.2143   0.3117     0.0274  9.4962  < 0.001 ***
#> v1           -0.0343  -0.0883   0.0217     0.0273 -1.2542  0.21037    
#> cat1gp2      -0.1450  -0.2725  -0.0274     0.0656 -2.2089  0.02764 *  
#> cat1gp3      -0.0394  -0.1774   0.0962     0.0688 -0.5734  0.56664    
#> iv:mod        0.0321  -0.0178   0.0851     0.0255  1.2608  0.20799    
#> ---
#> Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
#> 
#> Residual standard error: 0.6077 on 493 degrees of freedom
#> 
#> R-squared                : 0.6352
#> Adjusted R-squared       : 0.6307
#> ANOVA test of R-squared  : F(6, 493) = 143.047, p < 0.001
#> 
#> = Test the highest order term =
#> The highest order term             : iv:mod
#> R-squared increase adding this term: 0.0012
#> F test of R-squared increase       : F(1, 493) = 1.5895, p = 0.208
#> 
#> Note:
#> - Estimates and their statistics are based on the data after
#>   mean-centering, scaling, or standardization.
#> - [CI Lower, CI Upper] are bootstrap percentile confidence intervals.
#> - Std. Error are not bootstrap SEs.
#>