# Ideal Linear Prediction of One Time Series Given Another

1 view (last 30 days)
CdC on 24 Jan 2022
Edited: CdC on 24 Jan 2022
I have two data time series arrays, p (the predictors) and v (the values), each of the same length len.
What is the simplest way to create an ideal, nth-order, causal linear predictor based on the relationship of the predictors and the values and then use it to make a causal prediction of each successive value of v(t) given the all of the predictor data up until that timepoint in the predictor time series, but none of the later datapoints, ie p(1:t)?
In making a prediction of a single time series given all of the prior datapoints in the same series, this can be done using the linear predictor coefficients function to generate a filter, and then using the filter to create the prediction, as described in the documentation for the function lcp: https://www.mathworks.com/help/signal/ref/lpc.html
What is the best function/method for doing this when you have one (or more) time series, to use to predict another time series that is not a member of the group of predictors?
Is there a matlab function that is to crosscorrelation what lpc is to autocorrelation?
Thank you?
Benjamin Thompson on 24 Jan 2022
The curve fitting toolbox has a function fit(), or the curve fitting tool for a more interactive experience.
This article has the mathematical background on fitting a line to data:
There are other toolboxes with similar features, see the article "Linear Regression Workflow" in the help, using the Statistics toolbox.
In general MALTAB the polyfit function should always be available, just fitting a polynomial of order 1 to your data.

Benjamin Thompson on 24 Jan 2022
The curve fitting toolbox has a function fit(), or the curve fitting tool for a more interactive experience.
This article has the mathematical background on fitting a line to data:
There are other toolboxes with similar features, see the article "Linear Regression Workflow" in the help, using the Statistics toolbox.
In general MALTAB the polyfit function should always be available, just fitting a polynomial of order 1 to your data.
CdC on 24 Jan 2022
Edited: CdC on 24 Jan 2022
Thank you for your suggestions. Will have a look. Can you recommend how to use the linear regression, polyfit, or other regression tools to accomplish the above, given the context of using a time series of values as the basis for the model / regressors? Perhaps this is just a matter of formatting up the data using some sort of window and then inputting it into the modelling function?
Perhaps worth mentioning that the time series are long arrays, so creating a array as input to a the model that singificantly increases the size of the array of predictors (ie converting the 1D predictor into a 2D array to use for multiple regression) would likely not be a good idea. Thanks again.

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by