Description Usage Arguments Details Value Warning Note Author(s) References See Also Examples
This function allows for the calibration of a local model using the Geographically Weighted Zero Inflated Poisson Regression (GWZIPR).
1 |
formula |
the local model to be fitted using the same syntax used in the zeroinfl function of the R package |
family |
a specification of the count model family to be used in the local model as in the |
dframe |
a numeric data frame of at least two suitable variables (one dependent and one independent) |
bw |
a positive number that may be an integer in the case of an "adaptive kernel" or a real in the case of a "fixed kernel". In the first case the integer denotes the number of nearest neighbours, whereas in the latter case the real number refers to the bandwidth (in meters if the coordinates provided are Cartesian). This argument can be also the result of a bandwidth selection algorithm such as those available in the function |
kernel |
the kernel to be used in the regression. Options are "adaptive" or "fixed". The weighting scheme used here is defined by the bi-square function |
coords |
a numeric matrix or data frame of two columns giving the X,Y coordinates of the observations |
The Geographically Weighted Zero Inflated Poisson Regression (GWZIPR) is a method recently proposed by Kalogirou(2015). It can be used with count data that follow a Poisson distribution and contain many zero values. The GWZIPR allows for the investigation of the existence of spatial non-stationarity in the relationship between a dependent and a set of independent variables while accounting for excess zeros. This is possible by fitting two seperate sub-models for each observation is space, taking into account the neighbour observations weighted by distance. The first submodel (count) models the non-zero values of the dependent variable while the second submodel (zero) models the zero values of the dependent variable. A detailed description of the GWZIPR along with examples from internal migration modelling is presented in the paper mentioned above (Kalogirou, 2015).
ZI_LEst_count |
a numeric data frame with the local intercepts and the local parameter estimates for each independent variable in the model's formula for the count part of the Zero Inflated model. |
ZI_LEst_zero |
a numeric data frame with the local intercepts and the local parameter estimates for each independent variable in the model's formula for the zero part of the Zero Inflated model. |
ZI_LPvalues_count |
a numeric data frame with the local p-value for the local intercepts and the local parameter estimates for each independent variable in the model's formula for the count part of the Zero Inflated model. |
ZI_LPvalues_zero |
a numeric data frame with the local p-value for the local intercepts and the local parameter estimates for each independent variable in the model's formula for the zero part of the Zero Inflated model. |
ZI_GofFit |
a numeric data frame with residuals and local goodness of fit statistics (AIC) |
Large datasets may take long to calibrate.
This function is under development. There should be improvements in future versions of the package lctools. Any suggestion is welcome!
Stamatis Kalogirou <stamatis@lctools.science>
Kalogirou, S. (2016) Destination Choice of Athenians: an application of geographically weighted versions of standard and zero inflated Poisson spatial interaction models, Geographical Analysis, 48(2),pp. 191-230. DOI: 10.1111/gean.12092 http://onlinelibrary.wiley.com/doi/10.1111/gean.12092/abstract
1 2 | RDF <- random.test.data(10,10,3,"zip")
gw.zip <- gw.zi(dep ~ X1 + X2, "poisson", RDF, 60, kernel = 'adaptive', cbind(RDF$X,RDF$Y))
|
Loading required package: reshape
Loading required package: weights
Loading required package: Hmisc
Loading required package: lattice
Loading required package: survival
Loading required package: Formula
Loading required package: ggplot2
Attaching package: 'Hmisc'
The following objects are masked from 'package:base':
format.pval, round.POSIXt, trunc.POSIXt, units
Loading required package: gdata
sh: 1: cannot create /dev/null: Permission denied
gdata: Unable to locate valid perl interpreter
gdata:
gdata: read.xls() will be unable to read Excel XLS and XLSX files
gdata: unless the 'perl=' argument is used to specify the location of a
gdata: valid perl intrpreter.
gdata:
gdata: (To avoid display of this message in the future, please ensure
gdata: perl is installed and available on the executable search path.)
sh: 1: cannot create /dev/null: Permission denied
gdata: Unable to load perl libaries needed by read.xls()
gdata: to support 'XLX' (Excel 97-2004) files.
gdata: Unable to load perl libaries needed by read.xls()
gdata: to support 'XLSX' (Excel 2007+) files.
gdata: Run the function 'installXLSXsupport()'
gdata: to automatically download and install the perl
gdata: libaries needed to support Excel XLS and XLSX formats.
Attaching package: 'gdata'
The following object is masked from 'package:Hmisc':
combine
The following object is masked from 'package:stats':
nobs
The following object is masked from 'package:utils':
object.size
The following object is masked from 'package:base':
startsWith
Loading required package: mice
Loading required package: pscl
Classes and Methods for R developed in the
Political Science Computational Laboratory
Department of Political Science
Stanford University
Simon Jackman
hurdle and zeroinfl functions by Achim Zeileis
Loading required package: MASS
Number of Observations: 100
Kernel: Adaptive
Neightbours: 60
Number of Variables: 2
--------------- Global Model Summary ---------------
Call:
zeroinfl(formula = dep ~ X1 + X2, data = RDF, dist = "poisson")
Pearson residuals:
Min 1Q Median 3Q Max
-1.6010 -0.6611 0.2184 0.6452 2.5129
Count model coefficients (poisson with log link):
Estimate Std. Error z value Pr(>|z|)
(Intercept) 1.9366 0.1081 17.912 <2e-16 ***
X1 0.1398 0.1414 0.989 0.323
X2 -0.1191 0.1452 -0.820 0.412
Zero-inflation model coefficients (binomial with logit link):
Estimate Std. Error z value Pr(>|z|)
(Intercept) -1.5547 0.6740 -2.307 0.0211 *
X1 0.0984 0.8414 0.117 0.9069
X2 0.2306 0.8503 0.271 0.7863
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Number of iterations in BFGS optimization: 10
Log-likelihood: -240 on 6 Df
Residual Sum of Squares: 1356.408
R-squared: 0.00702232
Adjusted R-squared: -0.02400823
--------------- Local Model Summary ---------------
Residuals:
Min. 1st Qu. Median Mean 3rd Qu. Max.
-7.2577 -2.1143 0.7208 0.0000 2.4433 8.5685
Coefficients:
Count Model:
Min Max Mean StD
CM_.Intercept. 1.72291737 2.02385785 1.9232879 0.08156998
CM_X1 -0.09962612 0.56771824 0.2006946 0.14421313
CM_X2 -0.41043994 0.09696409 -0.1441947 0.13067157
Zero Model:
Min Max Mean StD
ZM_.Intercept. -3.379420 -0.3826403 -1.67390019 0.7171950
ZM_X1 -2.278197 2.6272746 0.34694334 1.2450672
ZM_X2 -1.154479 1.0537179 0.08472854 0.5937113
Residual Sum of Squares: 1332.689
R-squared: 0.02438587
Adjusted R-squared: -0.006102073There were 50 or more warnings (use warnings() to see the first 50)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.