validate: perform cross validation on a fitted occupancy-detection...

Description Usage Arguments Details Value Examples

Description

validate is a function to cross validate fitted occupancy-detection models. This function will automatically prepare folds and run full cross validation. Note: cross validation requires fitting models repeatedly and can take some time.

Usage

1
validate(object, n_cv = 10)

Arguments

object

occupancy model fitted with occupancy::occupancy.

n_cv

number of cross validation folds. Defaults to 10.

Details

Cross validation is a useful method to test model reliability on new data. Many estimates of model fit are susceptible to overfitting. Cross validation attempts to avoid this risk by repeatedly partitioning the data and generating predictions for parts of the data not used during model fitting. This is an approximation of true model predictive capacity and still entails some risk of overfitting because the data come from the same statistical population and are not fully independent from the data used to fit models.

Value

a list object with cross-validated estimates of McFadden's r2 and AUC.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
## Not run: 

# fit a model to simulated data
mod <- occupancy(response ~ occ_predictor1 + occ_predictor2 + 
                    (1 | occ_random1) + (1 | occ_random2),
                  ~ detect_predictor1 + detect_predictor2 + 
                   (1 | detect_random1),
               site_id = "site",
               survey_id = "survey",
               data = occupancy_data,
               jags_settings = list(n_iter = 1000, n_burnin = 500, n_thin = 2))
               
# cross validate the fitted model
validate(mod)
     

## End(Not run)

jdyen/occupancy documentation built on July 8, 2019, 3:33 a.m.