[R-sig-Geo] spautolm - standard errors of regression paramters

ONKELINX, Thierry Thierry.ONKELINX at inbo.be
Tue Nov 6 09:25:32 CET 2007


Maybe spautolm() rescales the coordinates before calculating the model
parameters. In that case maybe het units mod1$fit are in the new scale
and the units of summary() in the original scale.

HTH,

Thierry

------------------------------------------------------------------------
----
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature
and Forest
Cel biometrie, methodologie en kwaliteitszorg / Section biometrics,
methodology and quality assurance
Gaverstraat 4
9500 Geraardsbergen
Belgium 
tel. + 32 54/436 185
Thierry.Onkelinx at inbo.be 
www.inbo.be 

Do not put your faith in what statistics say until you have carefully
considered what they do not say.  ~William W. Watt
A statistical analysis, properly conducted, is a delicate dissection of
uncertainties, a surgery of suppositions. ~M.J.Moroney

-----Oorspronkelijk bericht-----
Van: r-sig-geo-bounces at stat.math.ethz.ch
[mailto:r-sig-geo-bounces at stat.math.ethz.ch] Namens Sam Field
Verzonden: maandag 5 november 2007 23:19
Aan: Roger.Bivand at nhh.no
CC: r-sig-geo at stat.math.ethz.ch
Onderwerp: Re: [R-sig-Geo] spautolm - standard errors of regression
paramters

thanks Roger!


In my haste, I mistyped.  I meant to write:


sqrt(diag(mod1$fit[["imat"]]))


which should be equivalent to


summary(mod1)$Coef[,2],

the standard errors of the regression coefficients.


In any case, I have managed to replicate the case where the two commands
produce different results. Using the "columbus data"...


library(spdep)
data(columbus)

#defining W

columbus_poly <- readShapePoly(system.file("etc/shapes/columbus.shp",
package="spdep")[1])
columbus_nb <- poly2nb(columbus_poly)
columbus_listw <- nb2listw(columbus_nb)

#running spautolm()

mod1 <- spautolm(CRIME ~ HOVAL +  DISCBD,listw=columbus_listw,data =
columbus,family="SAR")


sqrt(diag(mod1$fit[["imat"]]))

summary(mod1)$Coef[,2]



and the result:


> sqrt(diag(mod1$fit[["imat"]]))
(Intercept)       HOVAL      DISCBD 
0.468345807 0.009013047 0.146973631 


> summary(mod1)$Coef[,2]
(Intercept)       HOVAL      DISCBD 
 4.68573639  0.09017431  1.47045128 


looks like the decimal place is shifted over one place.  If you add more
variables to the model, the results differ by more then a decimal place
in this case (in my case the results are very different). For example,


mod2 <- spautolm(CRIME ~ HOVAL +  DISCBD + INC +
PLUMB,listw=columbus_listw,data = columbus,family="SAR")

sqrt(diag(mod2$fit[["imat"]]))

summary(mod2)$Coef[,2]

   
results in:

> sqrt(diag(mod2$fit[["imat"]]))
(Intercept)       HOVAL      DISCBD         INC       PLUMB 
 0.52884967  0.01002545  0.17186710  0.03379109  0.04940024 
> 
> summary(mod2)$Coef[,2]
(Intercept)       HOVAL      DISCBD         INC       PLUMB 
 4.86800598  0.09228322  1.58201870  0.31104348  0.45472408 


Initially, I just wanted the standard errors so that I could write them
out in a text file and put them in a table for a MSWord document.
However, I will also need the covariances of the parameters and, thus,
need the off diagonal elements
of the variance covariance matrix.   Am I reading this matrix
incorrectly?


thanks for all of your help!

Sam









Quoting Roger Bivand <Roger.Bivand at nhh.no>:

> On Mon, 5 Nov 2007, Sam Field wrote:
> 
> > List,
> >
> > I would like to grab the standard errors of the regression 
> > parameters from
> an
> > spautolm object.  Currently I am using...
> >
> > mod1 <- spautolm(y~var1 + var2,....)
> >
> > mod1_sd <-  (diag(mod1$fit[["imat"]])^2
> 
> As with most model fitting functions, you use the summary method, so
> 
> summary(mod1)$Coef
> 
> is a four-column matrix, and
> 
> summary(mod1)$Coef[,2]
> 
> is the column you want.
> 
> Roger
> 
> PS. Reading summary.spautolm shows that the diagonal values of the 
> matrix you refer to are the squares of the SE values.
> 
> >
> >
> > This does produce a vector of the diagonal elements of a matrix that

> > look
> like a
> > variance covariance matrix (correct dimensions and row and column 
> > labels),
> but
> > the values I get do not agree with what the summary() function 
> > displays --
> they
> > also seem implausibly small.
> >
> > any hints?
> >
> > Thanks!
> >
> > Sam
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> 
> --
> 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: Roger.Bivand at nhh.no
> 
> 


--
********Note the new contact information*******

Samuel H. Field, Ph.D. 
Senior Research Investigator
CHERP/Division of Internal Medicine - University of Pennsylvania
Philadelphia VA Medical Center 3900 Woodland Ave (9 East) Philadelphia,
PA 19104
(215) 823-5800 EXT. 6155 (Office)
(215) 823-6330 (Fax)

_______________________________________________
R-sig-Geo mailing list
R-sig-Geo at stat.math.ethz.ch
https://stat.ethz.ch/mailman/listinfo/r-sig-geo




More information about the R-sig-Geo mailing list