View source: R/predict.gwlfit.R
predict.gwlfit | R Documentation |
Predict method for gwlfit objects
## S3 method for class 'gwlfit'
predict(object, newdata, newcoords, type = "response", verbose = FALSE, ...)
object |
Object of class inheriting from "gwlfit" |
newdata |
a data.frame or matrix with the same columns as the training dataset |
newcoords |
a dataframe or matrix of coordinates of the new data |
type |
the type of response. see |
verbose |
|
... |
ellipsis for S3 compatibility. Not used in this function. |
a vector of predicted values
predictors <- matrix(data = rnorm(2500), 50,50)
y_value <- sample(1:1000, 50)
coords <- data.frame("Lat" = rnorm(50), "Long" = rnorm(50))
distance_matrix <- compute_distance_matrix(coords)
my.gwl.fit <- gwl_fit(bw = 20,
x.var = predictors,
y.var = y_value,
kernel = "bisquare",
dist.mat = distance_matrix,
alpha = 1,
adaptive = TRUE,
progress = TRUE,
nfolds = 5)
my.gwl.fit
new_predictors <- matrix(data = rnorm(500), 10,50)
new_coords <- data.frame("Lat" = rnorm(10), "Long" = rnorm(10))
predicted_values <- predict(my.gwl.fit,
newdata = new_predictors,
newcoords = new_coords)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.