3
$\begingroup$

I am trying to do linear regression to predict the time a user spends listening to music using the following dataset:

enter image description here

My end goal is to know which characteristics or columns lead to higher listening. (Sum is the total listening time)

I was thinking of using PCA before linear regression because there were so many columns. However, as I googled that, I came across PCR and I'm not sure what the difference is. Does PCA even increase the results from Linear Regression? If yes, then is PCA + LR better or PCR better?

I am trying to do this using scikit learn's method for Linear Regression. It looks like it only takes in an X and Y data set for training. Does this mean I need to decrease my dimensionality of my input data matrix to 2 dimensions using PCA before I can use this method?

EDIT: Ended up using pandas and statsmodel to take in multiple inputs when doing linear regression in case that helps anyone else with the same question...However, my above questions still stand.

$\endgroup$
2
  • 1
    $\begingroup$ Although Amoeba answered your question, I'd say that your columns are not organized in the right way. There should be a column named 'Sex' with values [0,1] or [M,F]; a column named 'Age' with values [A,B...] where each letter stands for a class of age (Otherwise, you can use age as a continuous predictor). You have so many columns because of that. So, first try to organize your data, and then focus on the analysis. $\endgroup$
    – smndpln
    Commented Dec 27, 2016 at 12:08
  • $\begingroup$ Hi @pr338. Have you had a chance to take a look at my answer? If you think it does resolve the issue please consider marking it as accepted. If you still have doubts please feel free to ask for clarifications. It would be great to get some feedback. $\endgroup$
    – amoeba
    Commented Dec 29, 2016 at 19:58

1 Answer 1

10
$\begingroup$

There is no difference.

Principal component regression (PCR) is linear regression after principal component analysis (PCA) is done on the set of predictors and (usually) only a small subset of principal components is retained.


For reading more about this topic, you might be interested in this thread How can top principal components retain the predictive power on a dependent variable (or even lead to better predictions)? and links therein.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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