Ordinary least squares regression.
ols_regress(object, ...) # S3 method for lm ols_regress(object, ...)
object | An object of class "formula" (or one that can be coerced to
that class): a symbolic description of the model to be fitted or class
|
---|---|
... | Other inputs. |
ols_regress
returns an object of class "ols_regress"
.
An object of class "ols_regress"
is a list containing the following
components:
square root of rsquare, correlation between observed and predicted values of dependent variable
coefficient of determination or r-square
adjusted rsquare
root mean squared error
coefficient of variation
mean squared error
mean absolute error
akaike information criteria
bayesian information criteria
sawa bayesian information criteria
predicted rsquare
residual degrees of freedom
regression degrees of freedom
total degrees of freedom
error sum of squares
regression sum of squares
total sum of squares
regression mean square
error mean square
f statistis
p-value for f
number of predictors including intercept
betas; estimated coefficients
standardized betas
standard errors
t values
p-value of tvalues
degrees of freedom of betas
confidence intervals for coefficients
title for the model
character vector; name of the dependent variable
character vector; name of the predictor variables
character vector; name of the predictor variables including intercept
input model for ols_regress
If the model includes interaction terms, the standardized betas are computed after scaling and centering the predictors.
https://www.ssc.wisc.edu/~hemken/Stataworkshops/stdBeta/Getting
ols_regress(mpg ~ disp + hp + wt, data = mtcars)#> Model Summary #> -------------------------------------------------------------- #> R 0.909 RMSE 2.639 #> R-Squared 0.827 Coef. Var 13.135 #> Adj. R-Squared 0.808 MSE 6.964 #> Pred R-Squared 0.768 MAE 1.907 #> -------------------------------------------------------------- #> RMSE: Root Mean Square Error #> MSE: Mean Square Error #> MAE: Mean Absolute Error #> #> ANOVA #> -------------------------------------------------------------------- #> Sum of #> Squares DF Mean Square F Sig. #> -------------------------------------------------------------------- #> Regression 931.057 3 310.352 44.566 0.0000 #> Residual 194.991 28 6.964 #> Total 1126.047 31 #> -------------------------------------------------------------------- #> #> Parameter Estimates #> ---------------------------------------------------------------------------------------- #> model Beta Std. Error Std. Beta t Sig lower upper #> ---------------------------------------------------------------------------------------- #> (Intercept) 37.106 2.111 17.579 0.000 32.782 41.429 #> disp -0.001 0.010 -0.019 -0.091 0.929 -0.022 0.020 #> hp -0.031 0.011 -0.354 -2.724 0.011 -0.055 -0.008 #> wt -3.801 1.066 -0.617 -3.565 0.001 -5.985 -1.617 #> ----------------------------------------------------------------------------------------# if model includes interaction terms set iterm to TRUE ols_regress(mpg ~ disp * wt, data = mtcars, iterm = TRUE)#> Model Summary #> -------------------------------------------------------------- #> R 0.922 RMSE 2.455 #> R-Squared 0.850 Coef. Var 12.219 #> Adj. R-Squared 0.834 MSE 6.027 #> Pred R-Squared 0.801 MAE 1.897 #> -------------------------------------------------------------- #> RMSE: Root Mean Square Error #> MSE: Mean Square Error #> MAE: Mean Absolute Error #> #> ANOVA #> -------------------------------------------------------------------- #> Sum of #> Squares DF Mean Square F Sig. #> -------------------------------------------------------------------- #> Regression 957.299 3 319.100 52.947 0.0000 #> Residual 168.749 28 6.027 #> Total 1126.047 31 #> -------------------------------------------------------------------- #> #> Parameter Estimates #> ---------------------------------------------------------------------------------------- #> model Beta Std. Error Std. Beta t Sig lower upper #> ---------------------------------------------------------------------------------------- #> (Intercept) 44.082 3.123 14.115 0.000 37.685 50.479 #> disp -0.056 0.013 -0.385 -4.257 0.000 -0.083 -0.029 #> wt -6.496 1.313 -0.616 -4.946 0.000 -9.186 -3.805 #> disp:wt 0.012 0.003 0.278 3.596 0.001 0.005 0.018 #> ----------------------------------------------------------------------------------------