Description Usage Arguments Details Value Examples
View source: R/stepwise_regression.R
This function performs forward entry stepwise regression.
1 | stepwise_regression(dv, ivs, data, alpha_in = 0.05)
|
dv |
character string representing name of dependent variable in |
ivs |
character vector representing predictor variables in |
data |
data.frame |
alpha_in |
maximum p-value permitted of r-square change of non-included predictor to allow inclusion of predictor |
The model starts with no predictors and determines which predictor results
in the largest increase to r-squared. If this predictor has a p-value less than alpha_in
then the predictor is retained. If not then the predictor is excluded and the process stops.
Then all remaining predictors are examined. The predictor with the largest squared semi-partial correlation
adjusting for predictors already in the model is further examined.
If this predictor has a p-value less than alpha_in
(e.g., .05) then the predictor is retained.
If it is not significant, then the stepwise procedure ends and the model is returned.
If it is significant, thent the procedure is iterated again.
Note that this function is included mostly for comparion purposes. We do not advocate the use of stepwise regression for the purpose of evaluating the incremental prediction of facets over factors.
The model fit of class lm
returned from the final model.
The order of predictors corresponds to the order that they entered the model.
1 2 3 4 5 6 7 8 9 10 11 | data(facets_data); data(facets_meta)
## Example with the Big 5 as predictors:
stepwise_regression('swl', c("ipip_neuroticism", "ipip_extraversion",
"ipip_openness", "ipip_agreeableness", "ipip_conscientiousness"),
facets_data, alpha_in=.05)
## Example using 30 facets as predictors
## (illustrating a more stringent alpha_in):
stepwise_regression('swl', facets_meta$ipip_facets,
facets_data, alpha_in=.001)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.