Learn R Programming

mgwrsar (version 0.1-1)

kernelW_C: Computes weight matrix for a given kernel and bandwidth

Description

kernelW_C is a function that computes weight matrix for a given kernel and bandwidth

Usage

kernelW_C(XX, hh, MykernelS, isgcv_, Type, Minv, maxknn_,
NmaxDist_, TIME, Decay, DDiagNull)

Arguments

XX

a matrix with coordinates.

hh

a bandwidth value

MykernelS

a kernel type between ('bin','bisq','gauss','gauss_adapt', 'knn',bisq_knn')

isgcv_

default FALSE for computing CV criteria (for example for selecting optimal bandwidth).

Type

Kernel type.

Minv,

minimum number of neighbors when using distance kernels.

maxknn_

default 500, when n>NmaxDist only maxknn first neighbours are used for computation distance

NmaxDist_

default 5000, when n>NmaxDist only maxknn first neighbours are used for computing distance

TIME

default FALSE, time is used for computing weigths if TIME is TRUE weigth for future observation are set to zero

Decay

time decay when time is used for computing weigths.

DDiagNull

default FALSE, if TRUE diagonal has zero weights.

Value

kernelW_C returns a sparse weight matrix

See Also

MGWRSAR, bandwidths_mgwrsar, summary_mgwrsar, plot_mgwrsar, predict_mgwrsar

Examples

Run this code
# NOT RUN {
data(mydata);coord=as.matrix(mydata[,c("x_lat","y_lon")]);
W=kernelW_C(coord,100,'bisq_knn',FALSE,'GD',1,500,5000,FALSE,0,FALSE)
plot(D_dense_C(coord[1,1],coord[1,2],coord[,1],coord[,2]),W[1,])
# }

Run the code above in your browser using DataLab