standardized_regression function

Standardized Regression

Standardized Regression

This function standardizes all variables for a regression analysis (i.e., dependent variable and all independent variables) and then conducts a regression with the standardized variables.

standardized_regression( data = NULL, formula = NULL, reverse_code_vars = NULL, sigfigs = NULL, round_digits_after_decimal = NULL, round_p = 3, pretty_round_p_value = TRUE, return_table_upper_half = FALSE, round_r_squared = 3, round_f_stat = 2, prettify_reg_table_col_names = TRUE )

Arguments

  • data: a data object (a data frame or a data.table)
  • formula: a formula object for the regression equation
  • reverse_code_vars: names of binary variables to reverse code
  • sigfigs: number of significant digits to round to
  • round_digits_after_decimal: round to nth digit after decimal (alternative to sigfigs)
  • round_p: number of decimal places to which to round p-values (default = 3)
  • pretty_round_p_value: logical. Should the p-values be rounded in a pretty format (i.e., lower threshold: "<.001"). By default, pretty_round_p_value = TRUE.
  • return_table_upper_half: logical. Should only the upper part of the table be returned? By default, return_table_upper_half = FALSE.
  • round_r_squared: number of digits after the decimal both r-squared and adjusted r-squared values should be rounded to (default 3)
  • round_f_stat: number of digits after the decimal the f statistic of the regression model should be rounded to (default 2)
  • prettify_reg_table_col_names: logical. Should the column names of the regression table be made pretty (e.g., change "std_beta" to "Std. Beta")? (Default = TRUE)

Returns

the output will be a data.table showing multiple regression results.

Examples

standardized_regression(data = mtcars, formula = mpg ~ gear * cyl) standardized_regression( data = mtcars, formula = mpg ~ gear + gear:am + disp * cyl, round_digits_after_decimal = 3)