Learn R Programming

GWPR.light (version 0.2.1)

GWPR.phtest: Locally Hausman Test Based on GWPR

Description

Locally Hausman Test Based on GWPR

Usage

GWPR.phtest(formula, data, index, SDF, bw = NULL, adaptive = FALSE,
                   p = 2, effect = "individual", random.method = "swar",
                   kernel = "bisquare", longlat = FALSE)

Arguments

formula

The regression formula: : Y ~ X1 + ... + Xk

data

A data.frame for the Panel data.

index

A vector of the two indexes: (c("ID", "Time")).

SDF

Spatial*DataFrame on which is based the data, with the "ID" in the index.

bw

The optimal bandwidth, either adaptive or fixed distance.

adaptive

If TRUE, adaptive distance bandwidth is used, otherwise, fixed distance bandwidth.

p

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

effect

The effects introduced in the fixed effects model, one of "individual" (default) , "time", "twoways"

random.method

Method of estimation for the variance components in the random effects model, one of "swar" (default), "amemiya", "walhus", or "nerlove"

kernel

bisquare: wgt = (1-(vdist/bw)^2)^2 if vdist < bw, wgt=0 otherwise (default); gaussian: wgt = exp(-.5*(vdist/bw)^2); exponential: wgt = exp(-vdist/bw); tricube: wgt = (1-(vdist/bw)^3)^3 if vdist < bw, wgt=0 otherwise; boxcar: wgt=1 if dist < bw, wgt=0 otherwise

longlat

If TRUE, great circle distances will be calculated

Value

A list of result:

GW.arguments

a list class object including the model fitting parameters for generating the report file

SDF

a Spatial*DataFrame (either Points or Polygons, see sp) integrated with fit.points, test value, p value, df

Examples

Run this code
# NOT RUN {
data(TransAirPolCalif)
data(California)
formula.GWPR <- pm25 ~ co2_mean + Developed_Open_Space_perc + Developed_Low_Intensity_perc +
   Developed_Medium_Intensity_perc + Developed_High_Intensity_perc +
   Open_Water_perc + Woody_Wetlands_perc + Emergent_Herbaceous_Wetlands_perc +
   Deciduous_Forest_perc + Evergreen_Forest_perc + Mixed_Forest_perc +
   Shrub_perc + Grassland_perc + Pasture_perc + Cultivated_Crops_perc +
   pop_density + summer_tmmx + winter_tmmx + summer_rmax + winter_rmax

#precomputed bandwidth
bw.AIC.Fix <- 7.508404

GWPR.phtest.resu.F <- GWPR.phtest(formula = formula.GWPR, data = TransAirPolCalif,
                                  index = c("GEOID", "year"), SDF = California,
                                  bw = bw.AIC.Fix, adaptive = FALSE, p = 2,
                                  effect = "individual", kernel = "bisquare",
                                  longlat = FALSE)
library(tmap)
tm_shape(GWPR.phtest.resu.F$SDF) +
     tm_polygons(col = "p.value", breaks = c(0, 0.05, 1))
# }

Run the code above in your browser using DataLab