# How to do forecasting from linear regression when covariates are correlated

Consider I have in situ measurements (samples) of 4 variables: Temperature, salinity, pH, depth

I know how temperature will change and want to calculate the expected change in my other variables salinity and pH. Depth is fixed for each sample and cannot change. The variables are correlated to each other.

I can do a linear regression for both variables:

E[Salinity_sample] ~ b1*Temp_sample+b2*pH_sample+b3*depth_sample+intercept_salinity
E[pH_sample] ~ c1*Salinity_sample + c2*Temp_sample+ c3*depth_sample+intercept_pH


I know my change in temperature for each sample so Temp_future-Temp_sample is known here as Delta_Temp

now I would naively estimate my expected change in salinity for each sample as :

salinity_future ~ Salinity_sample + b1*Delta_Temp

pH_future ~ pH_sample + c2*Delta_Temp


but this ignores that pH and salinity are correlated with each other and temperature. Do my intercepts (Salinity_sample,pH_sample) account for that correlation already? if this calculation is wrong, how should I incorporate salinity and pH in the above calculations. Are there other ways maybe statistically more elaborated to get salinity_future and pH_future values in accordance to my Delta_Temp?

So do I not need to rather do

salinity_future ~ Salinity_sample + b1*Delta_Temp + b2*(pH_future-pH_sample)


but pH_future is also something I have to estimate from salinity_future so this is somehow a vicious circle of confusion.

• If the data are independent, then we're missing some indices to show if the data are collected at the right time. Basically you're saying that "depth" remains the same, and you want to use a sample at timepoint t to predict the response at timepoint t+1. That's well and good. However, salinity sample has to also be at timepoint t+1 to be a valid input to the functional estimate from the regression model. May 11 at 17:09
• I also don't think you mean to "invert" anything. I think your question merely boils down to how to use the regression for prediction. You observe a new X and predict the new Y, with W hopefully fixed. No problem. "inverting" seems to mean using Y to predict the X with W fixed. May 11 at 17:15
• thanks for your help. Not sure I completely understood: Temp_sample, Salinity_sample, ph_sample and depth_sample are vectors of observed data. depth_sample is not changing in the future so depth_sample==depth_future. or depth_t == depth t+1. Now I have the problem that using Y to predict X my W is not fixed because it will also change as pH and salinity are correlated as well. so in the pH_future formula I would also need to include delta_salinity? -sry inverting is not correct, will change the title. I originally thought I can do temp ~ salinity+ph+depth and invert this knowing my Delta_Temp May 11 at 17:33
• *depth_sample is not changing in the future so depth_sample==depth_future at each sampling location respectively as depth_sample is a vector May 11 at 17:39