[R] multiple autocorrelation coefficients in spdep?
Hello, Has anyone modified the errorsarlm in the R package spdep to allow for more than a single spatial autocorrelation coefficient (i.e. 'lambda')? Or, if not, any initial suggestions on how to make that modification? I have looked at the source code for the function and realize that any attempt to do it on my own would require much dedication, so would like to check whether someone has done it already. My R programming skills are very elementary. Specifically I would need to specify 2 different lambdas in a dataset, one for each group. I am performing a regression of grain yield against a number of soil variables, for 2 different years, where the regression includes terms for year*soil variables interaction. The spatial structure of the error is clearly different between these years, and I would thus like to fit different lambdas to them, if possible. Of course one option is to just run 2 separate regressions, but if the possibility of fitting more than 1 lambda does not seem too remote, I think fitting a single model offers some advantages. Thanks in advance, Ignacio [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] multiple autocorrelation coefficients in spdep?
On Mon, 25 Apr 2005, Ignacio Colonna wrote: > Hello, > > Has anyone modified the errorsarlm in the R package spdep to > allow for more than a single spatial autocorrelation coefficient (i.e. > 'lambda')? > > Or, if not, any initial suggestions on how to make that > modification? I have looked at the source code for the function and realize > that any attempt to do it on my own would require much dedication, so would > like to check whether someone has done it already. My R programming skills > are very elementary. > > > > Specifically I would need to specify 2 different lambdas in a dataset, one > for each group. I am performing a regression of grain yield against a number > of soil variables, for 2 different years, where the regression includes > terms for year*soil variables interaction. The spatial structure of the > error is clearly different between these years, and I would thus like to fit > different lambdas to them, if possible. Of course one option is to just run > 2 separate regressions, but if the possibility of fitting more than 1 lambda > does not seem too remote, I think fitting a single model offers some > advantages. > As far as I am aware, as package maintainer, this has not been done, and is not easy to do, as you have noted. It might be possible to use the lm.gls() function in the MASS package once the compound weights matrix (including the coefficients) has been fixed, perhaps using optim(). Have you considered other options perhaps including some lme variant, and/or spatial panel variants? > Thanks in advance, > > Ignacio -- Roger Bivand Economic Geography Section, Department of Economics, Norwegian School of Economics and Business Administration, Helleveien 30, N-5045 Bergen, Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43 e-mail: [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
RE: [R] multiple autocorrelation coefficients in spdep?
Thanks for the reply. I will look into the suggestions you have given. Indeed, I have used an lme model with direct covariance representation via geostatistical models, where I was able to fit separate terms for different groups, but part of my point is to compare the outcome from both approaches. Ignacio -Original Message- From: Roger Bivand [mailto:[EMAIL PROTECTED] Sent: Tuesday, April 26, 2005 3:00 AM To: Ignacio Colonna Cc: R-help@stat.math.ethz.ch Subject: Re: [R] multiple autocorrelation coefficients in spdep? On Mon, 25 Apr 2005, Ignacio Colonna wrote: > Hello, > > Has anyone modified the errorsarlm in the R package spdep to > allow for more than a single spatial autocorrelation coefficient (i.e. > 'lambda')? > > Or, if not, any initial suggestions on how to make that > modification? I have looked at the source code for the function and realize > that any attempt to do it on my own would require much dedication, so would > like to check whether someone has done it already. My R programming skills > are very elementary. > > > > Specifically I would need to specify 2 different lambdas in a dataset, one > for each group. I am performing a regression of grain yield against a number > of soil variables, for 2 different years, where the regression includes > terms for year*soil variables interaction. The spatial structure of the > error is clearly different between these years, and I would thus like to fit > different lambdas to them, if possible. Of course one option is to just run > 2 separate regressions, but if the possibility of fitting more than 1 lambda > does not seem too remote, I think fitting a single model offers some > advantages. > As far as I am aware, as package maintainer, this has not been done, and is not easy to do, as you have noted. It might be possible to use the lm.gls() function in the MASS package once the compound weights matrix (including the coefficients) has been fixed, perhaps using optim(). Have you considered other options perhaps including some lme variant, and/or spatial panel variants? > Thanks in advance, > > Ignacio -- Roger Bivand Economic Geography Section, Department of Economics, Norwegian School of Economics and Business Administration, Helleveien 30, N-5045 Bergen, Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43 e-mail: [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html