0
$\begingroup$

I need to create a predictive model for the pricing of Airbnb using a linear regression. The data set contains 34 variables and I do not know which of them are suitable. I have already divided the data set into a training and a test data set.

As far as I know, it is not reasonable to use all variables in a multiple regression and then select the ones with the highest significance. So how can I identify the appropriate variables? Should I use the variables with the highest correlation?

Any input would help me a lot, thankyou in advance

$\endgroup$
1
  • 2
    $\begingroup$ See here on making an R question that folks can help with. That includes a sample of data, all necessary code, and a clear explanation of what you're trying to do and what hasn't worked. It's also likely that this is a question better suited for Cross Validated $\endgroup$
    – camille
    Commented Feb 28, 2020 at 20:23

2 Answers 2

0
$\begingroup$

Generally:

  1. Look at your data! Make relevant plots for your question of interest; ie, compare your response against each of the potential predictors, and potentially if the need arises, look at combinations of features. Use said plots to infer which features might be valuable, and come up with a list of features that tend to be important.
  2. Once you have a subset of features that you think look valuable, come up with an objective criterion for judging model fit. This could be AIC, chi-squared test, F test, BIC, etc depending on the complexity of the model and the factors you determine are important (ie, if you want fewer features, that will help determine AIC vs BIC, for instance).
  3. Construct models in an objective fashion; ie, forwards selection, backwards selection, etc using the features you identified as valuable, and then determine which model is best on the basis of your objective criterion. Make sure the numbers you are getting are still against a null model; ie, a model with no features. Most modern scientific programming languages have built-in packages that will both of these steps for you.
  4. Now, do model inference; ie, look at feature $p$-values, etc.

Do NOT construct your model by starting with inference and picking the one with the "best" feature $p$-values (ie, the model that exhibits best the effect you are interested in), as this defeats the purpose of a statistical or probabilistic model.

$\endgroup$
0
$\begingroup$

These other points should be checked as well:

  • there should be no multicollinearity among your explanatory variables. To test for that, you can use Variance Inflation Factor.
  • models are usually easier to interpret when continuous variables have been scaled.
  • after selecting the appropriate explanatory variables, you can start your modelling approach as @Eric mentioned in his points 2 and 3.

Once you have your minimal model, you still have to check that it is valid:

Finally, your approach with a training and a test dataset is good and here is a tutorial on how to implement a linear regression with this logic.

$\endgroup$
2
  • $\begingroup$ "The first assumption of linear regression is that your response variable (the pricing of Airbnb) is normally distributed." Unfortunately, that is not correct. The ideal situation for statistical inference using a linear regression is that the error term is normally distributed. The marginal distribution of the response may very well be highly non-normal even when the error term is normally distributed. Note the poster is asking about a predictive model, so this may matter very little for their application. $\endgroup$ Commented Feb 29, 2020 at 18:40
  • $\begingroup$ Thanks @MatthewDrury for pointing this out! I edited my answer accordingly. $\endgroup$ Commented Feb 29, 2020 at 18:54

Your Answer

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