find_TP | R Documentation |
Search of a suitable set of target points. find_TP is a wrapper function that identifies a set of target points based on spatial smoothed OLS residuals.
find_TP(formula, data,coord,K,kWtp=16,Wtp=NULL,type='residuals',
model_residuals=NULL,verbose=0,prev_TP=NULL,nTP=NULL)
formula |
a formula |
data |
a dataframe or a spatial dataframe (SP package) |
coord |
a dataframe or a matrix with coordinates, not required if data is a spatial dataframe |
K |
the minimum number of first neighbors with lower (resp.higer) absolute value of the smoothed residuals. |
kWtp |
the number of first neighbors for computing the smoothed residuals, default 16. |
Wtp |
a precomputed matrix of weights, default NULL. |
type |
method for choosing TP, could be 'residuals', 'equidistantGrid','random', default 'residuals' |
model_residuals |
(optional) a vector of residuals. |
verbose |
verbose mode, default FALSE. |
prev_TP |
index of already used TP (version length(K)>1), default NULL. |
nTP |
numbeer of target points for random choice of target points, default NULL. |
find_TP is a wrapper function that identifies a set of target points, based on spatial smoothed residuals by default. If no vector of residuals are provided, OLS residuals are computed. The function first computes the smooth of model residuals using a Sheppard's kernel with kWtp neighbors (default 16). Then it identifies local maxima (resp. minima) that fits the requirement of having at least K neighbors with lower (resp.higer) absolute value of the smoothed residuals. As K increases the number of target points decreases.
find_TP returns an index vector of Target Points set.
library(mgwrsar)
## loading data example
data(mydata)
coord=as.matrix(mydata[,c("x_lat","y_lon")])
TP=find_TP(formula = 'Y_gwr~X1+X2+X3', data =mydata,coord=coord,K=6,type='residuals')
# only 60 targets points are used
length(TP)
model_GWR_tp<-MGWRSAR(formula = 'Y_gwr~X1+X2+X3', data = mydata,coord=coord,
fixed_vars=NULL,kernels=c('gauss'), H=0.03, Model = 'GWR',
control=list(SE=TRUE,TP=TP,kWtp=12))
summary(model_GWR_tp$Betav)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.