Skip to content

Lineair regression modelling between time series //correlation analysis

2 messages · Jan Verbesselt, Brian Ripley

#
Dear R specialists,

I'm working with time series and want to investigate the relationship
between two time series by correlation analysis or by fitting a gen.
lineair model to the plot of x(timeserie1) and y(timeserie2).

Lin1 <- data.frame(
        Nr = c(1:lengte),
        NDII = window(ts.mNDII,c(1998,10),c(2003,11)),
        InvERC = window(Inv.ERC,c(1998,10),c(2003,11))
        )

summary(glm(NDII ~ InvERC, data=Lin1, family=gaussian(link ="identity")))

Error in "storage.mode<-"(`*tmp*`, value = "double") : 
        invalid time series parameters specified

How can I solve this error?

Are there specific functions which I can use to investigate the
relationship between two time series? (object ts is ok) ....Does somebody
has some examples of how to solve this statistical problem? ARIMA, AR,
ACF of the package "ts" for time series analysis

Thanks a lot,
Best regards,
Jan Verbesselt
#
On Thu, 4 Mar 2004, Jan Verbesselt wrote:

            
Why are you using glm to do linear regression?  lm() is the preferred 
function.
We would need to be able to reproduce it to be able to help you.  A quick 
attempt

library(MASS)
Lin1 <- data.frame(male=mdeaths, female=fdeaths)
summary(glm(female ~ male, data=Lin1, family=gaussian(link ="identity")))

works, as there is no technical problem with having time series in such a
fit (although the result may be statistically invalid).
Many, including lm().
What is your statistical problem, precisely?  Using the regression 
capabilities on arima() or function gls() in package nlme spring to mind, 
and ccf() and spectrum() can display cross-correlations and ar() can fit a 
joint AR model.