0
$\begingroup$

This is my first question here so I hope I am asking correctly. I have done a few weeks worth of searching and haven't been able to find much, however I'm not a statistician so I probably wouldn't know if I came across good info.

I have a dataset that describes a food. The variables are as follows:

  • Categorical variables (describing country, region, cultivar, and process method)
  • Continuous (Altitude of growth)
  • Discrete (A bunch of scores between 1:10 for different flavour descriptors.

My aim is to create a predictive model to predict the scores based on the categorical variables and the altitude. Firstly, is this possible and secondly, how should I approach this?

I have been using R and trying out a few ways I thought it would work however I haven't had any luck with anything I try.

My approach:

  • I imported my data and split it 80/20 into test and training sets
  • Perform PCA on the scores and use the 90% component as my response variable in MLR
  • Use a few different methods for model selection (This is pretty much where I am stuck)

I feel like I am approaching this problem in completely the wrong way and am hoping someone may give me some pointers or guide me in the right direction?

My train of thought for the PCA was because the scores otherwise would all be weighted equally when one may be more important than another. I have been making sure to dummy code my categorical variables, but I still end up with atleast one singularity at one level of a variable.

Any help would be greatly appreciated!

Cheers.

$\endgroup$
3
  • $\begingroup$ It isn't clearly stated what the target or dependent variable is. My opinion is that PCA isn't appropriate when the input matrix is a mixture of scales (continuous and dummy). Regardless, PCA doesn't yield good predictors, you're much better off leaving the data as it is. Have you considered ANOVA? or, if there are multiple targets, MANOVA? Please clarify. $\endgroup$ – user234562 May 29 '20 at 15:08
  • $\begingroup$ The aim is to use the categorical data and the altitude to predict the multiple scores. predictors are categorical (country, region, cultivar, and process method) and continuous (altitude) while the response variables are the scores out of ten? I'm not sure what isn't clear? The PCA isn't for the predictors, I used it to get a single variable for the response. $\endgroup$ – dimmerz May 29 '20 at 15:40
  • $\begingroup$ Scores out of ten of what? Again, PCA isn't appropriate for mixtures of scales. Again, why not use an ANOVA-type framework or methodology? $\endgroup$ – user234562 May 29 '20 at 16:51
0
$\begingroup$

I would recommend you check out the ranger model in R. You can use it for classification or regression. It sounds like you are dealing with a classification problem. To simplify your problem you might group your scores into two or three groups. Perhaps high, medium or low quality of food. Then use those other variables to predict a value of high, low or medium. This problem sounds very familiar to the toy data set out there predicting wine quality. I would look for examples - perhaps here - and see if they can be applied to your example:

https://www.kaggle.com/piyushgoyal443/red-wine-dataset/kernels

I don't think you need to use PCA at this point for any transformations. The ranger model is probably a good starting point because it will handle the categorical variables without requiring you to one-hot encode them. Note if that score variable is numeric you may need to make sure it's a categorical depending on how you're building the model...in R or python.

$\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.