[R] simultaneous estimation
Hi folks, Not sure what this sort of estimation is called. I have a 2-column time-series x(i,t) [with (i=1,2; t=1,...T)], and I want to do the following 'simultaneous' regressions: x(1,t) = (d - 1)(x(1, t-1) - mu(1)) x(2,t) = (d - 1)(x(2, t-1) - mu(2)) And I want to determine the coefficients d, mu(1), mu(2). Note that the d should be the same for both estimations, whereas the coefficients mu will have two values mu(1), mu(2), one for each estimation. Is this possible to do in R? What would be the corresponding syntax in, say, lm? Thanks, Murali __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] simultaneous estimation
On Tue, Aug 31, 2010 at 6:58 AM, murali.me...@avivainvestors.com wrote: Hi folks, Not sure what this sort of estimation is called. I have a 2-column time-series x(i,t) [with (i=1,2; t=1,...T)], and I want to do the following 'simultaneous' regressions: x(1,t) = (d - 1)(x(1, t-1) - mu(1)) x(2,t) = (d - 1)(x(2, t-1) - mu(2)) And I want to determine the coefficients d, mu(1), mu(2). Note that the d should be the same for both estimations, whereas the coefficients mu will have two values mu(1), mu(2), one for each estimation. Is this possible to do in R? What would be the corresponding syntax in, say, lm? Assuming appropriate error structure, try lm(x ~ xlag + f - 1) where x is a vector of all the data strung out except for the first time point and xlag is the corresponding lagged vector and f is a factor such that f[i] indicates which column x[i] came from. -- Statistics Software Consulting GKX Group, GKX Associates Inc. tel: 1-877-GKX-GROUP email: ggrothendieck at gmail.com __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] simultaneous estimation
On 31/08/2010 6:58 AM, murali.me...@avivainvestors.com wrote: Hi folks, Not sure what this sort of estimation is called. I have a 2-column time-series x(i,t) [with (i=1,2; t=1,...T)], and I want to do the following 'simultaneous' regressions: x(1,t) = (d - 1)(x(1, t-1) - mu(1)) x(2,t) = (d - 1)(x(2, t-1) - mu(2)) And I want to determine the coefficients d, mu(1), mu(2). Note that the d should be the same for both estimations, whereas the coefficients mu will have two values mu(1), mu(2), one for each estimation. Is this possible to do in R? What would be the corresponding syntax in, say, lm? Your specification is not complete: you haven't said what the errors will be, or how x(1,1) and x(2,1) are determined. I assume you mean independent normal errors, but are you willing to assume the variance is the same in both series? If so, then your model is almost equivalent to a linear model with concatenated x(1,t) and x(2,t) values. (This would be the partial likelihood version of the model, where you don't try to fit x(i, 1), but you fit the rest of the values conditional on earlier ones.) If you want the full likelihood or you want separate variances for the two series, you probably need to write out the likelihood explicitly and maximize it. Duncan Murdoch __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] simultaneous estimation
Hi Duncan, Thanks for your response. Indeed, independent normal errors were what I had in mind. As for variances, if I assume they are the same, would a 'pooled model' apply in this case? Is that equivalent to your suggestion of concatenating x(1,t) and x(2,t)? Cheers, Murali -Original Message- From: Duncan Murdoch [mailto:murdoch.dun...@gmail.com] Sent: 31 August 2010 12:31 To: Menon Murali Cc: r-help@r-project.org Subject: Re: [R] simultaneous estimation On 31/08/2010 6:58 AM, murali.me...@avivainvestors.com wrote: Hi folks, Not sure what this sort of estimation is called. I have a 2-column time-series x(i,t) [with (i=1,2; t=1,...T)], and I want to do the following 'simultaneous' regressions: x(1,t) = (d - 1)(x(1, t-1) - mu(1)) x(2,t) = (d - 1)(x(2, t-1) - mu(2)) And I want to determine the coefficients d, mu(1), mu(2). Note that the d should be the same for both estimations, whereas the coefficients mu will have two values mu(1), mu(2), one for each estimation. Is this possible to do in R? What would be the corresponding syntax in, say, lm? Your specification is not complete: you haven't said what the errors will be, or how x(1,1) and x(2,1) are determined. I assume you mean independent normal errors, but are you willing to assume the variance is the same in both series? If so, then your model is almost equivalent to a linear model with concatenated x(1,t) and x(2,t) values. (This would be the partial likelihood version of the model, where you don't try to fit x(i, 1), but you fit the rest of the values conditional on earlier ones.) If you want the full likelihood or you want separate variances for the two series, you probably need to write out the likelihood explicitly and maximize it. Duncan Murdoch __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] simultaneous estimation
On Aug 31, 2010, at 10:35 AM, murali.me...@avivainvestors.com murali.me...@avivainvestors.com wrote: Hi Duncan, Thanks for your response. Indeed, independent normal errors were what I had in mind. As for variances, if I assume they are the same, would a 'pooled model' apply in this case? Is that equivalent to your suggestion of concatenating x(1,t) and x(2,t)? Wouldn't this be equivalent to a segmented regression analysis that would estimate the slopes in the two periods as mu(1) and mu(2), throw- away any level shift estimate at the join-point, and which then estimated the residual one-lag autocorrelation (again omitting the join point) and assigned that value to d? -- David. Cheers, Murali -Original Message- From: Duncan Murdoch [mailto:murdoch.dun...@gmail.com] Sent: 31 August 2010 12:31 To: Menon Murali Cc: r-help@r-project.org Subject: Re: [R] simultaneous estimation On 31/08/2010 6:58 AM, murali.me...@avivainvestors.com wrote: Hi folks, Not sure what this sort of estimation is called. I have a 2-column time-series x(i,t) [with (i=1,2; t=1,...T)], and I want to do the following 'simultaneous' regressions: x(1,t) = (d - 1)(x(1, t-1) - mu(1)) x(2,t) = (d - 1)(x(2, t-1) - mu(2)) And I want to determine the coefficients d, mu(1), mu(2). Note that the d should be the same for both estimations, whereas the coefficients mu will have two values mu(1), mu(2), one for each estimation. Is this possible to do in R? What would be the corresponding syntax in, say, lm? Your specification is not complete: you haven't said what the errors will be, or how x(1,1) and x(2,1) are determined. I assume you mean independent normal errors, but are you willing to assume the variance is the same in both series? If so, then your model is almost equivalent to a linear model with concatenated x(1,t) and x(2,t) values. (This would be the partial likelihood version of the model, where you don't try to fit x(i, 1), but you fit the rest of the values conditional on earlier ones.) If you want the full likelihood or you want separate variances for the two series, you probably need to write out the likelihood explicitly and maximize it. Duncan Murdoch __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. David Winsemius, MD West Hartford, CT __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] simultaneous estimation
On 31/08/2010 11:00 AM, David Winsemius wrote: On Aug 31, 2010, at 10:35 AM, murali.me...@avivainvestors.com murali.me...@avivainvestors.com wrote: Hi Duncan, Thanks for your response. Indeed, independent normal errors were what I had in mind. As for variances, if I assume they are the same, would a 'pooled model' apply in this case? Is that equivalent to your suggestion of concatenating x(1,t) and x(2,t)? Wouldn't this be equivalent to a segmented regression analysis that would estimate the slopes in the two periods as mu(1) and mu(2), throw- away any level shift estimate at the join-point, and which then estimated the residual one-lag autocorrelation (again omitting the join point) and assigned that value to d? That is a different model. In the given situation, successive observations are correlated, so if x(1, t) had a large residual above the line, x(1, t+1) would be expected to have a large residual as well, and as long as |d-1| is less than 1, the given model would have zero slope in the long run. Duncan Murdoch __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] simultaneous estimation
I would hazard the guess that this would be better estimated as a multivariate time series (e.g. AR1) in which the covariance between the two innovation components was NOT assumed to be 0 (nor were their variances assumed to be the same). The R time series task view lists packages to do this, but ?ar might be a place to start. I would happily defer to expert opinion on this matter, however. I just always get this funny rumbling in my stomach whenever anyone proposes simple lagged regression models for time series. Maybe it's the burrito, though... -- Bert On Tue, Aug 31, 2010 at 8:53 AM, Duncan Murdoch murdoch.dun...@gmail.comwrote: On 31/08/2010 11:00 AM, David Winsemius wrote: On Aug 31, 2010, at 10:35 AM, murali.me...@avivainvestors.com murali.me...@avivainvestors.com wrote: Hi Duncan, Thanks for your response. Indeed, independent normal errors were what I had in mind. As for variances, if I assume they are the same, would a 'pooled model' apply in this case? Is that equivalent to your suggestion of concatenating x(1,t) and x(2,t)? Wouldn't this be equivalent to a segmented regression analysis that would estimate the slopes in the two periods as mu(1) and mu(2), throw- away any level shift estimate at the join-point, and which then estimated the residual one-lag autocorrelation (again omitting the join point) and assigned that value to d? That is a different model. In the given situation, successive observations are correlated, so if x(1, t) had a large residual above the line, x(1, t+1) would be expected to have a large residual as well, and as long as |d-1| is less than 1, the given model would have zero slope in the long run. Duncan Murdoch __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] simultaneous estimation
Bert, I expect you are correct, burrito notwithstanding (wasn't Taco Bell, was it? :-) The full model adds differences and lags, and incorporates non-zero covariances in the innovations. I only simplified to get an idea of how to implement in R. For anyone interested, I'm looking at the Balvers and Wu (2006): Momentum and Mean Reversion across National Equity Markets, Journal of Empirical Finance 13, 24-48. Their model is as follows, with x(i, t) = log of stock index value of country i at time t: x(i, t) = (1 - d(i)) * mu(i) + d(i) * x(i, t - 1) + Sum[rho(i, j) * (x(i, t - j) - x(t - j - 1))] + eps(i, t) where Sum is across J periods, the d(i), mu(i) and rho(i, j) are all specific to each country (i), and the error terms eps(i) have some covariance structure. You can see that the mu(i) term is supposed to capture the drift of the random walk component of stock index movement, the rho(i) is a coefficient for the momentum component, and the d(i) represents long temporary swings in the index. But as there's now a large number of parameters to estimate, a simplifying assumption is that d and rho are common to all the countries, while the mu is specific. Thanks, Murali From: Bert Gunter [mailto:gunter.ber...@gene.com] Sent: 31 August 2010 17:12 To: Duncan Murdoch Cc: David Winsemius; r-help@r-project.org; Menon Murali Subject: Re: [R] simultaneous estimation I would hazard the guess that this would be better estimated as a multivariate time series (e.g. AR1) in which the covariance between the two innovation components was NOT assumed to be 0 (nor were their variances assumed to be the same). The R time series task view lists packages to do this, but ?ar might be a place to start. I would happily defer to expert opinion on this matter, however. I just always get this funny rumbling in my stomach whenever anyone proposes simple lagged regression models for time series. Maybe it's the burrito, though... -- Bert On Tue, Aug 31, 2010 at 8:53 AM, Duncan Murdoch murdoch.dun...@gmail.com wrote: On 31/08/2010 11:00 AM, David Winsemius wrote: On Aug 31, 2010, at 10:35 AM, murali.me...@avivainvestors.com murali.me...@avivainvestors.com wrote: Hi Duncan, Thanks for your response. Indeed, independent normal errors were what I had in mind. As for variances, if I assume they are the same, would a 'pooled model' apply in this case? Is that equivalent to your suggestion of concatenating x(1,t) and x(2,t)? Wouldn't this be equivalent to a segmented regression analysis that would estimate the slopes in the two periods as mu(1) and mu(2), throw- away any level shift estimate at the join-point, and which then estimated the residual one-lag autocorrelation (again omitting the join point) and assigned that value to d? That is a different model. In the given situation, successive observations are correlated, so if x(1, t) had a large residual above the line, x(1, t+1) would be expected to have a large residual as well, and as long as |d-1| is less than 1, the given model would have zero slope in the long run. Duncan Murdoch __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.