spautolm                package:spdep                R Documentation

_S_p_a_t_i_a_l _c_o_n_d_i_t_i_o_n_a_l _a_n_d _s_i_m_u_l_t_a_n_e_o_u_s _a_u_t_o_r_e_g_r_e_s_s_i_o_n _m_o_d_e_l _e_s_t_i_m_a_t_i_o_n

_D_e_s_c_r_i_p_t_i_o_n:

     Function taking family and weights arguments for spatial
     autoregression model estimation by Maximum Likelihood, using full
     matrix methods, not suited to large data sets with thousands of
     observations. The implementation is GLS using the single spatial
     coefficient value, here termed lambda, found by line search using
     'optimize' to maximise the log likelihood.

_U_s_a_g_e:

     spautolm(formula, data = list(), listw, weights = NULL, na.action=na.fail, verbose = FALSE, tol.opt = .Machine$double.eps^(2/3), family = "SAR", method="full", interval=c(-1,0.999), zero.policy = FALSE, cholAlloc=NULL, tol.solve=.Machine$double.eps)

_A_r_g_u_m_e_n_t_s:

 formula: a symbolic description of the model to be fit. The details 
          of model specification are given for 'lm()'

    data: an optional data frame containing the variables in the model.
           By default the variables are taken from the environment
          which the function  is called.

   listw: a 'listw' object created for example by 'nb2listw'

na.action: a function (default 'na.fail'), can also be 'na.omit' or
          'na.exclude' with consequences for residuals and fitted
          values - in these cases the weights list will be subsetted to
          remove NAs in the data. Note that only weights lists created
          without using the glist argument to 'nb2listw' may be
          subsetted.

 weights: an optional vector of weights to be used in the fitting
          process

 verbose: default=FALSE; if TRUE, reports function values during
          optimization.

 tol.opt: the desired accuracy of the optimization - passed to
          'optimize()'

  family: character string: either '"SAR"' or '"CAR"' for simultaneous
          or conditional autoregressions

  method: character string: default "full" for use of full matrices,
          "SparseM" for sparse matrices (restricted to spatial weights
          symmetric or similar to symmetric)

interval: search interval for autoregressive parameter when not using
          method="eigen"; default is c(-1,0.999), 'optimize' will reset
          NA/NaN to a bound and gives a warning when the interval is
          poorly set

zero.policy: Include list of no-neighbour observations in output if
          TRUE - otherwise zero.policy is handled within the listw
          argument

cholAlloc: control arguments for memory allocation in 'chol' for sparse
          matrices in method="SparseM": if NULL, default values are
          used (larger than SparseM defaults), otherwise a list with
          elements: nsubmax, nnzlmax, and tmpmax, for example
          cholAlloc=list(nsubmax=25000, nnzlmax=100000, tmpmax=25000)

tol.solve: the tolerance for detecting linear dependencies in the
          columns of matrices to be inverted - passed to 'solve()'
          (default=double precision machine tolerance). Errors in
          'solve()' may constitute indications of poorly scaled
          variables: if the variables have scales differing much from
          the autoregressive coefficient, the values in this matrix may
          be very different in scale, and inverting such a matrix is
          analytically possible by definition, but numerically
          unstable; rescaling the RHS variables alleviates this better
          than setting tol.solve to a very small value

_D_e_t_a_i_l_s:

     This implementation is based on 'lm.gls' and 'errorsarlm', and
     should be treated as preliminary. In particular, the function does
     not (yet) prevent asymmetric spatial weights being used with "CAR"
     family models. It appears that both numerical issues (convergence
     in particular) and uncertainties about the exact spatial weights
     matrix used make it difficult to reproduce Cressie and Chan's 1989
     results, also given in Cressie 1993.

     Note that the fitted() function for the output object assumes that
     the response  variable may be reconstructed as the sum of the
     trend, the signal, and the noise (residuals). Since the values of
     the response variable are known, their spatial lags are used to
     calculate signal components (Cressie 1993, p. 564). This differs
     from other software, including GeoDa, which does not use knowledge
     of the response  variable in making predictions for the fitting
     data.

_V_a_l_u_e:

     A list object of class 'spautolm': 

     fit: a list, with items:

     _c_o_e_f_f_i_c_i_e_n_t_s ML coefficient estimates

     _S_S_E ML sum of squared errors

     _s_2 ML residual variance

     _i_m_a_t ML coefficient covariance matrix

     _s_i_g_n_a_l__t_r_e_n_d non-spatial component of fitted.values

     _s_i_g_n_a_l__s_t_o_c_h_a_s_t_i_c spatial component of fitted.values

     _f_i_t_t_e_d._v_a_l_u_e_s sum of non-spatial and spatial components of
          fitted.values

     _r_e_s_i_d_u_a_l_s difference between observed and fitted values 

  lambda: ML autoregressive coefficient

      LL: log likelihood for fitted model

     LL0: log likelihood for model with lambda=0

    call: the call used to create this object

parameters: number of parameters estimated

 aliased: if not NULL, details of aliased variables

na.action: (possibly) named vector of excluded or omitted observations
          if non-default na.action argument used

_N_o_t_e:

     The standard errors given in Waller and Gotway (2004) are adjusted
     for the numbers of parameters estimated, and may be reproduced by
     using the additional argument 'adj.se=TRUE' in the 'summary'
     method. In addition, the function returns fitted values and
     residuals as given by Cressie (1993) p. 564.

_A_u_t_h_o_r(_s):

     Roger Bivand Roger.Bivand@nhh.no

