0
$\begingroup$

This question is for a course that I am taking, I hope is not repeated. I have a dataset of 4500 observations with 17 variables. My response variable is binomial and I want to do a logistic regression to build a prediction model.

I normally use a stepwise approach to select my final model and the variables included in it; but in this case, I would like to internally validate the model by cross-validation. I have installed the "caret" package in R and have produced a model but all the variables in the dataset are included - I would like to reduce the number of variables included. My question is, should I do this before or after cross-validation, meaning:

  • Should I do a logistic regression and selection to see the most important variables and then include them to build my model with cross-validation?

  • Should I use the final model from cross-validation and try to reduce it? (If so, how?)

Thanks in advance

$\endgroup$
  • $\begingroup$ You can use regularization+cv. Take a look e.g. to this question $\endgroup$ – lrnzcig May 20 '17 at 14:29
0
$\begingroup$

I think feature selection should precede model building (logistic regression in your case). The goal of the feature selection is to simplify data and reduce dimensionality in order to ease model building and parameter calculation (So don't have to include irrelevant variables in your model and you don't have to calculate their corresponding parameters when applying regression)

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.