Learn R Programming

mgwrsar (version 1.1)

predict,mgwrsar-method: predict method for mgwrsar model

Description

predict method for mgwrsar model

Usage

# S4 method for mgwrsar
predict(
  object,
  newdata,
  newdata_coords,
  W = NULL,
  type = "BPN",
  h_w = 100,
  kernel_w = "rectangle",
  maxobs = 4000,
  beta_proj = FALSE,
  method_pred = "TP",
  k_extra = 8,
  ...
)

Value

A vector of predictions if beta_proj is FALSE or a list with a vector named Y_predicted and a matrix named Beta_proj_out.

A vector of predictions.

Arguments

object

A model of class mgwrsar-class.

newdata

a matrix or data.frame of new data.

newdata_coords

a matrix of new coordinates, and eventually other variables if a General Kernel Product is used.

W

the spatial weight matrix for models with spatial autocorrelation.

type

Type for BLUP estimator, default "BPN". If NULL use predictions without spatial bias correction.

h_w

A bandwidth value for the spatial weight matrix

kernel_w

kernel type for the spatial weight matrix. Possible types: rectangle ("rectangle"), bisquare ("bisq"), tricube ("tcub"), epanechnikov ("epane"), gaussian ("gauss")) .

maxobs

maximum number of observations for exact calculation of solve(I- rho*W), default maxobs=4000.

beta_proj

A boolean, if TRUE the function then return a two elements list(Y_predicted,Beta_proj_out)

method_pred

If method_pred = 'TP' (default) prediction is done by recomputing a MGWRSAR model with new-data as target points, else if method_pred in ('tWtp_model','model','shepard') a matrix for projecting estimated betas is used (see details).

k_extra

number of neighboors for local parameter extrapolation if shepard kernel is used, default 8.

...

predict parameters forwarded.

Details

if method_pred ='tWtp_model', the weighting matrix for prediction is based on the expected weights of outsample data if they were had been added to insample data to estimate the corresponding MGWRSAR (see Geniaux 2022 for further detail), if method_pred ='shepard'a shepard kernel with k_extra neighbours (default 8) is used and if method_pred='kernel_model' the same kernel and number of neighbors as for computing the MGWRSAR model is used.