gwr.montecarlo: Monte Carlo (randomisation) test for significance of GWR...

Description Usage Arguments Value Note Author(s) References Examples

View source: R/MontCarlo.r

Description

This function implements a Monte Carlo (randomisation) test to test for significant (spatial) variability of a GWR model's parameters or coefficients.

Usage

1
2
gwr.montecarlo(formula, data = list(),nsims=99, kernel="bisquare",adaptive=F, bw,
                         p=2, theta=0, longlat=F,dMat)

Arguments

formula

Regression model formula of a formula object

data

a Spatial*DataFrame, i.e. SpatialPointsDataFrame or SpatialPolygonsDataFrame as defined in package sp

nsims

the number of randomisations

kernel

function chosen as follows:

gaussian: wgt = exp(-.5*(vdist/bw)^2);

exponential: wgt = exp(-vdist/bw);

bisquare: wgt = (1-(vdist/bw)^2)^2 if vdist < bw, wgt=0 otherwise;

tricube: wgt = (1-(vdist/bw)^3)^3 if vdist < bw, wgt=0 otherwise;

boxcar: wgt=1 if dist < bw, wgt=0 otherwise

adaptive

if TRUE calculate an adaptive kernel where the bandwidth (bw) corresponds to the number of nearest neighbours (i.e. adaptive distance); default is FALSE, where a fixed kernel is found (bandwidth is a fixed distance)

bw

bandwidth used in the weighting function, possibly calculated by bw.gwr

p

the power of the Minkowski distance, default is 2, i.e. the Euclidean distance

theta

an angle in radians to rotate the coordinate system, default is 0

longlat

if TRUE, great circle distances will be calculated

dMat

a pre-specified distance matrix, it can be calculated by the function gw.dist

Value

pmat

A vector containing p-values for all the GWR parameters

Note

The function “montecarlo.gwr” (in the early versions of GWmodel) has been renamed as “gwr.montecarlo”, while the old name is still kept valid.

Author(s)

Binbin Lu [email protected]

References

Brunsdon C, Fotheringham AS, Charlton ME (1998) Geographically weighted regression - modelling spatial non-stationarity. Journal of the Royal Statistical Society, Series D-The Statistician 47(3):431-443

Fotheringham S, Brunsdon, C, and Charlton, M (2002), Geographically Weighted Regression: The Analysis of Spatially Varying Relationships, Chichester: Wiley.

Charlton, M, Fotheringham, S, and Brunsdon, C (2007), GWR3.0.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## Not run: 
data(LondonHP)
DM<-gw.dist(dp.locat=coordinates(londonhp))
bw<-bw.gwr(PURCHASE~FLOORSZ,data=londonhp,dMat=DM, kernel="gaussian")
#See any difference in the next two commands and why?
res.mont1<-gwr.montecarlo(PURCHASE~PROF+FLOORSZ, data = londonhp,dMat=DM,
nsim=99, kernel="gaussian", adaptive=FALSE, bw=3000)
res.mont2<-gwr.montecarlo(PURCHASE~PROF+FLOORSZ, data = londonhp,dMat=DM,
nsim=99, kernel="gaussian", adaptive=FALSE, bw=300000000000)

## End(Not run)

Example output

Loading required package: maptools
Loading required package: sp
Checking rgeos availability: TRUE
Loading required package: robustbase
Loading required package: Rcpp
Welcome to GWmodel version 2.0-4.
 Note: This verision has been re-built with RcppArmadillo to improve its performance.
Fixed bandwidth: 28008.52 CV score: 901202470969 
Fixed bandwidth: 17313.68 CV score: 842907727581 
Fixed bandwidth: 10703.9 CV score: 736181883398 
Fixed bandwidth: 6618.837 CV score: 607130814353 
Fixed bandwidth: 4094.128 CV score: 529769270141 
Fixed bandwidth: 2533.772 CV score: 496244493691 
Fixed bandwidth: 1569.419 CV score: 558268461315 
Fixed bandwidth: 3129.775 CV score: 504912379213 
Fixed bandwidth: 2165.422 CV score: 500148436808 
Fixed bandwidth: 2761.425 CV score: 498237171785 
Fixed bandwidth: 2393.075 CV score: 496399101924 
Fixed bandwidth: 2620.728 CV score: 496732595196 
Fixed bandwidth: 2480.03 CV score: 496150911653 
Fixed bandwidth: 2446.816 CV score: 496183570335 
Fixed bandwidth: 2500.558 CV score: 496166149711 
Fixed bandwidth: 2467.344 CV score: 496154814854 
Fixed bandwidth: 2487.871 CV score: 496153635785 
Fixed bandwidth: 2475.184 CV score: 496151178429 
Fixed bandwidth: 2483.025 CV score: 496151494463 
Fixed bandwidth: 2478.179 CV score: 496150836405 
Fixed bandwidth: 2477.035 CV score: 496150899230 
Fixed bandwidth: 2478.886 CV score: 496150839373 
Fixed bandwidth: 2477.742 CV score: 496150850527 
Fixed bandwidth: 2478.449 CV score: 496150833774 
Fixed bandwidth: 2478.616 CV score: 496150834475 
Fixed bandwidth: 2478.346 CV score: 496150834229 
Fixed bandwidth: 2478.513 CV score: 496150833832 
Fixed bandwidth: 2478.41 CV score: 496150833868 
Fixed bandwidth: 2478.474 CV score: 496150833765 
Fixed bandwidth: 2478.489 CV score: 496150833779 
Fixed bandwidth: 2478.465 CV score: 496150833764 
Fixed bandwidth: 2478.459 CV score: 496150833766 
Fixed bandwidth: 2478.468 CV score: 496150833764 
Fixed bandwidth: 2478.47 CV score: 496150833764 
Fixed bandwidth: 2478.467 CV score: 496150833764 
Fixed bandwidth: 2478.466 CV score: 496150833764 
Fixed bandwidth: 2478.467 CV score: 496150833764 
Fixed bandwidth: 2478.468 CV score: 496150833764 
Fixed bandwidth: 2478.467 CV score: 496150833764 
Fixed bandwidth: 2478.467 CV score: 496150833764 
Fixed bandwidth: 2478.467 CV score: 496150833764 
Fixed bandwidth: 2478.467 CV score: 496150833764 
Fixed bandwidth: 2478.467 CV score: 496150833764 

Tests based on the Monte Carlo significance test

            p-value
(Intercept)    0.47
PROF           0.15
FLOORSZ        0.03

Tests based on the Monte Carlo significance test

            p-value
(Intercept)    0.44
PROF           0.49
FLOORSZ        0.45

GWmodel documentation built on Feb. 15, 2019, 5:06 p.m.