R/regional_mix_s3-class.R
stability.regional_mix.Rd
For increasing size of hold-out samples, cooks distance and predictive log-likelihood are calculated and optionally plotted.
stability.regional_mix( model, oosSizeRange = NULL, times = model$n, mc.cores = 1, quiet = FALSE, doPlot = TRUE )
model | a regional_mix model, as obtained by the function |
---|---|
oosSizeRange | the size of the (successive) hold-out samples. If NULL (default), then a sequence of 10 sizes, from 1 to 0.2*model$n is used. The more numbers in this range, the slower the function will run. |
times | the number of hold-out samples to use. If times=model$n and oosSize is 1, then the sample contains each and every site. Otherwise, it is a sample of size times from the possible combinations of possible hold-out sets. |
mc.cores | the number of cores to farm the jobs out to. |
quiet | should the progress bar be displayed (bar for each oosSizeRange) |
doPlot | should the plots be produced? Default is that they should be. |
Produces a regional_mix_stab object. This is a list with the oosSizeRnage, disty (the mean Cook's Distance for each subset size), nRCP, n, predlogls (log-likelihood of out-of-sample sites), logl.sites (the in-sample log-likelihood for full data set).
The plots produced are: 1) leave-some-out Cook's distance (see cooks.distance.regional_mix
) against holdout sample size; and 2) the predictive log-likelihood for times sites, against the holdout sample size.
In both plots, the values from the original model have been added to the plot.
if (FALSE) { #not run as R CMD check complains about the time taken. #This code will take a little while to run (about 3.5minutes on my computer) stability.regional_mix( fm, oosSizeRange=seq( from=1,to=fm$n,length=5), times=fm$n, mc.cores=2, doPlot=FALSE); }