0
$\begingroup$

I am trying apply linear regression on a dataset where the independent variable is a date formatted like '2-jan-08'. How should I convert the date so it can be used for model fitting?

$\endgroup$
1
  • $\begingroup$ Current question is too broad to be answered correctly. Post a part of your data or dummy data having a similar structure, to let others help you better. $\endgroup$ Jan 29, 2019 at 19:11

1 Answer 1

1
$\begingroup$

It depends on whether the date is the single source of features data X or if the date is a feature of X, along with other features.

If the date is the only independent variable you have time-series models, such as the autoregressive (AR), integrated (I) or moving average (MA) models. Their combination results in the ARMA or in the ARIMA models. Check this tutorial on using ARIMA with Python

If the date is a feature among others, you can convert the original date into multiple date features. Check this thread for feature engineering with time data.

$\endgroup$

Your Answer

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

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