# Diagnostic checks to see if RCP groups are stable

### Description

For increasing size of hold-out samples, cooks distance and predictive log-likelihood are calculated and optionally plotted.

### Usage

1 2 | ```
stability.regimix(model, oosSizeRange = NULL, times = model$n,
mc.cores = 1, quiet = FALSE, doPlot=TRUE)
``` |

### Arguments

` model` |
a regmix 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. |

### Details

The plots produced are: 1) leave-some-out Cook's distance (see `cooks.distance.regimix`

) 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.

### Value

`stability.regimix`

produces a registab 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).

### See Also

`regimix`

, `cooks.distance.regimix`

, `plot.registab`

### Examples

1 2 3 4 5 6 7 8 9 10 | ```
## Not run:
#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)
system.time({
example( regimix);
stability.regimix( fm, oosSizeRange=seq( from=1,to=fm$n%/%5,length=5),
times=fm$n, mc.cores=2, doPlot=FALSE);
})
## End(Not run)
``` |

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker. Vote for new features on Trello.