GAA-UAM / scikit-fda

Functional Data Analysis Python package
https://fda.readthedocs.io
BSD 3-Clause "New" or "Revised" License
300 stars 54 forks source link

Confused from examples regarding which regression to use #574

Open qzyu999 opened 12 months ago

qzyu999 commented 12 months ago

A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] I'm looking to do functional regression, when we have many records, each with a set number of data points. An analogy would be stock market data, where if you had data from 2022-2023, you would have 365 data points, where X=1,2,...,365, and y=[EOD price day 1], [EOD price day 2], [EOD price day 365]. I want to try and predict the price on day 366, using all of the current data. I would also like to predict a variable number of days (e.g., predict 10 days out to day 375), along with having some confidence interval.

I looked at the regression examples, but none of them seem to match exactly my use case, where there's just some incremental value for X. I'm quite new to FDA, and I'm aware that there is a set of linear models. I would guess that this falls under function covariate and scalar result. However, looking at the examples I can't seem to get anything working. Thank you for your time.

vnmabus commented 12 months ago

From your example with stock market data (feel free to correct me if I am mistaken), you have just one curve (the stock), and you want to predict future values. If that is the case, you are outside the realm of functional data analysis, which requires to have several curves in order to do statistics. That example would be more akin to the problem of forecasting in time series. Thus, I would use a time series package instead (such as sktime).

qzyu999 commented 12 months ago

Thank you so much for your response, and thank you for the insight. What if I had for example 10 stocks on the same time axis, is there a methodology for that in FDA? Maybe for example predicting the mean price in the future?

vnmabus commented 11 months ago

If you have training data for some of them (e.g. you have the desired values for the first half) and if you can model these stocks as independent trajectories of a stochastic process, then you could use functional regression. However, as you are trying to predict the future, I doubt that is the case. I have not seen literature in FDA that deals with that, so I would probably stick with forecasting unless I wanted to try novel things.