370 independent variables - LOGISTIC REGRESSION I want to run logistic regression to predict binary outcome , however I have 300+ independent variable.
I am new in analytics and statistics ,in my opinion first I need to dimension reduction.
I ran PCA in R and I am getting below error  "Error in princomp.default(input, scores = TRUE, COR = TRUE) :  covariance matrix is not non-negative definite"
I am not able to resolve above error also in terms of approach if anyone can provide guidance that would be good .


*

*what should I do to reduce number of variables , identifying powerful predictors ... 

 A: Cannot comment due to low reputation.
Are your variables continuous or discreete? 
You can use regularized models such as Lasso or Elastic-net. See this R package.
Both models are based on the L1-norm. Classifier built with this form of regularization are sparse, meaning that some of the weights are exactly zero. 
From the weights you can derive some form of feature relevance.
A: Some observations:


*

*300+ variables is way too many for logistic regression. So dimension reduction techniques are indeed useful in this sense. Having said that, what are your variables and what is it that you are predicting? A bit of context would be very useful, as, for starters, it may help you select an appropriate dimension reduction technique (for example: PCA or Factor Analysis). 

*300+ variables and your covariance/correlation matrix is not positive definite probably because it is singular (i.e. non-invertible). This essentially means that a number of your variables are redundant. To be a bit more technical, a singular matrix has a determinant of $0$ due to linear dependency, i.e. columns in your covariance/correlation matrix can be expressed as a linear combination of other columns in your covariance matrix. This would usually hint that in your data matrix, there is either very highly (or perfectly) correlated predictors or there is a substantial proportion of $0$ entries within a set of variables. Indeed with 300+ variables, I would be surprised if neither is the case. 

*Hence, before you plunge into logistic regression, I stress this: Do spend time understanding your variables and their relationships. For example, compute a correlation matrix. Check how many correlations between variables are very high (e.g. > |.85|). Examine descriptives and check histograms. Examine the proportion of $0$ entries per variable? Altogether, these basic steps will prepare you better for conducting dimension reduction techniques. 
