From 258342247d3bf5d658c6cc12a18694ccc9a57457 Mon Sep 17 00:00:00 2001
From: Roger Bivand
## Loading required package: spData
## Loading required package: Matrix
-## Loading required package: sf
+## Linking to GEOS 3.12.1, GDAL 3.9.0beta1, PROJ 9.4.0; sf_use_s2() is TRUE
## Linking to GEOS 3.12.1, GDAL 3.9.0, PROJ 9.4.0; sf_use_s2() is TRUE
Getting some data
@@ -181,7 +181,7 @@
Getting some datasf_extSoftVersion()
}
## GEOS GDAL proj.4 GDAL_with_GEOS USE_PROJ_H
-## "3.12.1" "3.9.0beta1" "9.4.0" "true" "true"
+## "3.12.1" "3.9.0" "9.4.0" "true" "true"
## PROJ
## "9.4.0"
@@ -312,13 +312,16 @@
Symmetric sparse matrices
nb_B1 <- spdep::mat2listw(as(as(B, "TsparseMatrix"), "CsparseMatrix"),
- style="B", zero.policy=TRUE)
-nb_B1$style
+ style="B", zero.policy=TRUE)## [1] "B"
## Warning in sn2listw(df, style = style, zero.policy = zero.policy, from_mat2listw = TRUE): no-neighbour observations found, set zero.policy to TRUE;
+## this warning will soon become an error
+
nb_B1$style
+## [1] "B"
all.equal(nb_B1$neighbours, col2, check.attributes=FALSE)
-
@@ -331,7 +334,7 @@ ## [1] TRUE
Log deter
the eigenvalue approach with for example
spatialreg::eigenw
is limited by the need to operate on dense matrices in memory to solve
the eigenproblem:
+rho <- 0.1 do_spatialreg <- FALSE if (requireNamespace("spatialreg", quietly=TRUE)) do_spatialreg <- TRUE @@ -346,14 +349,14 @@
Log deter
"dsTMatrix"
, from a"ddiMatrix"
. The value of the log determinant follows, calling a sparse Cholesky decomposition internally for suitable input matrices. -+-## [1] "dgCMatrix" ## attr(,"package") ## [1] "Matrix"
+c(determinant(I - rho * B, logarithm=TRUE)$modulus)
## [1] -1.44787
The computation of a sparse Cholesky decomposition for each value of @@ -361,7 +364,7 @@
Log deter avoided by updating a pre-computed object; this approach provides fast and accurate log determinants for larger (but not very large) data sets: -
+@@ -373,7 +376,7 @@nW <- -B nChol <- Cholesky(nW, Imult=8) n * log(rho) + (2 * c(determinant(update(nChol, nW, 1/rho), sqrt=TRUE)$modulus))
Asymmetric sparse matricesThe use of row-standardisation leads to asymmetry even if the underlying neighbours are symmetric, unless all entities have matching numbers of neighbours (for example a regular grid on a torus): -
+ @@ -386,7 +389,7 @@-Asymmetric sparse matrices## .. ..$ : chr [1:49] "1" "2" "3" "4" ... ## ..@ x : num [1:230] 0.333 0.25 0.5 0.25 0.25 ... ## ..@ factors : list()
+## [1] FALSE
The
lag
method forlistw
objects is often @@ -395,17 +398,17 @@Asymmetric sparse matriceszero.policy to
TRUE
, the spatial lag of entity 21, which has no neighbours, is zero by construction: -+set.seed(1) x <- runif(n) r1 <- as.numeric(W %*% x) r2 <- lag(nb_W, x, zero.policy=TRUE) all.equal(r1, r2, check.attributes=FALSE)
-## [1] TRUE
+ -@@ -419,20 +422,20 @@+c(x[21], r1[21])
## [1] 0.9347052 0.0000000
Log dete result may be a complex vector (here it is not, as discussed below). The appropriate
determinant
method for"dgCMatrix"
objects uses an LU decomposition internally: -+-## [1] -1.594376
+class(I - rho * W)
-## [1] "dgCMatrix" ## attr(,"package") ## [1] "Matrix"
+c(determinant(I - rho * W, logarithm=TRUE)$modulus)
## [1] -1.594376
We can show the internal workings of the method as:
-+@@ -446,7 +449,7 @@## [1] -1.594376
Log determinants: symmetric by less costly numerical methods. The
"W"
style used the cardinalities of neighbour sets (row sums) to introduce row standardisation, and they are stored as an attribute: -+@@ -454,24 +457,24 @@## [1] TRUE
Log determinants: symmetric by (which must be symmetric), we can pre- and post-multiply by the square roots of the inverted neighbour counts, yielding a symmetric matrix with the appropriate properties: -
+-## [1] TRUE
+-## [1] Inf
+-## [1] 0
+class(Ws)
-## [1] "dsCMatrix" ## attr(,"package") ## [1] "Matrix"
+c(determinant(I - rho * Ws, logarithm=TRUE)$modulus)
## [1] -1.594376
As can be seen, the division by the square root of zero for entity 21 @@ -492,19 +495,19 @@
Using
eigsn
is somewhat larger, use may be made of theeigs
function in RSpectra: -+-## [1] -0.3212551 0.1638329
+-if (!require("RSpectra", quietly=TRUE)) dothis <- FALSE
+## [1] -0.3212551 0.1638329
In this case, the results are trivial with small
-k
.+-## [1] -1.544645 1.000000
+## [1] -1.544645 1.000000
Using row-standardisation has the nice feature of setting the upper @@ -520,15 +523,15 @@
Converting from sym
First we’ll see how to get from sparse matrices to graphs. The mode of a symmetric matrix is
-"undirected"
by definition:+class(B)
-## [1] "dgCMatrix" ## attr(,"package") ## [1] "Matrix"
+object.size(B)
-## 10824 bytes
+## Loading required package: igraph
## @@ -539,11 +542,11 @@
Converting from sym
-## The following object is masked from 'package:base': ## ## union
+g1 <- graph_from_adjacency_matrix(B, mode="undirected") class(g1)
-## [1] "igraph"
@@ -554,7 +557,7 @@+object.size(g1)
## 6544 bytes
Converting from gra
get.adjacency
chooses a particular class of sparse matrix to be returned, so that the conversion process typically leads many matrices to fewer graph types, and back to fewer matrix types: -+# Matrix 1.4-2 vulnerability work-around ow <- options("warn")$warn options("warn"=2L) @@ -563,13 +566,13 @@
Converting from gra
-## [1] "dgCMatrix" ## attr(,"package") ## [1] "Matrix"
+if (!inherits(B1, "try-error")) print(object.size(B1))
-## 10824 bytes
+-## [1] TRUE
+options("warn"=ow)
@@ -580,7 +583,7 @@Graph components in spdepn.comp.nb from the early days of the package. It is useful to know whether an
nb
object is divided up into separate subgraphs, and which entities are members of which such subgraph. -+## @@ -592,18 +595,18 @@
Graph components in igraph<
The same result can be obtained using the
-clusters
function in igraph:+c1 <- components(g1) c1$no == res$nc
-## [1] TRUE
+all.equal(c1$membership, res$comp.id)
-## [1] "names for target but not for current"
+## [1] TRUE
The same holds for the row-standardised variant:
-+W <- as(spdep::nb2listw(col2, style="W", zero.policy=TRUE), "CsparseMatrix") g1W <- graph_from_adjacency_matrix(W, mode="directed", weighted="W") c1W <- components(g1W) @@ -622,14 +625,14 @@
Shortest paths in weights mat above. The diameter measure is then the diameter of the largest component subgraph. Note that this generates an
n
xn
matrix: -+is_connected(g1)
-## [1] FALSE
+dg1 <- diameter(g1) dg1
-## [1] 7
+## num [1:49, 1:49] 0 1 1 2 2 3 4 3 3 4 ... @@ -645,7 +648,7 @@
Shortest paths in weights matr in advance (the largest lag order for which the number of links is greater than zero), we run into the problem of how to represent missing neighbour information. -
+nbl10 <- spdep::nblag(col2, maxlag=10) vals <- sapply(nbl10, function(x) sum(spdep::card(x))) zero <- which(vals == 0) @@ -657,7 +660,7 @@
Shortest paths in weights matr produced by
shortest.paths
, we need to set all these non-structural zeros to infinity (the length of the path between unconnected nodes), and re-instate structural zeros on the diagonal: -+lmat <- lapply(nbl10[1:(zero[1]-1)], spdep::nb2mat, style="B", zero.policy=TRUE) mat <- matrix(0, n, n) for (i in seq(along=lmat)) mat = mat + i*lmat[[i]] @@ -691,23 +694,23 @@
Smirnov/Anselin (2009) cyclical m this for each block/subgraph by testing the condition until it meets w[j,k] > 0, at which point it breaks. Smirnov and Anselin (2009) state that rook neighbours on a regular grid meet the condition: -
diff --git a/docs/reference/spautolm.html b/docs/reference/spautolm.html index 9f7edce..6695535 100644 --- a/docs/reference/spautolm.html +++ b/docs/reference/spautolm.html @@ -422,7 +422,7 @@+nb_r <- spdep::cell2nb(7, 7, type="rook") nb_rW <- spdep::nb2listw(nb_r, style="W") spdep:::find_q1_q2(nb_rW)
## [1] 1 1
One block/graph component is found, and this one meets the cyclical matrix condition, as also shown by the domain:
-+1/range(Re(eigenw(similar.listw(nb_rW))))
## [1] -1 1
This does not apply to the spatial weights we have been using above, with two non-singleton components, neither meeting the cyclical matrix condition:
-diff --git a/docs/reference/lagmess.html b/docs/reference/lagmess.html index a6e501d..103ecf3 100644 --- a/docs/reference/lagmess.html +++ b/docs/reference/lagmess.html @@ -250,7 +250,7 @@+spdep:::find_q1_q2(nb_W)
-## [1] 2 0
+1/range(Re(eigenw(similar.listw(nb_W))))
## [1] -1.544645 1.000000
By construction, all two-node connected graph components also meet diff --git a/docs/articles/sids_models.html b/docs/articles/sids_models.html index d4b78d5..a7c7117 100644 --- a/docs/articles/sids_models.html +++ b/docs/articles/sids_models.html @@ -121,7 +121,7 @@
Getting the data into R
We will be using the spdep and spatialreg packages, here version: spdep, version -1.3-4, 2024-03-27, the sf package and the +1.3-4, 2024-05-31, the sf package and the tmap package. The data from the sources referred to above is documented in the help page for the
nc.sids
data set in diff --git a/docs/news/index.html b/docs/news/index.html index bb534c0..728e711 100644 --- a/docs/news/index.html +++ b/docs/news/index.html @@ -64,8 +64,11 @@Changelog
-Version 1.3-2 (development)2024-02-06
-
- +
add
sqrt=TRUE
in calls to Matrixdeterminant
methods inmatrix_ldet
Version 1.3-3 (development)2024-05-31
+
- +
protect
errorsarlm
against missingDurbin=
if only intercept- +
fix longstanding bugs in
getVmate
in a non-default side logic branch- +
add
return_impacts=
tolmSLX
to work around issues with aliased variables; impacts should be improved to handle this case when time permitsadd
sqrt=TRUE
in calls to Matrixdeterminant
methods inmatrix_ldet
add
igraph (>= 2.0.0)
in DESCRIPTION for re-namedigraph
functionsdiff --git a/docs/pkgdown.yml b/docs/pkgdown.yml index 4cda807..0c5a74b 100644 --- a/docs/pkgdown.yml +++ b/docs/pkgdown.yml @@ -5,5 +5,5 @@ articles: nb_igraph: nb_igraph.html sids_models: sids_models.html SpatialFiltering: SpatialFiltering.html -last_built: 2024-04-29T13:14Z +last_built: 2024-05-31T15:10Z diff --git a/docs/reference/ME.html b/docs/reference/ME.html index 48ae762..838f2c3 100644 --- a/docs/reference/ME.html +++ b/docs/reference/ME.html @@ -168,7 +168,7 @@Examples
#> eV[,1], I: 0.08290518 ZI: NA, pr(ZI): 0.04 #> eV[,9], I: 0.06426565 ZI: NA, pr(ZI): 0.14 #> user system elapsed -#> 1.202 0.007 1.222 +#> 1.512 0.005 1.527 glmME <- glm(c(hopkins_part) ~ 1 + fitted(MEbinom1), family="binomial") #anova(glmME, test="Chisq") coef(summary(glmME)) @@ -220,7 +220,7 @@Examples
#> eV[,6], I: 0.1178225 ZI: NA, pr(ZI): 0.08 #> eV[,4], I: 0.06242664 ZI: NA, pr(ZI): 0.27 #> user system elapsed -#> 0.589 0.003 0.606 +#> 0.636 0.000 0.639 lagcol1 #> Eigenvector ZI pr(ZI) #> 0 NA NA 0.01 diff --git a/docs/reference/ML_models.html b/docs/reference/ML_models.html index 4cca555..f161fa5 100644 --- a/docs/reference/ML_models.html +++ b/docs/reference/ML_models.html @@ -312,6 +312,9 @@Control arguments
pre_eig + default NULL; may be used to pass a pre-computed vector of eigenvalues
return_impacts ++ default TRUE; may be set FALSE to avoid problems calculating impacts with aliased variables
OrdVsign @@ -584,7 +587,7 @@ default 1; used to set the sign of the final component to negative if -1 (alpha times ((sigma squared) squared) in Ord (1975) equation B.1).
Examples
#> Computing eigenvalues ... #> #> user system elapsed -#> 0.143 0.000 0.145 +#> 0.214 0.000 0.216 summary(COL.lag.M) #> #> Call:lagsarlm(formula = CRIME ~ INC + HOVAL, data = COL.OLD, listw = listw, @@ -640,7 +643,7 @@Examples
#> Computing eigenvalues ... #> #> user system elapsed -#> 0.394 0.000 0.396 +#> 0.564 0.003 0.571 summary(COL.lag.sp) #> #> Call:lagsarlm(formula = CRIME ~ INC + HOVAL, data = COL.OLD, listw = listw, @@ -1421,83 +1424,83 @@Examples
#> 2.22497381 print(system.time(ev <- eigenw(similar.listw(listw)))) #> user system elapsed -#> 0.001 0.000 0.001 +#> 0.001 0.000 0.002 print(system.time(COL.errW.eig <- errorsarlm(CRIME ~ INC + HOVAL, data=COL.OLD, listw, method="eigen", control=list(pre_eig=ev)))) #> user system elapsed -#> 0.143 0.000 0.143 +#> 0.224 0.000 0.226 ocoef <- coefficients(COL.errW.eig) print(system.time(COL.errW.eig <- errorsarlm(CRIME ~ INC + HOVAL, data=COL.OLD, listw, method="eigen", control=list(pre_eig=ev, LAPACK=FALSE)))) #> user system elapsed -#> 0.139 0.000 0.140 +#> 0.253 0.000 0.254 print(all.equal(ocoef, coefficients(COL.errW.eig))) #> [1] TRUE print(system.time(COL.errW.eig <- errorsarlm(CRIME ~ INC + HOVAL, data=COL.OLD, listw, method="eigen", control=list(pre_eig=ev, compiled_sse=TRUE)))) #> user system elapsed -#> 0.151 0.000 0.153 +#> 0.231 0.000 0.233 print(all.equal(ocoef, coefficients(COL.errW.eig))) #> [1] TRUE print(system.time(COL.errW.eig <- errorsarlm(CRIME ~ INC + HOVAL, data=COL.OLD, listw, method="Matrix_J", control=list(super=TRUE)))) #> Warning: the default value of argument 'sqrt' of method 'determinant(<CHMfactor>, <logical>)' may change from TRUE to FALSE as soon as the next release of Matrix; set 'sqrt' when programming #> user system elapsed -#> 0.159 0.000 0.160 +#> 0.250 0.000 0.252 print(all.equal(ocoef, coefficients(COL.errW.eig))) #> [1] TRUE print(system.time(COL.errW.eig <- errorsarlm(CRIME ~ INC + HOVAL, data=COL.OLD, listw, method="Matrix_J", control=list(super=FALSE)))) #> user system elapsed -#> 0.158 0.000 0.160 +#> 0.266 0.000 0.269 print(all.equal(ocoef, coefficients(COL.errW.eig))) #> [1] TRUE print(system.time(COL.errW.eig <- errorsarlm(CRIME ~ INC + HOVAL, data=COL.OLD, listw, method="Matrix_J", control=list(super=as.logical(NA))))) #> user system elapsed -#> 0.158 0.000 0.159 +#> 0.229 0.000 0.232 print(all.equal(ocoef, coefficients(COL.errW.eig))) #> [1] TRUE print(system.time(COL.errW.eig <- errorsarlm(CRIME ~ INC + HOVAL, data=COL.OLD, listw, method="Matrix", control=list(super=TRUE)))) #> user system elapsed -#> 0.144 0.000 0.144 +#> 0.232 0.000 0.234 print(all.equal(ocoef, coefficients(COL.errW.eig))) #> [1] TRUE print(system.time(COL.errW.eig <- errorsarlm(CRIME ~ INC + HOVAL, data=COL.OLD, listw, method="Matrix", control=list(super=FALSE)))) #> user system elapsed -#> 0.144 0.000 0.144 +#> 0.213 0.000 0.214 print(all.equal(ocoef, coefficients(COL.errW.eig))) #> [1] TRUE print(system.time(COL.errW.eig <- errorsarlm(CRIME ~ INC + HOVAL, data=COL.OLD, listw, method="Matrix", control=list(super=as.logical(NA))))) #> user system elapsed -#> 0.143 0.000 0.145 +#> 0.298 0.000 0.300 print(all.equal(ocoef, coefficients(COL.errW.eig))) #> [1] TRUE print(system.time(COL.errW.eig <- errorsarlm(CRIME ~ INC + HOVAL, data=COL.OLD, listw, method="spam", control=list(spamPivot="MMD")))) #> user system elapsed -#> 0.150 0.001 0.152 +#> 0.324 0.002 0.337 print(all.equal(ocoef, coefficients(COL.errW.eig))) #> [1] TRUE print(system.time(COL.errW.eig <- errorsarlm(CRIME ~ INC + HOVAL, data=COL.OLD, listw, method="spam", control=list(spamPivot="RCM")))) #> user system elapsed -#> 0.152 0.000 0.152 +#> 0.254 0.000 0.256 print(all.equal(ocoef, coefficients(COL.errW.eig))) #> [1] TRUE print(system.time(COL.errW.eig <- errorsarlm(CRIME ~ INC + HOVAL, data=COL.OLD, listw, method="spam_update", control=list(spamPivot="MMD")))) #> user system elapsed -#> 0.149 0.000 0.149 +#> 0.287 0.000 0.300 print(all.equal(ocoef, coefficients(COL.errW.eig))) #> [1] TRUE print(system.time(COL.errW.eig <- errorsarlm(CRIME ~ INC + HOVAL, data=COL.OLD, listw, method="spam_update", control=list(spamPivot="RCM")))) #> user system elapsed -#> 0.168 0.000 0.169 +#> 0.227 0.000 0.229 print(all.equal(ocoef, coefficients(COL.errW.eig))) #> [1] TRUE # } diff --git a/docs/reference/SLX.html b/docs/reference/SLX.html index 67f8dce..3157ee8 100644 --- a/docs/reference/SLX.html +++ b/docs/reference/SLX.html @@ -70,7 +70,7 @@Spatial Durbin linear (SLX, spatially lagged X) model
diff --git a/docs/reference/invIrM.html b/docs/reference/invIrM.html index 38ed769..fc961af 100644 --- a/docs/reference/invIrM.html +++ b/docs/reference/invIrM.html @@ -178,16 +178,16 @@lmSLX(formula, data = list(), listw, na.action, weights=NULL, Durbin=TRUE, - zero.policy=NULL) + zero.policy=NULL, return_impacts=TRUE) # S3 method for SlX print(x, digits = max(3L, getOption("digits") - 3L), ...) # S3 method for SlX @@ -115,6 +115,9 @@
Arguments
zero.policy + default NULL, use global option value; if TRUE assign zero to the lagged value of zones without neighbours, if FALSE assign NA
return_impacts ++ default TRUE; may be set FALSE to avoid problems calculating impacts with aliased variables
digits diff --git a/docs/reference/aple.html b/docs/reference/aple.html index 4798cea..4a0b37e 100644 --- a/docs/reference/aple.html +++ b/docs/reference/aple.html @@ -149,7 +149,17 @@ the number of significant digits to use when printing
Examples
#> [1] 0.6601805 # \dontrun{ errorsarlm(yield_detrend ~ 1, wheat, spdep::nb2listw(nbr12, style="W")) -#> Error in errorsarlm(yield_detrend ~ 1, wheat, spdep::nb2listw(nbr12, style = "W")): argument "Durbin" is missing, with no default +#> +#> Call: +#> errorsarlm(formula = yield_detrend ~ 1, data = wheat, listw = spdep::nb2listw(nbr12, +#> style = "W")) +#> Type: error +#> +#> Coefficients: +#> lambda (Intercept) +#> 0.60189687 -0.00251772 +#> +#> Log likelihood: -192.9519 # }Examples
x <- matrix(rnorm(length(nb7rt)), ncol=1) system.time(e <- invIrM(nb7rt, rho=0.9, method="chol", feasible=TRUE) %*% x) #> user system elapsed -#> 0.002 0.000 0.003 +#> 0.003 0.000 0.003 system.time(e <- invIrM(nb7rt, rho=0.9, method="chol", feasible=NULL) %*% x) #> user system elapsed -#> 0.003 0.000 0.003 +#> 0.002 0.000 0.003 system.time(e <- invIrM(nb7rt, rho=0.9, method="solve", feasible=TRUE) %*% x) #> user system elapsed #> 0.001 0.000 0.001 system.time(e <- invIrM(nb7rt, rho=0.9, method="solve", feasible=NULL) %*% x) #> user system elapsed -#> 0.001 0.000 0.002 +#> 0.002 0.000 0.001 # }Examples
#> system.time(obj2 <- lagmess(log(PRICE) ~ PATIO + log(AGE) + log(SQFT), data=baltimore, listw=lw)) #> user system elapsed -#> 0.03 0.00 0.03 +#> 0.042 0.000 0.043 (x <- summary(obj2)) #> Matrix exponential spatial lag model: #> diff --git a/docs/reference/sparse_mat.html b/docs/reference/sparse_mat.html index 427107a..6e645cb 100644 --- a/docs/reference/sparse_mat.html +++ b/docs/reference/sparse_mat.html @@ -180,11 +180,11 @@Examples
W <- as(lw, "CsparseMatrix") system.time(e <- invIrM(nb7rt, rho=0.98, method="solve", feasible=NULL) %*% x) #> user system elapsed -#> 0.002 0.000 0.002 +#> 0.003 0.000 0.003 system.time(ee <- powerWeights(W, rho=0.98, X=x)) #> Warning: not converged within order iterations #> user system elapsed -#> 0.181 0.010 0.192 +#> 0.241 0.001 0.246 str(attr(ee, "internal")) #> List of 5 #> $ series: num [1:250] 0.287 0.234 0.201 0.178 0.16 ... @@ -197,10 +197,10 @@Examples
# \dontrun{ system.time(ee <- powerWeights(W, rho=0.9, X=x)) #> user system elapsed -#> 0.133 0.005 0.140 +#> 0.195 0.000 0.200 system.time(ee <- powerWeights(W, rho=0.98, order=1000, X=x)) #> user system elapsed -#> 0.769 0.008 0.782 +#> 0.860 0.000 0.868 all.equal(e, as(ee, "matrix"), check.attributes=FALSE) #> [1] TRUE nb60rt <- spdep::cell2nb(60, 60, torus=TRUE) @@ -209,16 +209,16 @@Examples
x <- matrix(rnorm(dim(W)[1]), ncol=1) system.time(ee <- powerWeights(W, rho=0.3, X=x)) #> user system elapsed -#> 0.009 0.000 0.009 +#> 0.011 0.000 0.011 str(as(ee, "matrix")) #> num [1:3600, 1] -0.383 0.207 -0.731 1.552 0.32 ... #> - attr(*, "dimnames")=List of 2 #> ..$ : chr [1:3600] "1:1" "2:1" "3:1" "4:1" ... #> ..$ : NULL obj <- errorsarlm(as(ee, "matrix")[,1] ~ 1, listw=spdep::nb2listw(nb60rt), method="Matrix") -#> Error in errorsarlm(as(ee, "matrix")[, 1] ~ 1, listw = spdep::nb2listw(nb60rt), method = "Matrix"): argument "Durbin" is missing, with no default coefficients(obj) -#> Error in eval(expr, envir, enclos): object 'obj' not found +#> lambda (Intercept) +#> 0.30639880 0.01380415 # }Examples
data=nydata, listw=listw_NY, family="SAR", method="eigen", control=list(pre_eig=eigs))) #> user system elapsed -#> 0.196 0.000 0.197 +#> 0.313 0.000 0.314 res <- summary(esar1f) print(res) #> @@ -467,7 +467,7 @@Examples
system.time(esar1M <- spautolm(Z ~ PEXPOSURE + PCTAGE65P + PCTOWNHOME, data=nydata, listw=listw_NY, family="SAR", method="Matrix")) #> user system elapsed -#> 0.221 0.000 0.221 +#> 0.426 0.000 0.458 summary(esar1M) #> #> Call: @@ -498,7 +498,7 @@Examples
data=nydata, listw=listw_NY, family="SAR", method="Matrix", control=list(super=TRUE))) #> user system elapsed -#> 0.196 0.000 0.196 +#> 0.373 0.001 0.379 summary(esar1M) #> #> Call: @@ -558,7 +558,7 @@Examples
system.time(esar1wM <- spautolm(Z ~ PEXPOSURE + PCTAGE65P + PCTOWNHOME, data=nydata, listw=listw_NY, weights=POP8, family="SAR", method="Matrix")) #> user system elapsed -#> 0.212 0.000 0.214 +#> 0.382 0.000 0.385 summary(esar1wM) #> #> Call: @@ -675,7 +675,7 @@Examples
system.time(ecar1M <- spautolm(Z ~ PEXPOSURE + PCTAGE65P + PCTOWNHOME, data=nydata, listw=listw_NY, family="CAR", method="Matrix")) #> user system elapsed -#> 0.236 0.000 0.237 +#> 0.441 0.000 0.444 summary(ecar1M) #> #> Call: @@ -737,7 +737,7 @@Examples
system.time(ecar1wM <- spautolm(Z ~ PEXPOSURE + PCTAGE65P + PCTOWNHOME, data=nydata, listw=listw_NY, weights=POP8, family="CAR", method="Matrix")) #> user system elapsed -#> 0.243 0.000 0.244 +#> 0.437 0.001 0.456 summary(ecar1wM) #> #> Call: diff --git a/docs/reference/trW.html b/docs/reference/trW.html index 77af24b..89ade63 100644 --- a/docs/reference/trW.html +++ b/docs/reference/trW.html @@ -150,11 +150,11 @@Examples
set.seed(1100) system.time(trMC <- trW(W, type="MC")) #> user system elapsed -#> 0.005 0.000 0.006 +#> 0.006 0.000 0.006 str(trMC) #> num [1:30] 0 10.91 3.69 5.36 3.64 ... #> - attr(*, "sd")= num [1:30] NA NA 0.598 0.495 0.489 ... -#> - attr(*, "timings")= Named num [1:2] 0.005 0.005 +#> - attr(*, "timings")= Named num [1:2] 0.006 0.006 #> ..- attr(*, "names")= chr [1:2] "user.self" "elapsed" #> - attr(*, "type")= chr "MC" #> - attr(*, "n")= int 49 @@ -169,10 +169,10 @@Examples
W <- forceSymmetric(as(listwS, "CsparseMatrix")) system.time(trmom <- trW(listw=listwS, m=24, type="moments")) #> user system elapsed -#> 0.002 0.000 0.001 +#> 0.002 0.000 0.002 str(trmom) #> num [1:24] 0 10.91 3.65 5.62 3.66 ... -#> - attr(*, "timings")= Named num [1:2] 0.002 0.001 +#> - attr(*, "timings")= Named num [1:2] 0.002 0.002 #> ..- attr(*, "names")= chr [1:2] "user.self" "elapsed" #> - attr(*, "type")= chr "moments" #> - attr(*, "n")= int 49 @@ -180,10 +180,10 @@Examples
#> [1] TRUE system.time(trMat <- trW(W, m=24, type="mult")) #> user system elapsed -#> 0.003 0.000 0.003 +#> 0.005 0.000 0.005 str(trMat) #> num [1:24] 0 10.91 3.65 5.62 3.66 ... -#> - attr(*, "timings")= Named num [1:2] 0.003 0.003 +#> - attr(*, "timings")= Named num [1:2] 0.005 0.005 #> ..- attr(*, "names")= chr [1:2] "user.self" "elapsed" #> - attr(*, "type")= chr "mult" #> - attr(*, "n")= int 49 @@ -192,11 +192,11 @@Examples
set.seed(1) system.time(trMC <- trW(W, m=24, type="MC")) #> user system elapsed -#> 0.006 0.000 0.005 +#> 0.009 0.000 0.009 str(trMC) #> num [1:24] 0 10.91 2.44 4.97 2.82 ... #> - attr(*, "sd")= num [1:24] NA NA 0.618 0.501 0.451 ... -#> - attr(*, "timings")= Named num [1:2] 0.006 0.005 +#> - attr(*, "timings")= Named num [1:2] 0.008 0.009 #> ..- attr(*, "names")= chr [1:2] "user.self" "elapsed" #> - attr(*, "type")= chr "MC" #> - attr(*, "n")= int 49 @@ -206,10 +206,10 @@Examples
listwS <- similar.listw(listw) system.time(trmom <- trW(listw=listwS, m=24, type="moments")) #> user system elapsed -#> 0.108 0.000 0.108 +#> 0.128 0.000 0.128 str(trmom) #> num [1:24] 0 124.2 32.7 63.7 33.2 ... -#> - attr(*, "timings")= Named num [1:2] 0.108 0.108 +#> - attr(*, "timings")= Named num [1:2] 0.128 0.128 #> ..- attr(*, "names")= chr [1:2] "user.self" "elapsed" #> - attr(*, "type")= chr "moments" #> - attr(*, "n")= int 506 @@ -225,7 +225,7 @@Examples
} system.time(trmomp <- trW(listw=listwS, m=24, type="moments")) #> user system elapsed -#> 0.111 0.000 0.112 +#> 0.125 0.000 0.127 if(!get.mcOption()) { set.ClusterOption(NULL) stopCluster(cl)