summary.simulations: Generic Methods for secrdesign Objects

summary.secrdesignR Documentation

Generic Methods for secrdesign Objects

Description

Methods to summarize simulated datasets.

Usage


## S3 method for class 'secrdesign'
summary(object, ...)

## S3 method for class 'rawdata'
summary(object, ...)

## S3 method for class 'estimatetables'
summary(object, ...)

## S3 method for class 'selectedstatistics'
summary(object, fields = c('n', 'mean',
'se'), dec = 5, alpha = 0.05, type = c('list','dataframe','array'), ...)

## S3 method for class 'selectedstatistics'
plot(x, scenarios, statistic, type =
c('hist', 'CI'), refline, xlab = NULL, ...)

header(object)

Arguments

object

object of class simulations from run.scenarios

dec

number of decimal places in output

fields

character vector; names of required summary statistics (see Details)

alpha

alpha level for confidence intervals and quantiles

type

character code for type of output (see Details)

...

other arguments – not currently used by summary but passed to hist by the plot method

x

object of class ‘selectedstatistics’ from run.scenarios

scenarios

integer indices of scenarios to plot (all plotted if not specified)

statistic

integer or character indices of the statistics in x for which histograms are requested

refline

logical; if TRUE a reference line is plotted at the true value of a parameter

xlab

character; optional label for x-axis

Details

If object inherits from ‘selectedstatistics’ then the numeric results from replicate simulations are summarized using the chosen ‘fields’ (by default, the number of non-missing values, mean and standard error), along with header information describing the simulations. Otherwise the header alone is returned.

fields is a vector of any selection from c(‘n’, ‘mean’, ‘sd’, ‘se’, ‘min’, ‘max’, ‘lcl’, ‘ucl’, ‘median’, ‘q’, ‘rms’, ‘var’), or the character value ‘all’.

Field ‘q’ provides 1000 alpha/2 and 1000[1 - alpha/2] quantiles qxxx and qyyy.

‘lcl’ and ‘ucl’ refer to the upper and lower limits of a 100(1 - alpha)% confidence interval for the statistic, across replicates.

‘rms’ gives the root-mean-square of the statistic - most useful for the statistic ‘ERR’ (see select.stats) when it represents the overall accuracy or RMSE.

The plot method plots either (i) histograms of the selected statistics (type = ‘hist’) or (ii) the estimate and confidence interval for each replicate (type = ‘CI’). The default for type = ‘hist’ is to plot the first statistic - this is usually ‘n’ (number of detected animals) when fit = FALSE, and ‘estimate’ (parameter estimate) when fit = TRUE. If length(statistic) > 1 then more than one plot will be produced, so a multi-column or multi-row layout should be prepared with par arguments ‘mfcol’ or ‘mfrow’.

For type = ‘CI’ the statistics must include ‘estimate’, ‘lcl’ and ‘ucl’ (or ‘beta’, ‘lcl’ and ‘ucl’ if outputtype = ‘coef’).

estimateSummary is a simpler approach that provides full output for models with groups or multiple sessions simulated in run.scenarios with extractfn predict or coef).

Value

List with components ‘header’

call

original function call

starttime

from object

proctime

from object

constants

small dataframe with values of non-varying inputs

varying

small dataframe with values of varying inputs

fit.args

small dataframe with values arguments for secr.fit, if specified

and ‘OUTPUT’, a list with one component for each field. Each component may be a list or an array.

See Also

run.scenarios, make.array, select.stats validate estimateSummary

Examples


## collect raw counts
scen1 <- make.scenarios(D = c(5,10), sigma = 25, g0 = 0.2)
traps1 <- make.grid()
tmp1 <- run.scenarios(nrepl = 50, trapset = traps1, scenarios = scen1,
    fit = FALSE)

opar <- par(mfrow=c(2,3))
plot(tmp1, statistic = 1:3)
par(opar)

summary(tmp1)

summary(tmp1, field=c('q025', 'median', 'q975'))


secrdesign documentation built on March 31, 2023, 10:25 p.m.