gwglmnet.cv.f: Perform cross-validation for bandwidth selection in a gw-glm...

Description Usage Arguments Author(s) Examples

Description

Perform cross-validation for bandwidth selection in a gw-glm model.

Usage

1
gwglmnet.cv.f(formula, data, bw, coords, gweight, verbose, adapt, longlat, s, family, weights, nn, D = NULL, ...)

Arguments

formula
data
bw
coords
gweight
verbose
adapt
longlat
s
family
weights
nn
D
...

Author(s)

Wesley Brooks

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--	or do  help(data=index)  for the standard data sets.

## The function is currently defined as
function (formula, data, bw, coords, gweight, verbose, adapt, 
    longlat, s, family, weights, nn, D = NULL, ...) 
{
    cat(paste("Beginning with bandwidth: ", bw, "\n", sep = ""))
    gwglmnet.model = gwglmnet(formula = formula, data = data, 
        coords = coords, gweight = gweight, bw = bw, verbose = verbose, 
        longlat = longlat, adapt = adapt, s = s, family = family, 
        weights = weights, nearest.neighbors = nn, D = D)
    cv.error = sum(sapply(gwglmnet.model[["cv.error"]], min))
    cat(paste("Bandwidth: ", bw, ". CV error: ", cv.error, "\n", 
        sep = ""))
    return(cv.error)
  }

wrbrooks/gwselect documentation built on May 4, 2019, 11:59 a.m.