em Fadlizi
em Fadlizi

Reputation: 15

Prediction of stock price using Date time

excuse me, I am new to using linear regression. I want to ask how to overcome the problem I faced, I tried to predict the stock price using the closing price with time/date. but I have an error that the value at Y (stock price) cannot be processed with the value of X (date). Are there any suggestions for solving my problem?

this is my data

and this is my regression linear

and this is my error

Thank You.

Upvotes: 1

Views: 436

Answers (1)

A cup of tea
A cup of tea

Reputation: 402

Linear regression can work only with numbers, so I would suggest you to construct new input features based on original datetime. E.g: - Number of month - Day of month - Year - Hour of day

If you wish, you can also construct more advanced features. For example if you feel like stock price can depend on weekend, you can engeneer features like: - Is weekend (1 if true / 0 if false) - Is holiday (1 if true / 0 if false) Etc.

Upvotes: 1

Related Questions