stepwise_regression: Forward entry stepwise regression

Description Usage Arguments Details Value Examples

View source: R/stepwise_regression.R

Description

This function performs forward entry stepwise regression.

Usage

1
stepwise_regression(dv, ivs, data, alpha_in = 0.05)

Arguments

dv

character string representing name of dependent variable in data

ivs

character vector representing predictor variables in data

data

data.frame

alpha_in

maximum p-value permitted of r-square change of non-included predictor to allow inclusion of predictor

Details

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.

Value

The model fit of class lm returned from the final model. The order of predictors corresponds to the order that they entered the model.

Examples

 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)

jeromyanglim/personalityfacets documentation built on Dec. 23, 2019, 7:31 p.m.