An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20130709/579e34b4/attachment.pl>
Question about LM test for residual autocorrelation in R
5 messages · Dongwoo Kang, Hodgess, Erin, Michael Blows +1 more
Hi Dongwoo: I tried the following example:
erin1 <- summary(COL.mix.eig, correlation=TRUE, Nagelkerke=TRUE) names(erin1)
[1] "type" "rho" "coefficients" "rest.se" [5] "LL" "s2" "SSE" "parameters" [9] "logLik_lm.model" "AIC_lm.model" "method" "call" [13] "residuals" "opt" "tarX" "tary" [17] "y" "X" "fitted.values" "se.fit" [21] "similar" "ase" "rho.se" "LMtest" [25] "resvar" "zero.policy" "aliased" "listw_style" [29] "interval" "fdHess" "optimHess" "insert" [33] "trs" "LLNullLlm" "timings" "f_calls" [37] "hf_calls" "intern_classic" "coeftitle" "Coef" [41] "NK" "Wald1" "correlation" "correltext" [45] "LR1"
erin1$LMtest
[,1] [1,] 0.2891926
and it does indeed have the LMtest result. Or were you looking for the formula, please? Thanks, Erin
From: r-sig-geo-bounces at r-project.org [r-sig-geo-bounces at r-project.org] on behalf of Dongwoo Kang [dwkang1982 at gmail.com]
Sent: Tuesday, July 09, 2013 3:47 PM
To: r-sig-geo at r-project.org
Subject: [R-sig-Geo] Question about LM test for residual autocorrelation in R
Sent: Tuesday, July 09, 2013 3:47 PM
To: r-sig-geo at r-project.org
Subject: [R-sig-Geo] Question about LM test for residual autocorrelation in R
Dear list,
Hello, I am Dongwoo Kang. I am studying Spatial Econometric modeling.
I've faced one question while using *spdep* package in R.
I want to ask your help for my qeustion.
While estimating my empirical models,
I want to test whether residuals of my spatial regression models (SEM, SAR,
SARAR, SDM estimated by maximum likelihood) still have spatial
autocorrelation pattern.
I think I have two options,
1) Moran's I test using *"moran.mc"* function in R,
2) Lagrange multiplier diagnostics with LMerr option using
*"lm.LMtests"* function
in R.
But I also find that for SAR, SDM, *"summary.sarlm"* function returns "LM
test for residual autocorrelation" by default.
However, this LM test is not given for SER and SARAR.
At first, I thought that "Lagrange multiplier diagnostics" and "LM test for
residual autocorrelation" in "*summary.sarlm*" function are same tests.
But in my empirical results, they give me different statistics (please see
below example).
-----< example
>---------------------------------------------------------------------------
> summary.sarlm(sar2, Nagelkerke=T)
...
Log likelihood: -3533.378 for lag model
ML residual variance (sigma squared): 224.88, (sigma: 14.996)
Nagelkerke pseudo-R-squared: 0.76166
Number of observations: 853
Number of parameters estimated: 29
AIC: 7124.8, (AIC for lm: 7393.3)
LM test for residual autocorrelation
test value: 6.8391, p-value: 0.0089184
>
> lm.LMtests(sar2$residuals, listw=w100.listw, test=c("LMerr"))
Lagrange multiplier diagnostics for spatial dependence
data:
residuals: sar2$residuals
weights: w100.listw
LMErr = 3.7108, df = 1, p-value = 0.05406
-------------------------------------------------------------------------------------------------------
I try to find formulation of "LM test for residual autocorrelation" given
by *"summary.sarlm"* function but I couldn't.
Would you tell me where I can get some documents or explanations about "LM
test for residual autocorrelation" given by *"summary.sarlm"*?
I also want to know why "LM test for residual autocorrelation" is not
provided in SER and SARAR models.
Thank you very much for your time.
Best regards,
Dongwoo Kang
[[alternative HTML version deleted]]
_______________________________________________
R-sig-Geo mailing list
R-sig-Geo at r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Sorry...answered the wrong question How do you generate the SER models, please?
From: r-sig-geo-bounces at r-project.org [r-sig-geo-bounces at r-project.org] on behalf of Dongwoo Kang [dwkang1982 at gmail.com]
Sent: Tuesday, July 09, 2013 3:47 PM
To: r-sig-geo at r-project.org
Subject: [R-sig-Geo] Question about LM test for residual autocorrelation in R
Sent: Tuesday, July 09, 2013 3:47 PM
To: r-sig-geo at r-project.org
Subject: [R-sig-Geo] Question about LM test for residual autocorrelation in R
Dear list,
Hello, I am Dongwoo Kang. I am studying Spatial Econometric modeling.
I've faced one question while using *spdep* package in R.
I want to ask your help for my qeustion.
While estimating my empirical models,
I want to test whether residuals of my spatial regression models (SEM, SAR,
SARAR, SDM estimated by maximum likelihood) still have spatial
autocorrelation pattern.
I think I have two options,
1) Moran's I test using *"moran.mc"* function in R,
2) Lagrange multiplier diagnostics with LMerr option using
*"lm.LMtests"* function
in R.
But I also find that for SAR, SDM, *"summary.sarlm"* function returns "LM
test for residual autocorrelation" by default.
However, this LM test is not given for SER and SARAR.
At first, I thought that "Lagrange multiplier diagnostics" and "LM test for
residual autocorrelation" in "*summary.sarlm*" function are same tests.
But in my empirical results, they give me different statistics (please see
below example).
-----< example
>---------------------------------------------------------------------------
> summary.sarlm(sar2, Nagelkerke=T)
...
Log likelihood: -3533.378 for lag model
ML residual variance (sigma squared): 224.88, (sigma: 14.996)
Nagelkerke pseudo-R-squared: 0.76166
Number of observations: 853
Number of parameters estimated: 29
AIC: 7124.8, (AIC for lm: 7393.3)
LM test for residual autocorrelation
test value: 6.8391, p-value: 0.0089184
>
> lm.LMtests(sar2$residuals, listw=w100.listw, test=c("LMerr"))
Lagrange multiplier diagnostics for spatial dependence
data:
residuals: sar2$residuals
weights: w100.listw
LMErr = 3.7108, df = 1, p-value = 0.05406
-------------------------------------------------------------------------------------------------------
I try to find formulation of "LM test for residual autocorrelation" given
by *"summary.sarlm"* function but I couldn't.
Would you tell me where I can get some documents or explanations about "LM
test for residual autocorrelation" given by *"summary.sarlm"*?
I also want to know why "LM test for residual autocorrelation" is not
provided in SER and SARAR models.
Thank you very much for your time.
Best regards,
Dongwoo Kang
[[alternative HTML version deleted]]
_______________________________________________
R-sig-Geo mailing list
R-sig-Geo at r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20130709/3f43ce80/attachment.pl>
1 day later
On Tue, 9 Jul 2013, Michael Blows wrote:
Hi all, can any body clarify me why the degrees of freedom in R output of ?GWR comes in decimal? Mike
Please read the references, where this is explained - why would you expect them to be integer when weighted proportions of observations are being used for each fit point? The print method for fitted gwr objects reports two versions of effective degrees of freedom if the hat matrix is computed, one complete, the other an approximation used in the 2002 GWR book, but these non-integer numbers are also based on assumptions.
[[alternative HTML version deleted]]
Please only post plain text! Roger
Roger Bivand Department of Economics, NHH Norwegian School of Economics, Helleveien 30, N-5045 Bergen, Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43 e-mail: Roger.Bivand at nhh.no