gwl_fit | R Documentation |
Fit a geographically weighted lasso with the selected bandwidth
gwl_fit(
bw,
x.var,
y.var,
kernel,
dist.mat,
alpha,
adaptive,
progress = TRUE,
nfolds = 5
)
bw |
Bandwidth |
x.var |
input matrix, of dimension nobs x nvars; each row is an observation vector. x should have 2 or more columns. |
y.var |
response variable for the lasso |
kernel |
the geographical kernel shape to compute the weight. passed to |
dist.mat |
a distance matrix. can be generated by |
alpha |
the elasticnet mixing parameter. set 1 for lasso, 0 for ridge. see |
adaptive |
TRUE or FALSE Whether to perform an adaptive bandwidth search or not. A fixed bandwidth means that samples are selected if they fit a determined fixed radius around a location. In a adaptive bandwidth, the radius around a location varies to gather a fixed number of samples around the investigated location |
progress |
TRUE/FALSE whether to display a progress bar or not |
nfolds |
the number f folds for the glmnet cross validation |
a gwlfit
object containing a fitted Geographically weighted Lasso.
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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.