_R_e_f_e_r_e_n_c_e_s:

     Cliff, A. D., Ord, J. K. 1981 _Spatial processes_, Pion; Ord, J.
     K. 1975 Estimation methods for models of spatial interaction,
     _Journal of the American Statistical Association_, 70, 120-126;
     Waller, L. A., Gotway, C. A. 2004 _Applied spatial statistics for
     public health_, Wiley, Hoboken, NJ, 325-380; Cressie, N. A. C.
     1993 _Statistics for spatial data_, Wiley, New York, 548-568;
     Ripley, B. D. 1981 _Spatial statistics_, Wiley, New York, 88-95.

_S_e_e _A_l_s_o:

     'optimize', 'errorsarlm'

_E_x_a_m_p_l_e_s:

     ## Not run: 
     esarI <- errorsarlm(ft.SID74 ~ 1, data=mdata, listw=sids.nhbr.listw, zero.policy=TRUE)
     summary(esarI)
     esarIa <- spautolm(ft.SID74 ~ 1, data=mdata, listw=sids.nhbr.listw, family="SAR")
     summary(esarIa)
     esarIV <- errorsarlm(ft.SID74 ~ ft.NWBIR74, data=mdata, listw=sids.nhbr.listw, zero.policy=TRUE)
     summary(esarIV)
     esarIVa <- spautolm(ft.SID74 ~ ft.NWBIR74, data=mdata, listw=sids.nhbr.listw, family="SAR")
     summary(esarIVa)
     esarIaw <- spautolm(ft.SID74 ~ 1, data=mdata, listw=sids.nhbr.listw, weights=mdata$BIR74, family="SAR")
     summary(esarIaw)
     esarIIaw <- spautolm(ft.SID74 ~ both - 1, data=mdata, listw=sids.nhbr.listw, weights=mdata$BIR74, family="SAR")
     summary(esarIIaw)
     esarIVaw <- spautolm(ft.SID74 ~ ft.NWBIR74, data=mdata, listw=sids.nhbr.listw, weights=mdata$BIR74, family="SAR")
     summary(esarIVaw)
     ecarIaw <- spautolm(ft.SID74 ~ 1, data=mdata.4, listw=sids.nhbr.listw.4, weights=mdata.4$BIR74, family="CAR")
     summary(ecarIaw)
     ecarIIaw <- spautolm(ft.SID74 ~ both - 1, data=mdata.4, listw=sids.nhbr.listw.4, weights=mdata.4$BIR74, family="CAR")
     summary(ecarIIaw)
     ecarIVaw <- spautolm(ft.SID74 ~ ft.NWBIR74, data=mdata.4, listw=sids.nhbr.listw.4, weights=mdata.4$BIR74, family="CAR")
     summary(ecarIVaw)
     nc_LL$fitIV <- append(fitted.values(ecarIVaw), NA, outl-1)
     spplot(nc_LL, c("fitIV"), cuts=12) # Cressie 1993, p. 565
     ## End(Not run)
     data(NY_data)
     lm0 <- lm(Z ~ PEXPOSURE + PCTAGE65P + PCTOWNHOME, data=nydata)
     summary(lm0)
     lm0w <- lm(Z ~ PEXPOSURE + PCTAGE65P + PCTOWNHOME, data=nydata, weights=POP8)
     summary(lm0w)
     esar0 <- errorsarlm(Z ~ PEXPOSURE + PCTAGE65P + PCTOWNHOME, data=nydata, listw=listw_NY)
     summary(esar0)
     esar1f <- spautolm(Z ~ PEXPOSURE + PCTAGE65P + PCTOWNHOME, data=nydata, listw=listw_NY, family="SAR", method="full")
     summary(esar1f)
     esar1s <- spautolm(Z ~ PEXPOSURE + PCTAGE65P + PCTOWNHOME, data=nydata, listw=listw_NY, family="SAR", method="SparseM")
     summary(esar1s)
     esar1wf <- spautolm(Z ~ PEXPOSURE + PCTAGE65P + PCTOWNHOME, data=nydata, listw=listw_NY, weights=nydata$POP8, family="SAR", method="full")
     summary(esar1wf)
     esar1ws <- spautolm(Z ~ PEXPOSURE + PCTAGE65P + PCTOWNHOME, data=nydata, listw=listw_NY, weights=nydata$POP8, family="SAR", method="SparseM")
     summary(esar1ws)
     ecar1f <- spautolm(Z ~ PEXPOSURE + PCTAGE65P + PCTOWNHOME, data=nydata, listw=listw_NY, family="CAR", method="full")
     summary(ecar1f)
     ecar1s <- spautolm(Z ~ PEXPOSURE + PCTAGE65P + PCTOWNHOME, data=nydata, listw=listw_NY, family="CAR", method="SparseM")
     summary(ecar1s)
     ecar1wf <- spautolm(Z ~ PEXPOSURE + PCTAGE65P + PCTOWNHOME, data=nydata, listw=listw_NY, weights=nydata$POP8, family="CAR", method="full")
     summary(ecar1wf)
     ecar1ws <- spautolm(Z ~ PEXPOSURE + PCTAGE65P + PCTOWNHOME, data=nydata, listw=listw_NY, weights=nydata$POP8, family="CAR", method="SparseM")
     summary(ecar1ws)
     data(oldcol)
     COL.errW.eig <- errorsarlm(CRIME ~ INC + HOVAL, data=COL.OLD, nb2listw(COL.nb, style="W"))
     summary(COL.errW.eig)
     COL.errW.sar <- spautolm(CRIME ~ INC + HOVAL, data=COL.OLD, nb2listw(COL.nb, style="W"))
     summary(COL.errW.sar)

