Title: | Generalized Mortality Estimator |
---|---|
Description: | Command-line and 'shiny' GUI implementation of the GenEst models for estimating bird and bat mortality at wind and solar power facilities, following Dalthorp, et al. (2018) <doi:10.3133/tm7A2>. |
Authors: | Daniel Dalthorp [aut, cre], Juniper Simonis [aut], Lisa Madsen [aut], Manuela Huso [aut], Paul Rabie [aut], Jeffrey Mintz [aut], Robert Wolpert [aut], Jared Studyvin [aut], Franzi Korner-Nievergelt [aut] |
Maintainer: | Daniel Dalthorp <[email protected]> |
License: | CC0 |
Version: | 1.4.9 |
Built: | 2025-02-11 04:43:23 UTC |
Source: | https://github.com/ddalthorp/genest |
Extract AICc values from pkm
, pkmSet
,
pkmSetSize
, cpm
, cpmSet
, and cpmSetSize
.
aicc(x, ...)
aicc(x, ...)
x |
Model or list of models to extract AICc values from. |
... |
further arguments passed to or from other methods |
list of models sorted by AICc
S3 function for generating AIC for cpm
objects
## S3 method for class 'cpm' aicc(x, ...)
## S3 method for class 'cpm' aicc(x, ...)
x |
Carcass persistence model ( |
... |
further arguments passed to or from other methods |
AIC, AICc vector
data(wind_RP) mod <- cpm(formula_l = l ~ Season, formula_s = s ~ Season, data = wind_RP$CP, left = "LastPresent", right = "FirstAbsent") aicc(mod)
data(wind_RP) mod <- cpm(formula_l = l ~ Season, formula_s = s ~ Season, data = wind_RP$CP, left = "LastPresent", right = "FirstAbsent") aicc(mod)
S3 function to generate model comparison tables based on AICc
values for a set of CP models generated by cpmSet
## S3 method for class 'cpmSet' aicc(x, ..., quiet = FALSE, app = FALSE)
## S3 method for class 'cpmSet' aicc(x, ..., quiet = FALSE, app = FALSE)
x |
Set of carcass persistence models fit to the same observations |
... |
further arguments passed to or from other methods |
quiet |
Logical indicating if messages should be printed |
app |
Logical indicating if the table should have the app model names |
AICc table
data(wind_RP) mod <- cpmSet(formula_l = l ~ Season * Visibility, formula_s = s ~ Season, data = wind_RP$CP, left = "LastPresent", right = "FirstAbsent") aicc(mod)
data(wind_RP) mod <- cpmSet(formula_l = l ~ Season * Visibility, formula_s = s ~ Season, data = wind_RP$CP, left = "LastPresent", right = "FirstAbsent") aicc(mod)
S3 function to generate model comparison tables for lists of
of sets of CP models of class cpmSetSize
## S3 method for class 'cpmSetSize' aicc(x, ...)
## S3 method for class 'cpmSetSize' aicc(x, ...)
x |
List of sets of CP models fit to the same observations |
... |
further arguments passed to or from other methods |
AICc table
cpmods <- cpm(formula_l = l ~ Visibility, data = wind_RP$CP, left = "LastPresent", right = "FirstAbsent", sizeCol = "Size", allCombos = TRUE) aicc(cpmods)
cpmods <- cpm(formula_l = l ~ Visibility, data = wind_RP$CP, left = "LastPresent", right = "FirstAbsent", sizeCol = "Size", allCombos = TRUE) aicc(cpmods)
extract AICc value from pkm object
## S3 method for class 'pkm' aicc(x, ...)
## S3 method for class 'pkm' aicc(x, ...)
x |
object of class |
... |
further arguments passed to or from other methods |
Data frame with the formulas for p and k and the AICc of the model
Generates model comparison tables based on AICc values for
a set of pk models generated by pkmSet
## S3 method for class 'pkmSet' aicc(x, ..., quiet = FALSE, app = FALSE)
## S3 method for class 'pkmSet' aicc(x, ..., quiet = FALSE, app = FALSE)
x |
Set of searcher efficiency models fit to the same observations |
... |
further arguments passed to or from other methods |
quiet |
Logical indicating if messages should be printed |
app |
Logical indicating if the table should have the app model names |
AICc table
data(wind_RP) mod <- pkmSet(formula_p = p ~ Season, formula_k = k ~ Season, data = wind_RP$SE) aicc(mod)
data(wind_RP) mod <- pkmSet(formula_p = p ~ Season, formula_k = k ~ Season, data = wind_RP$SE) aicc(mod)
Generates model comparison tables based on AICc values for
a set of pk models generated by pkm
with
allCombos = TRUE
and a non-NULL
sizeCol
.
## S3 method for class 'pkmSetSize' aicc(x, ...)
## S3 method for class 'pkmSetSize' aicc(x, ...)
x |
List of set of searcher efficiency models fit to the same observations |
... |
further arguments passed to or from other methods |
AICc table
data(wind_RP) mod <- pkmSet(formula_p = p ~ Season, formula_k = k ~ Season, data = wind_RP$SE) aicc(mod)
data(wind_RP) mod <- pkmSet(formula_p = p ~ Season, formula_k = k ~ Season, data = wind_RP$SE) aicc(mod)
Generates model comparison tables based on AICc values for
a set of pk models generated by pkm
with
allCombos = FALSE
and a non-NULL
sizeCol
.
## S3 method for class 'pkmSize' aicc(x, ...)
## S3 method for class 'pkmSize' aicc(x, ...)
x |
List of set of searcher efficiency models fit to the same observations |
... |
further arguments passed to or from other methods |
AICc table
data(wind_RP) mod <- pkmSet(formula_p = p ~ Season, formula_k = k ~ Season, data = wind_RP$SE) aicc(mod)
data(wind_RP) mod <- pkmSet(formula_p = p ~ Season, formula_k = k ~ Season, data = wind_RP$SE) aicc(mod)
HTML generators for app information and content
disclaimerUSGS
creates the text for the USGS
disclaimer.
createvtext(type = "Full") gettingStartedContent() aboutContent() GenEstAuthors() GenEstGUIauthors() GenEstLicense() GenEstAcknowledgements() GenEstLogos() disclaimersContent(appType = "base") disclaimerUSGS() disclaimerWEST(appType)
createvtext(type = "Full") gettingStartedContent() aboutContent() GenEstAuthors() GenEstGUIauthors() GenEstLicense() GenEstAcknowledgements() GenEstLogos() disclaimersContent(appType = "base") disclaimerUSGS() disclaimerWEST(appType)
type |
"Full" or "Short" or "Name" or "NameDate" |
appType |
"base" (for local version) or "deploy" (for hosted version) |
Panels and text for displaying general information about GenEst
Handle downloading of app data and figures
downloadCPFig(rv) downloadCPmod(rv, input) downloadSEFig(rv) downloadSEmod(rv, input) downloadgFig(rv, sc) downloadMres(rv, input) downloadMFig(rv, split = TRUE) downloadTable(filename, tablename, csvformat) downloadgres(rv, input)
downloadCPFig(rv) downloadCPmod(rv, input) downloadSEFig(rv) downloadSEmod(rv, input) downloadgFig(rv, sc) downloadMres(rv, input) downloadMFig(rv, split = TRUE) downloadTable(filename, tablename, csvformat) downloadgres(rv, input)
rv |
the reactive values list |
input |
list of shiny input parameters |
sc |
size class |
split |
logical indicator to use the split or not |
filename |
the name for the file writing out |
tablename |
the name of the table in the rv list |
csvformat |
format for .csv file: "" or NULL for comma-separated, 2 for semi-colon separated |
download handler functions
lists of messages used in the app
msgList() clearNotifications(msgs = msgList(), clear = TRUE) msgModRun(msgs, modelType, clear = TRUE) msgModDone(msgs, rv, type = "SE", clear = TRUE) msgModPartialFail(mods, type = "SE") msgSampleSize(mods) msgModWarning(mods, type = "SE", rv = NULL) msgModSENobs(rv) msgModFail(mods, type = "SE", special = NULL) msgSSavgFail(msgs, rv, clear = TRUE) msgSSinputFail(msgs, rv, clear = TRUE) msgSplitFail(type = NULL) msgFracNote(fracNote)
msgList() clearNotifications(msgs = msgList(), clear = TRUE) msgModRun(msgs, modelType, clear = TRUE) msgModDone(msgs, rv, type = "SE", clear = TRUE) msgModPartialFail(mods, type = "SE") msgSampleSize(mods) msgModWarning(mods, type = "SE", rv = NULL) msgModSENobs(rv) msgModFail(mods, type = "SE", special = NULL) msgSSavgFail(msgs, rv, clear = TRUE) msgSSinputFail(msgs, rv, clear = TRUE) msgSplitFail(type = NULL) msgFracNote(fracNote)
msgs |
message list |
clear |
logical indicator if clearing should happen. |
modelType |
"SE", "CP", "g", or "M" |
rv |
reactive values list |
type |
"SE", "CP", "M", "split", or "g" |
mods |
Set Size list of models |
special |
indicator of a special type of message |
fracNote |
the note regarding the input |
app utilities for formatting text, tables, figs, etc. for display
classText(rv, type = "SE") estText(rv, type = "SE") setNotSuspending(output, dontSuspend) reNULL(x, toNULL) initialOutput(rv, output) setFigW(modelSet) setFigH(modelSet, modType = "SE")
classText(rv, type = "SE") estText(rv, type = "SE") setNotSuspending(output, dontSuspend) reNULL(x, toNULL) initialOutput(rv, output) setFigW(modelSet) setFigH(modelSet, modType = "SE")
rv |
Reactive values list for the GenEst GUI. |
type |
Model type, either "SE" or "CP" or "g". |
output |
|
dontSuspend |
Names of elements in |
x |
|
toNULL |
Names of elements in |
modelSet |
Model set of class |
modType |
"SE" or "CP" |
functions for formatting and displaying app panels
dataTabPanel(dataType) selectedDataPanel(modType) modelOutputPanel(outType)
dataTabPanel(dataType) selectedDataPanel(modType) modelOutputPanel(outType)
dataType |
Toggle control for the model type of the panel. One of "SE", "CP", "SS", "DWP", or "CO". |
modType |
Toggle control for the model type of the panel. One of "SE", "CP", or "g". |
outType |
Toggle control for the model type of the panel. One of "SEFigures", "SEEstimates", "SEModComparison", "SEModSelection", "CPFigures", "CPEstimates", "CPModComparison", "CPModSelection", "gFigures", or "gSummary". |
This suite of functions defines the server-side program for
the GenEst user interface (UI). See the "GenEst Graphic User Interface"
vignette for a more complete detailing of the codebase underlying
the GenEst UI. GenEstServer
: main server function
expressed within the application.
GenEstServer(input, output, session) reaction(eventName) reactionMessageRun(eventName) reactionMessageDone(eventName) eventReaction(eventName, rv, input, output, session)
GenEstServer(input, output, session) reaction(eventName) reactionMessageRun(eventName) reactionMessageDone(eventName) eventReaction(eventName, rv, input, output, session)
input |
|
output |
|
session |
Environment for the GenEst GUI. |
eventName |
Character name of the event. One of "clear_all", "file_SE", "file_SE_clear", "file_CP", "file_CP_clear", "file_SS", "file_SS_clear", "file_DWP", "file_DWP_clear", "file_CO", "file_CO_clear", "class", "obsSE", "predsSE", "run_SE", "run_SE_clear", "outSEclass", "outSEp", "outSEk", "ltp", "fta", "predsCP", "run_CP", "run_CP_clear", "outCPclass", "outCPdist", "outCPl", "outCPs", "run_M", "run_M_clear", "split_M", "split_M_clear", "transpose_split", "run_g", "run_g_clear", or "outgclass". |
rv |
reactive variable |
GenEstServer
is used as the main server function, and is
therefore included in the server.R
script of the app. This
function is not used in a standard R function sense, in that it does
not return a value and is not used on its own to have side effects.
The code of the function has two parts:
preamble that defines all the necessary variables and options
observeEvent
calls, one for each event in
the application. Each call to observeEvent
includes the eventExpr
(event expression) as the first
argument and the handlerExpr
(handler expression) as the
second argument, which is an evaluated (via eval
)
block of code returned from reaction
for the specific
event, as well as any other control switch arguments needed (such as
ignoreNULL
).
This suite of functions in app_ui.R
create the HTML code
underlying the GenEst user interface (UI). See the "GenEst Graphic User
Interface" vignette for a more complete detailing of the codebase underlying
the GenEst UI. GenEstUI
: whole application. Calls
dataInputPanel
, analysisPanel
, and helpPanel
.
GenEstUI(appType = "base") dataInputPanel() dataInputSidebar() loadedDataPanel() analysisPanel() GeneralInputsPanel() GeneralInputSidebar() SEPanel() SESidebar() SEMainPanel() CPPanel() CPSidebar() CPMainPanel() MPanel() MSidebar() MMainPanel() gPanel() gSidebar() gMainPanel() helpPanel(appType = "base") gettingStartedPanel() downloadsPanel() aboutPanel() disclaimersPanel(appType = "base")
GenEstUI(appType = "base") dataInputPanel() dataInputSidebar() loadedDataPanel() analysisPanel() GeneralInputsPanel() GeneralInputSidebar() SEPanel() SESidebar() SEMainPanel() CPPanel() CPSidebar() CPMainPanel() MPanel() MSidebar() MMainPanel() gPanel() gSidebar() gMainPanel() helpPanel(appType = "base") gettingStartedPanel() downloadsPanel() aboutPanel() disclaimersPanel(appType = "base")
appType |
Toggle control for the app, |
Currently there are few differences between the local and deployed
versions of GenEst, and the appType
toggle is only included as an
argument for functions that can produce different versions of the HTML.
At this point, the only content that is different is the disclaimer text
on the Help panel.
Each function returns a string of HTML code, either as a
"shiny.tag.list"
object (in the case of GenEstUI
) or a
"shiny.tag"
object (in the case of the other functions). GenEstUI
: Full GenEst user interface.
utility functions for simple HTML tasks
navbar() style(...) ol(...) ul(...) li(...) b(...) u(...) small(...) big(text = NULL) center(text = NULL) GenEstInlineCSS(...) GenEstShinyJS(...) cButtonStyle(buttonType = "single")
navbar() style(...) ol(...) ul(...) li(...) b(...) u(...) small(...) big(text = NULL) center(text = NULL) GenEstInlineCSS(...) GenEstShinyJS(...) cButtonStyle(buttonType = "single")
... |
attributes and children of the element |
text |
text to wrap in the tag |
buttonType |
"single" (for clearing a single component) or "all" (for clearing everything). |
utility functions for simple app rv management
initialReactiveValues() reVal(rv, toReVal) setkNeed(rv) updateColNames_size(rv) selectData(data, cols) modNameSplit(modNames, pos) prepSizeclassText(sizeclasses) modNamePaste(parts, type = "SE", tab = FALSE) plotNA(type = "model") updateSizeclasses(data, sizeCol) pickSizeclass(sizeclasses, choice) updatesizeCol(sizeCol, colNames_size)
initialReactiveValues() reVal(rv, toReVal) setkNeed(rv) updateColNames_size(rv) selectData(data, cols) modNameSplit(modNames, pos) prepSizeclassText(sizeclasses) modNamePaste(parts, type = "SE", tab = FALSE) plotNA(type = "model") updateSizeclasses(data, sizeCol) pickSizeclass(sizeclasses, choice) updatesizeCol(sizeCol, colNames_size)
rv |
Reactive values list for the GenEst GUI, created by
|
toReVal |
Names of elements in |
data |
data table |
cols |
column names to select |
modNames |
names of the model to be split off |
pos |
position in the name to split off |
sizeclasses |
names of the carcass classes |
parts |
the component parts of the model's name |
type |
"SE" or "CP" |
tab |
logical for if it's the table output for CP |
sizeCol |
carcass class column name |
choice |
carcass class chosen |
colNames_size |
updated vector of size column names in all needed tables |
This is a generalized function for creating a data input
widget used in the GenEst GUI, based on the data type (dataType
).
Included within the widget is a conditional panel that allows removal of
the specific data file (and clearing of all downstream models) once
it has been loaded.
dataInputWidget(dataType) dataDownloadWidget(set) modelInputWidget(inType) widgetMaker(Condition, Name, Fun, Label, Args) modelRunWidget(modType) preTextMaker(modType) modelOutputWidget(modType) splitButtonWidget() modelSelectionWidget(mods, modType) modelSelectionWidgetHeader(mods) modelSelectionWidgetRow(mods, modType, sci) kFixedWidget(sizeclasses) kFixedWidgetHeader(sizeclasses) kFixedWidgetRow(sizeclasses, sci)
dataInputWidget(dataType) dataDownloadWidget(set) modelInputWidget(inType) widgetMaker(Condition, Name, Fun, Label, Args) modelRunWidget(modType) preTextMaker(modType) modelOutputWidget(modType) splitButtonWidget() modelSelectionWidget(mods, modType) modelSelectionWidgetHeader(mods) modelSelectionWidgetRow(mods, modType, sci) kFixedWidget(sizeclasses) kFixedWidgetHeader(sizeclasses) kFixedWidgetRow(sizeclasses, sci)
dataType |
Toggle control for the model type of the widget. One of "SE", "CP", "SS", "DWP", or "CO". |
set |
Name of data set. One of "RP", "RPbat", "cleared", "powerTower", "PV", "trough", "mock" |
inType |
Toggle control for the input type of the widget. One of "nsim", "CL", "class", "obsSE", "predsSE", "kFixed", "ltp", "fta", "predsCP", "dist", "xID", "frac", "DWPCol", "COdate", "gSearchInterval", or "gSearchMax". |
Condition |
Condition under which the widget is present to the user. |
Name |
Name (id) of the widget created. |
Fun |
Function name (as character) used to create the widget. |
Label |
Label presented to the user in the UI for the widget. |
Args |
List of any additional arguments to be passed to the widget creating function. |
modType |
Toggle control for the model type of the widget. One of "SE", "CP", "M", or "g". |
mods |
Model Set Size object (from the reactive values list). |
sci |
Name of carcass class element |
sizeclasses |
Vector of carcass class names (from the reactive values list). |
HTML for the data input widget.
Given a multi-unit Search Schedule data table, produce an average search schedule for use in generic detection probability estimation.
averageSS(data_SS, SSdate = NULL)
averageSS(data_SS, SSdate = NULL)
data_SS |
a multi-unit SS data table, for which the average interval
will be tabulated. It is assumed that |
SSdate |
Column name for the date searched data (optional).
if no |
vector of the average search schedule
data(mock) avgSS <- averageSS(mock$SS)
data(mock) avgSS <- averageSS(mock$SS)
Calculate detection probability (g) given SE and CP parameters and a search schedule.
The g given by calcg
is a generic aggregate detection
probability and represents the probability of detecting a carcass that
arrives at a (uniform) random time during the time spanned by the search
schedule for the the given SE and CP parameters. This differs from the GenEst
estimation of g when the purpose is to estimate total mortality (M), in
which case the detection probability varies with carcass arrival interval
and is difficult to summarize statistically. calcg
provides a
useful "big picture" summary of detection probability, but would be
difficult to work with for estimating M with precision.
calcg(days, param_SE, param_CP, dist)
calcg(days, param_SE, param_CP, dist)
days |
Search schedule (vector of days searched) |
param_SE |
numeric array of searcher efficiency parameters (p and k);
must have the name number of rows as the |
param_CP |
numeric array of carcass persistence parameters (a and b)
must have the name number of rows as the |
dist |
distribution for the CP model |
a vector of detection probabilities for each
A carcass that is observed in a given search may have arrived
at any time prior to that search, so carcass discovery time is often not
a reliable estimate of carcass arrival time. For each observed carcass,
calcRate
takes into account the estimated probability of arrival
in each possible arrival interval, adjusts by detection probability, and
sums to estimate the estimated number of carcass arrivals in every search
interval.
calcRate(M, Aj, days = NULL, searches_carcass = NULL, data_SS = NULL)
calcRate(M, Aj, days = NULL, searches_carcass = NULL, data_SS = NULL)
M |
Numeric array (ncarc x nsim) of estimated number of fatalities by observed carcass and simulation rep |
Aj |
Integer array (ncarc x nsim) of simulated arrival intervals for each observed carcass. Arrival intervals are given as integers j, indicating that the given carcass (indexed by row) arrived in the jth search interval in the given simulation rep (indexed by column). Arrival interval indices (j) are relative to indexed carcasses' search schedules. |
days |
Vector of all dates that at least one unit was searched. Format is the number of days since the first search. For example, days = c(0, 7, 14, 28, 35) for a simple 7-day search schedule in which searches were conducted every once per week on the same day for 5 weeks. Not all units need be searched on every search date. |
searches_carcass |
An ncarc x length(days) array of 0s and 1s to
indicate searches in which the indexed carcass could have been found.
For example, row i = |
data_SS |
|
Numeric array (nsim x nsearch) of estimated fatalities in each
search interval. NOTE: The search at time t = 0 does not correspond to an
interval, and all carcasses found at that time are assumed to have
arrived prior to the monitoring period and are not included in mortality
estimates so nsearch = length(days) - 1
.
Total mortality can be split into sub-categories, according to
various splitting covariates such as species, visibility class, season,
site, unit, etc. Given the carcass search data, estimated mortalities,
and splitting covariates, calcSplits()
gives the "splits" or
summaries the estimated mortalities by levels of the splitting
covariates. For example, user may specify "season"
and
"species"
as splitting variables to see estimated mortalities by
season and species. Input would be arrays of estimated mortalities and
arrival intervals when ncarc
carcass have been discovered and
uncertainty in mortality estimates is captured via simulation with
nsim
simulation draws.
calcSplits( M, split_CO = NULL, data_CO = NULL, split_SS = NULL, data_SS = NULL, split_time = NULL, ... )
calcSplits( M, split_CO = NULL, data_CO = NULL, split_SS = NULL, data_SS = NULL, split_time = NULL, ... )
M |
|
split_CO |
Character vector of names of splitting covariates to be
found in the |
data_CO |
data frame that summarizes the carcass search data and must
include columns specified by the |
split_SS |
Character string giving the name of a splitting covariate
in the |
data_SS |
Search schedule data |
split_time |
Numeric vector that defines time intervals for splits.
Times must be numeric, strictly increasing, and span the monitoring period
[0, |
... |
arguments to be passed down |
Arrival intervals (Aj
) are given as integers, j, that
indicate which search interval the given carcass (indexed by row) arrived
in the given simulation draw (indexed by column). Arrival interval indices
(j) are relative to indexed carcasses' search schedules.
No more than two splitting variables (split_CO
, split_SS
,
and split_time
) in total may be used. split_CO
variables
describe qualitative characteristics of the observed carcasses or where
they were found. Some examples include searcher (DHD, JPS, MMH), carcass
size (S, M, L), species, age (fresh/dry or immature/mature), unit,
visibility class (easy, moderate, difficult), etc.
split_SS
variables describe characteristics of the search intervals,
such as season (spring, summer, fall, winter) or treatment
(pre- or post-minimization). Each search interval is assigned a level of
the split_SS
variable. For example, for a search schedule with
5 searches (including a search at t = 0), and the split_SS
variable would have values for each of the 4 search intervals. The
levels of the split_SS
must be in contiguous blocks. For example,
season = c("S", "S", "F", "F")
would be acceptable, but
season = c("S", "F", "S", "F")
would not be.
split_time
variables are numeric vectors that split the monitoring
period into distinct time intervals. For example,
split_time = c(0, 30, 60, 90, 120)
would split the 120 monitoring
period into 30-day intervals, and calcSplits()
would return
mortality estimates for each of the intervals.
An object of class splitFull
is returned. If one splitting
covariate is given, then the output will be an array of estimated
mortality in each level of the splitting covariate, with one row for each
covariate level and one column for each simulation draw. If two splitting
covariates are given, output will be a list of arrays. Each array gives
the estimated mortalities for one level of the second splitting covariate
and all levels of the first splitting covariate.
Objects of class splitFull
have attributes vars
(which gives
the name of the splitting covariate(s)) and type
(which specifies
whether the covariate(s) are of type split_CO
, split_SS
, or
split_time
). A summary of a resulting splitFull
object
is returned from the S3 function summary(splits, CL = 0.90, ...)
,
which gives the mean and a 5-number summary for each level of each
covariate. The 5-number summary includes the alpha/2, 0.25, 0.5, 0.75,
and 1 - alpha/2 quantiles, where alpha = 1 - CL. A graph summarizing the
results can be drawn using plot(splits, CL, ...)
, which gives
a graphical representation of the summary
.
model_SE <- pkm(p ~ 1, k ~ 1, data = wind_RPbat$SE) model_CP <- cpm(l ~ 1, s ~ 1, data = wind_RPbat$CP, dist = "weibull", left = "LastPresent", right = "FirstAbsent") Mhat <- estM(nsim = 1000, data_CO = wind_RPbat$CO, data_SS = wind_RPbat$SS, data_DWP = wind_RPbat$DWP, model_SE = model_SE, model_CP = model_CP, unitCol = "Turbine", COdate = "DateFound") M_spp <- calcSplits(M = Mhat, split_CO = "Species", data_CO = wind_RPbat$CO) summary(M_spp) plot(M_spp)
model_SE <- pkm(p ~ 1, k ~ 1, data = wind_RPbat$SE) model_CP <- cpm(l ~ 1, s ~ 1, data = wind_RPbat$CP, dist = "weibull", left = "LastPresent", right = "FirstAbsent") Mhat <- estM(nsim = 1000, data_CO = wind_RPbat$CO, data_SS = wind_RPbat$SS, data_DWP = wind_RPbat$DWP, model_SE = model_SE, model_CP = model_CP, unitCol = "Turbine", COdate = "DateFound") M_spp <- calcSplits(M = Mhat, split_CO = "Species", data_CO = wind_RPbat$CO) summary(M_spp) plot(M_spp)
calcTsplit()
is a lower-level function that requires
the output of calcRate
as input. See calcSplits
for a more powerful, convenient, and flexible alternative.
calcTsplit(rate, days, tsplit)
calcTsplit(rate, days, tsplit)
rate |
Array (nsim x nsearch) of arrival rates as number of fatalities
per search interval. Typically, |
days |
A vector of times representing search dates when at least one unit was searched. Times are formatted as number of days since the first search, e.g., c(0, 7, 14, 28, 35) would indicate a schedule in at least one unit was searched every 7 days. |
tsplit |
A vector of times that splits the monitoring period into a
set of time intervals for which |
A numeric array with dimensions
dim = c(length(tsplit) - 1, nsim)
giving the estimated number of
fatalities that occured in each time interval.
Check if all component terms and interactions are included in a formula. Terms are automatically alphabatized within interactions.
checkComponents(formula)
checkComponents(formula)
formula |
A formula object |
a logical regarding complete set of terms and interactions
Checks whether the dates are in a standard format and sensible. If so, function returns the dates converted to ISO 8601 yyyy-mm-dd format. Acceptable formats are yyyy-mm-dd, yyyy/mm/dd, mm/dd/yyyy, and dd/mm/yyyy. If format is mm/dd/yyyy or dd/mm/yyyy, the dates must be interpretable unambiguously. Also, dates must be later than 1900-01-01. This additional check provides some protection against common data entry errors like entering a year as 0217 or 1017 instead of 2017.
checkDate(testdate)
checkDate(testdate)
testdate |
Date(s) to check and format. |
dates formatted as yyyy-mm-dd (if possible) or NULL (if some value is not interpretable as a date after 1900-01-01).
checkDate("02/20/2018") checkDate("10/08/2018")
checkDate("02/20/2018") checkDate("10/08/2018")
Make sure it's available and good, update the name for usage
checkSpecificModelCP(modelSet, specificModel)
checkSpecificModelCP(modelSet, specificModel)
modelSet |
cp model set of class cpmSet |
specificModel |
the name of the specific model for the plot |
updated name of the model to use
Make sure it's available and good, update the name for usage
checkSpecificModelSE(modelSet, specificModel)
checkSpecificModelSE(modelSet, specificModel)
modelSet |
pk model set of class pkmSet |
specificModel |
the name of the specific model for the plot |
updated name of the model to use
Calculate the conditional probability of observing a carcass at search oi as a function arrival interval (assuming carcass is not removed by scavengers before the time of the final search)
CO_DWP(dwpsim, data_CO, unitCol, sizeCol = NULL)
CO_DWP(dwpsim, data_CO, unitCol, sizeCol = NULL)
dwpsim |
|
data_CO |
data frame with results from carcass surveys |
unitCol |
name of the unit column in data_CO (required) |
sizeCol |
name of the carcass class column in data_CO (optional). |
numeric DWP array
Create a table of combinations of factor levels for the
the predictors in a searcher efficiency or carcass persistence analysis.
This is a utility function called by pkm0
and cpm0
.
combinePreds(preds, data)
combinePreds(preds, data)
preds |
Vector of character strings with the names of predictor variables included in the model. |
data |
Searcher efficiency or carcass persistence data frame with columns for each predictor and rows corresponding to carcasses in the field trials. |
Data frame with columns for each predictor in preds
and rows
for each factor level combination among the predictors. In addition there is
a column with CellNames
, which are the combinations of predictor
levels separated by periods ( . ).
Create a table of factor combinations of predictors in given searcher efficiency and carcass persistence models. This is a utility function called by estgGeneric and governs the cells for which detection probabilities are calculated.
combinePredsAcrossModels(preds_CP, preds_SE, data_CP, data_SE)
combinePredsAcrossModels(preds_CP, preds_SE, data_CP, data_SE)
preds_CP |
Character vector with names of carcass persistence predictors. |
preds_SE |
Character vector with names of searcher efficiency predictors. |
data_CP |
data frame with columns for each predictor and rows corresponding to carcasses in the field trials. |
data_SE |
data frame with columns for each predictor and rows corresponding to carcasses in the field trials. |
Data frame with columns for each predictor in preds
and rows
for each factor level combination among the predictors. In addition there
are column with CellNames
, CellNames_CP
, and
CellNames_SE
, which are the combinations of predictor levels for all
predictors, CP predictors, and SE predictors (respectively), separated by
periods ( . ).
Count the minimum number of carcasses in all of the cells
within a _SetSize
model complex
countCarcs(mods)
countCarcs(mods)
mods |
model output from the |
the minimum number of carcasses in the cells
Produce a named vector of standard CP plot colors
CPcols()
CPcols()
Simply make the named list for the disributions in the CP model
CPdistOptions()
CPdistOptions()
list with named elements of the distributions
The function used to calculate the negative-loglikelihood of
a given carcass persistence model (cpm
) with a given data
set
cpLogLik(t1, t2, beta, nbeta_l, cellByCarc, cellMM, dataMM, dist)
cpLogLik(t1, t2, beta, nbeta_l, cellByCarc, cellMM, dataMM, dist)
t1 |
last times observed present |
t2 |
first times observed absent |
beta |
Parameters to be optimized. |
nbeta_l |
Number of parameters associated with l. |
cellByCarc |
Which cell each observation belongs to. |
cellMM |
Combined model matrix. |
dataMM |
Combined model matrix expanded to the data. |
dist |
Name of distribution. |
Negative log likelihood of the observations, given the parameters.
Carcass persistence is modeled as survival function where the
one or both parameter(s) can depend on any number of covariates. Format
and usage parallel that of common R
functions such as lm
,
glm
, and gam
. However, the input data (data
) are
structured differently to accommodate the survival model approach (see
"Details"), and model formulas may be entered for both l
("location") and s
("scale").
cpm( formula_l, formula_s = NULL, data, left, right, dist = "weibull", allCombos = FALSE, sizeCol = NULL, CL = 0.9, quiet = FALSE ) cpm0( formula_l, formula_s = NULL, data = NULL, left = NULL, right = NULL, dist = "weibull", CL = 0.9, quiet = FALSE ) cpmSet( formula_l, formula_s = NULL, data, left, right, dist = c("exponential", "weibull", "lognormal", "loglogistic"), CL = 0.9, quiet = FALSE ) cpmSize( formula_l, formula_s = NULL, data, left, right, dist = c("exponential", "weibull", "lognormal", "loglogistic"), sizeCol = NULL, allCombos = FALSE, CL = 0.9, quiet = FALSE )
cpm( formula_l, formula_s = NULL, data, left, right, dist = "weibull", allCombos = FALSE, sizeCol = NULL, CL = 0.9, quiet = FALSE ) cpm0( formula_l, formula_s = NULL, data = NULL, left = NULL, right = NULL, dist = "weibull", CL = 0.9, quiet = FALSE ) cpmSet( formula_l, formula_s = NULL, data, left, right, dist = c("exponential", "weibull", "lognormal", "loglogistic"), CL = 0.9, quiet = FALSE ) cpmSize( formula_l, formula_s = NULL, data, left, right, dist = c("exponential", "weibull", "lognormal", "loglogistic"), sizeCol = NULL, allCombos = FALSE, CL = 0.9, quiet = FALSE )
formula_l |
Formula for location; an object of class
" |
formula_s |
Formula for scale; an object of class
" |
data |
Data frame with results from carcass persistence trials and any
covariates included in |
left |
Name of columns in |
right |
Name of columns in |
dist |
Distribution name ("exponential", "weibull", "loglogistic", or "lognormal") |
allCombos |
logical. If |
sizeCol |
character string. The name of the column in |
CL |
confidence level |
quiet |
Logical indicator of whether or not to print messsages |
The probability of a carcass persisting to a particular time is
dictated by the specific distribution chosen and its underlying location
(l) and scale (s) parameters (for all models except the exponential,
which only has a location parameter). Both l
and s
may
depend on covariates such as ground cover, season, species, etc., and a
separate model format (formula_l
and formula_s
) may be
entered for each. The models are entered as they would be in the familiar
lm
or glm
functions in R. For example, l
might vary
with A
, B
, and C
, while k
varies only with
A
. A user might then enter p ~ A + B + C
for formula_l
and k ~ A
for formula_s
. Other R conventions for defining
formulas may also be used, with A:B
for the interaction between
covariates A and B and A * B
as short-hand for A + B + A:B
.
Carcass persistence data
must be entered in a data frame with data
in each row giving the fate of a single carcass in the trials. There
must be a column for each of the last time the carcass was observed
present and the first time the carcass was observed absent (or NA if the
carcass was always present). Additional columns with values for
categorical covariates (e.g., visibility = E, M, or D) may also be
included.
an object of an object of class cpm
, cpmSet
,
cpmSize
, or cpmSetSize
.
cpm0()
returns a cpm
object, which is a description
of a single, fitted pk model. Due to the large number and complexity of
components of acpm
model, only a subset of them is printed
automatically; the rest can be viewed/accessed via the $
operator
if desired. These are described in detail in the 'cpm
Components'
section.
cpmSet()
returns a list of cpm
objects, one for each
of the submodels, as described with parameter allCombos = TRUE
.
cpmSize()
returns a list of cpmSet
objects (one for
each 'size') if allCombos = T
, or a list of cpm
objects (one
for each 'size') if allCombos = T
cpm
returns a cpm
, cpmSet
, cpmSize
, or
cpmSetSize
object:
cpm
object if allCombos = FALSE, sizeCol = NULL
cpmSet
object if allCombos = TRUE, sizeCol = NULL
cpmSize
object if allCombos = FALSE, sizeCol != NULL
cpmSetSize
object if allCombos = TRUE, sizeCol != NULL
cpm
ComponentsThe following components of a cpm
object are displayed automatically:
call
the function call to fit the model
formula_l
the model formula for the p
parameter
formula_s
the model formula for the k
parameter
distribution
distribution used
predictors
list of covariates of l
and/or s
AICc
the AIC value as corrected for small sample size
convergence
convergence status of the numerical optimization
to find the maximum likelihood estimates of p
and k
. A
value of 0
indicates that the model was fit successfully. For
help in deciphering other values, see optim
.
cell_ls
summary statistics for estimated cellwise
l
and s
, including the medians and upper & lower bounds
on CIs for each parameter, indexed by cell (or combination of
covariate levels).
cell_ab
summary statistics for estimated cellwise
pda
and pdb
, including the medians and upper & lower
bounds on CIs for each parameter, indexed by cell (or combination of
covariate levels).
cell_desc
Descriptive statistics for estimated cellwise median persistence time and rI for search intervals of 1, 3, 7 14, and 28 days, where rI is the probability of that carcass that arrives at a uniform random time in within a search interval of I days persists until the first search after arrival.
The following components are not printed automatically but can be accessed
via the $
operator:
data
the data used to fit the model
betahat_l
parameter estimates for the terms in the
regression model for for l
betahat_s
parameter estimates for the terms in the
regression model for for s
. If dist = "exponential", s
is set at 1 and not calculated.
varbeta
the variance-covariance matrix of the estimators
for c(betahat_l, betahat_s
.
cellMM_l
a cellwise model (design) matrix for covariate
structure of l_formula
cellMM_s
a cellwise model(design) matrix for covariate
structure of s_formula
levels_l
all levels of each covariate of l
levels_s
all levels of each covariate of s
nbeta_l
number of parameters fit for l
nbeta_s
number of parameters fit for s
cells
cell structure of the cp-model, i.e., combinations of
all levels for each covariate of p
and k
. For example, if
covar1
has levels "a"
, "b"
, and "c"
, and
covar2
has levels "X"
and "Y"
, then the cells
would consist of a.X
, a.Y
, b.X
, b.Y
,
c.X
, and c.Y
.
ncell
total number of cells
predictors_l
list of covariates of l
predictors_s
list of covariates of s
observations
observations used to fit the model
carcCells
the cell to which each carcass belongs
AIC
the AIC value for the fitted model
CL
the input CL
cpmSize
may also be used to fit a single model for each size class if
allCombos = FALSE
. To do so, formula_l
, formula_s
, and
dist
be named lists with names matching the sizes listed in
unique(data[, sizeCol])
. The return value is then a list of
cpm
objects, one for each size.
head(data(wind_RP)) mod1 <- cpm(formula_l = l ~ Season, formula_s = s ~ 1, data = wind_RP$CP, left = "LastPresent", right = "FirstAbsent") class(mod1) mod2 <- cpm(formula_l = l ~ Season, formula_s = s ~ 1, data = wind_RP$CP, left = "LastPresent", right = "FirstAbsent", allCombos = TRUE) class(mod2) names(mod2) class(mod2[[1]]) mod3 <- cpm(formula_l = l ~ Season, formula_s = s ~ 1, data = wind_RP$CP, left = "LastPresent", right = "FirstAbsent", allCombos = TRUE, sizeCol = "Size") class(mod3) names(mod3) class(mod3[[1]]) class(mod3[[1]][[1]])
head(data(wind_RP)) mod1 <- cpm(formula_l = l ~ Season, formula_s = s ~ 1, data = wind_RP$CP, left = "LastPresent", right = "FirstAbsent") class(mod1) mod2 <- cpm(formula_l = l ~ Season, formula_s = s ~ 1, data = wind_RP$CP, left = "LastPresent", right = "FirstAbsent", allCombos = TRUE) class(mod2) names(mod2) class(mod2[[1]]) mod3 <- cpm(formula_l = l ~ Season, formula_s = s ~ 1, data = wind_RP$CP, left = "LastPresent", right = "FirstAbsent", allCombos = TRUE, sizeCol = "Size") class(mod3) names(mod3) class(mod3[[1]]) class(mod3[[1]][[1]])
Produce the figure panel for a specific cell (factor level combination) including the specific fitted decay curves.
cpmCPCellPlot(model, specificCell, col, axis_y = TRUE, axis_x = TRUE)
cpmCPCellPlot(model, specificCell, col, axis_y = TRUE, axis_x = TRUE)
model |
model of class cpm |
specificCell |
name of the specific cell to plot |
col |
color to use |
axis_y |
logical of whether or not to plot the y axis |
axis_x |
logical of whether or not to plot the x axis |
Run a check the arg is a well-fit cpm object
cpmFail(cpmod)
cpmFail(cpmod)
cpmod |
A |
logical value indicating a failed fit (TRUE) or successful (FALSE)
Run a check on each model within a cpmSet
object
to determine if it failed or not
cpmSetFail(cpmSetToCheck)
cpmSetFail(cpmSetToCheck)
cpmSetToCheck |
A |
A vector of logical values indicating if each of the models failed
cpmSet
objectRemove all failed models within a cpmSet
object
cpmSetFailRemove(cpmSetToTidy)
cpmSetFailRemove(cpmSetToTidy)
cpmSetToTidy |
A |
A cpmSet
object with failed models removed
Run a check on each model within a cpmSetSize
object to determine if they all failed or not
cpmSetSizeFail(cpmSetSizeToCheck)
cpmSetSizeFail(cpmSetSizeToCheck)
cpmSetSizeToCheck |
A |
A list of vectors of logical values indicating if each of the models failed
cpmSetSize
objectRemove failed models from a cpmSetSize
object
cpmSetSizeFailRemove(cpmSetSizeToTidy)
cpmSetSizeFailRemove(cpmSetSizeToTidy)
cpmSetSizeToTidy |
A list of |
A list of cpmSet
objects with failed models removed
Produce the figure panel for a specific cell (factor level combination) including the specific fitted decay curves.
cpmSetSpecCPCellPlot(modelSet, specificModel, specificCell, cols, axes)
cpmSetSpecCPCellPlot(modelSet, specificModel, specificCell, cols, axes)
modelSet |
modelSet of class cpmSet |
specificModel |
name of the specific submodel to plot |
specificCell |
name of the specific cell to plot |
cols |
named vector of the colors to use for the distributions |
axes |
named vector of logical values indicating whether or not to plot the x axis and the y axis |
a specific cell plot panel
Simple function to facilitate selection of date columns from a data table
dateCols(data)
dateCols(data)
data |
data table potentially containing columns that could be
coerced (via |
column names of columns that can be coerced to dates
Convert calendar date to integer day from a reference date
(ref
).
dateToDay(date, ref = NULL)
dateToDay(date, ref = NULL)
date |
A date or vector of dates to convert to days. |
ref |
Reference date. |
Numeric value(s) of days from ref
.
x <- c("2018-01-01", "2018-02-01") dateToDay(x, x[1])
x <- c("2018-01-01", "2018-02-01") dateToDay(x, x[1])
unitCol
)If a unit column is not explicitly defined by user in the arg list to
estM
or estg
, then defineUnitCol
parses the CO, DWP,
and SS files to extract the unit column if possible.
Criteria that a column must meet to be a unit column are that it is found
in both data_CO
and data_DWP
, all units in data_CO
must
also be included among units in data_DWP
, all units in both
data_CO
and data_DWP
must be included among the column names
in data_SS
. If data_DWP = NULL
, then the unit column must be
included in data_CO
and all its units must be included among the
column names of data_SS
.
defineUnitCol(data_CO, data_SS = NULL, data_DWP = NULL)
defineUnitCol(data_CO, data_SS = NULL, data_DWP = NULL)
data_CO |
carcass observation data (data frame) |
data_SS |
search schedule data (data frame) |
data_DWP |
density-weighted proportion data (data frame) |
name of unit column (unitCol
), if a unique unit column can be
identified. If no unit column is present or there is more than one unit
column, defineUnitCol
stops with an error.
Given a cpm
object, calculate convenient descriptive statistics,
including the median CP, specified rI
statistics, and pda
and pdb
statistics for the fitted model (EoA parameterization), and
location and scale parameters for the fitted model (survival
package
parameterization) along with estimated CIs.
desc(model_CP, Ir = c(1, 3, 7, 14, 28), CL = 0.9, nsim = 10000)
desc(model_CP, Ir = c(1, 3, 7, 14, 28), CL = 0.9, nsim = 10000)
model_CP |
A fitted CP model ( |
Ir |
The intervals for which to calculate the r statistics |
CL |
The confidence level for the CIs. |
nsim |
Number of simulation draws for estimating CIs |
The CIs for the r statistics (and the medianCP for the Weibull) ara
based on simulation of the pda
and pdb
parameters, calculation
of the statistics, and taking the empirical distribution of the simulated
values. Other CIs are based on the assumed bivariate normal distributions of
the appropriately transformed l
and s
parameters in the fitted
model using beta_hat
and varbeta
.
NOTE: rI
is the probability that a carcass that arrives at a uniform random
time in an interval of I
days will persist until the first search after
arrival.
Matrix of point and interval estimates for the median CP and the r
statistics for the specified intervals. The matrix is assigned to class
descCP
that is simply a matrix with dimensions
ncell x (1 + 3*(5 + length(Ir)))
, column names that give the number of
observations in each cell, statistic name and upper and lower bounds
(in triplets), and row names giving the names of the cells. CL
, nsim
,
and the name of the fitted model (model_CP
) are included as object
attributes.
Format a user-friendly version of the parameter table from a Searcher Efficiency model, based on confidence level of interest
dlModTabSE(modTab, CL = 0.9)
dlModTabSE(modTab, CL = 0.9)
modTab |
model table |
CL |
Confidence level |
download version of the SE model table
Simple function to facilitate selection of columns that could be DWP values from a data table
DWPCols(data)
DWPCols(data)
data |
data table |
column names of columns that can be DWP values
Carcass density is modeled as a function of distance from
turbine. Format and usage parallel that of common R
functions
lm
, glm
, and gam
and the GenEst functions pkm
and cpm
.
dwpm(data_DWP, type = "data", unitCol = NULL, dwpCols = NULL)
dwpm(data_DWP, type = "data", unitCol = NULL, dwpCols = NULL)
data_DWP |
data frame with structure depending on model
type. In general, |
type |
model type may be |
unitCol |
name of the column with the units, which must be non-numeric |
dwpCols |
name(s) of the columns with the DWP data |
The fraction of carcasses falling in the area searched at a turbine
may be a function of carcass class (e.g., large or small) and/or direction
from the turbine. Data may be provided for fitting a distance model(s) or,
alternatively, simulated turbine-wise DWP data from custom-fitted models may
be provided. If pre-fit, pre-simulated data are used, then glm
returns
a dwpm
object with type = data
.
To fit a model, data_DWP
should be a data frame with a row for each carcass
and columns giving (at a minimum) unique carcass IDs, turbine ID, distance
from turbine, and fraction of area searched at the given distance at the
given turbine. Optional columns may include carcass class, covariates that may
influence detection probability (e.g., visibility class), and direction.
If covariates are to be included in the model, then the fraction of area
column would give the fraction of the area in the given covariate level at
that distance. Alternatively, prefab data may be provided in a dataframe,
with structure depending on data type. The simplest case would be that
point estimates only are provided. In that case, if there are no distinctions
among carcass classes (e.g., size), then data_DWP
should be a dataframe
with one column giving the unit (e.g., turbine) and one column with the DWP
at each unit; if distinctions are made among carcass classes, then data_DWP
would
be a data frame with a unit column and a DWP column for each carcass class. If
the DWP estimates incorporate uncertainties, then data_DWP
should be
an array with n_unit * nsim
rows and with colunms for units and DWPs for
each carcass class.
an object of an object of class dwpm
, which is a list with
model type
(currently only type = data
is supported) and
model
, which gives the simulated DWP values as an array (if there's
only a single carcass class) or a list of arrays (if there are more than one
carcass classes).
Estimate g values and arrival intervals for a set of carcasses from fitted pk and cp models and search data
estg( data_CO, COdate, data_SS, SSdate = NULL, model_SE, model_CP, model_DWP = NULL, sizeCol = NULL, unitCol = NULL, IDcol = NULL, nsim = 1000, max_intervals = 8 )
estg( data_CO, COdate, data_SS, SSdate = NULL, model_SE, model_CP, model_DWP = NULL, sizeCol = NULL, unitCol = NULL, IDcol = NULL, nsim = 1000, max_intervals = 8 )
data_CO |
Carcass Observation data |
COdate |
Column name for the date found data |
data_SS |
Search Schedule data |
SSdate |
Column name for the date searched data. Optional.
If not provided, |
model_SE |
Searcher Efficiency model (or list of models if there are multiple carcass classes) |
model_CP |
Carcass Persistence model (or list of models if there are multiple carcass classes) |
model_DWP |
Density weighted proportion model (or list of models if there are multiple carcass classes) |
sizeCol |
Name of column in |
unitCol |
Column name for the unit indicator |
IDcol |
Column name for unique carcass IDs (required) |
nsim |
the number of simulation draws |
max_intervals |
maximum number of arrival interval intervals to consider for each carcass. Optional. Limiting the number of search intervals can greatly increase the speed of calculations with only a slight reduction in accuracy in most cases. |
list of [1] g estimates (ghat
) and [2] arrival interval
estimates (Aj
) for each of the carcasses. The row names of the
Aj
matrix are the units at which carcasses were found. Row names of
ghat
are the carcass IDs (in data_CO
).
data(mock) model_SE <- pkm(formula_p = p ~ HabitatType, formula_k = k ~ 1, data = mock$SE) model_CP <- cpm(formula_l = l ~ Visibility, formula_s = s ~ Visibility, data = mock$CP, dist = "weibull", left = "LastPresentDecimalDays", right = "FirstAbsentDecimalDays" ) ghat <- estg(data_CO = mock$CO, COdate = "DateFound", data_SS = mock$SS, model_SE = model_SE, model_CP = model_CP, unitCol = "Unit", nsim = 100)
data(mock) model_SE <- pkm(formula_p = p ~ HabitatType, formula_k = k ~ 1, data = mock$SE) model_CP <- cpm(formula_l = l ~ Visibility, formula_s = s ~ Visibility, data = mock$CP, dist = "weibull", left = "LastPresentDecimalDays", right = "FirstAbsentDecimalDays" ) ghat <- estg(data_CO = mock$CO, COdate = "DateFound", data_SS = mock$SS, model_SE = model_SE, model_CP = model_CP, unitCol = "Unit", nsim = 100)
Generic g estimation by simulation from given SE model and CP models under a specific search schedule.
The g estimated by estgGeneric
is a generic aggregate detection
probability and represents the probability of detecting a carcass that
arrives at a (uniform) random time during the period monitored, for each
of the possible cell combinations, given the SE and CP models. This
is somethat different from the GenEst estimation of g when the purpose
is to estimate total mortality (M), in which case the detection
probability varies with carcass arrival interval and is difficult to
summarize statistically. The estgGeneric
estimate is a useful
"big picture" summary of detection probability, but would be difficult
to work with for estimating M with precision.
estgGeneric(days, model_SE, model_CP, nsim = 1000)
estgGeneric(days, model_SE, model_CP, nsim = 1000)
days |
Search schedule data as a vector of days searched |
model_SE |
Searcher Efficiency model ( |
model_CP |
Carcass Persistence model ( |
nsim |
the number of simulation draws |
gGeneric
object that is a list of [1] a list of g estimates,
with one element in the list corresponding to each of the cells from the
cross-model combination and [2] a table of predictors and cell names
associated with the gs
data(mock) model_SE <- pkm(formula_p = p ~ HabitatType, formula_k = k ~ 1, data = mock$SE) model_CP <- cpm(formula_l = l ~ Visibility, formula_s = s ~ Visibility, data = mock$CP, left = "LastPresentDecimalDays", right = "FirstAbsentDecimalDays") avgSS <- averageSS(mock$SS) ghatsGeneric <- estgGeneric(days = avgSS, model_SE = model_SE, model_CP = model_CP)
data(mock) model_SE <- pkm(formula_p = p ~ HabitatType, formula_k = k ~ 1, data = mock$SE) model_CP <- cpm(formula_l = l ~ Visibility, formula_s = s ~ Visibility, data = mock$CP, left = "LastPresentDecimalDays", right = "FirstAbsentDecimalDays") avgSS <- averageSS(mock$SS) ghatsGeneric <- estgGeneric(days = avgSS, model_SE = model_SE, model_CP = model_CP)
Generic g estimation for a combination of SE model and CP model under a given search schedule
The g estimated by estgGenericSize
is a generic aggregate detection
probability and represents the probability of detecting a carcass that
arrives at a (uniform) random time during the period monitored, for each
of the possible cell combinations, given the SE and CP models. This
is somethat different from the GenEst estimation of g when the purpose
is to estimate total mortality (M), in which case the detection
probability varies with carcass arrival interval and is difficult to
summarize statistically. The estgGeneric
estimate is a useful
"big picture" summary of detection probability, but would be difficult
to work with for estimating M with precision.
estgGenericSize( days, modelSetSize_SE, modelSetSize_CP, modelSizeSelections_SE, modelSizeSelections_CP, nsim = 1000 )
estgGenericSize( days, modelSetSize_SE, modelSetSize_CP, modelSizeSelections_SE, modelSizeSelections_CP, nsim = 1000 )
days |
Search schedule data as a vector of days searched |
modelSetSize_SE |
Searcher Efficiency model set for multiple sizes |
modelSetSize_CP |
Carcass Persistence model set for multiple sizes |
modelSizeSelections_SE |
vector of SE models to use, one for each
size. Size names are required, and names must match those of
modelSetSize_SE. E.g.,
|
modelSizeSelections_CP |
vector of CP models to use, one for each size |
nsim |
the number of simulation draws |
list of g estimates, with one element in the list corresponding to each of the cells from the cross-model combination
data(mock) pkmModsSize <- pkm(formula_p = p ~ HabitatType, formula_k = k ~ HabitatType, data = mock$SE, obsCol = c("Search1", "Search2", "Search3", "Search4"), sizeCol = "Size", allCombos = TRUE) cpmModsSize <- cpm(formula_l = l ~ Visibility, formula_s = s ~ Visibility, data = mock$CP, left = "LastPresentDecimalDays", right = "FirstAbsentDecimalDays", dist = c("exponential", "lognormal"), sizeCol = "Size", allCombos = TRUE) pkMods <- c("S" = "p ~ 1; k ~ 1", "L" = "p ~ 1; k ~ 1", "M" = "p ~ 1; k ~ 1", "XL" = "p ~ 1; k ~ 1" ) cpMods <- c("S" = "dist: exponential; l ~ 1; NULL", "L" = "dist: exponential; l ~ 1; NULL", "M" = "dist: exponential; l ~ 1; NULL", "XL" = "dist: exponential; l ~ 1; NULL" ) avgSS <- averageSS(mock$SS) gsGeneric <- estgGenericSize(nsim = 1000, days = avgSS, modelSetSize_SE = pkmModsSize, modelSetSize_CP = cpmModsSize, modelSizeSelections_SE = pkMods, modelSizeSelections_CP = cpMods )
data(mock) pkmModsSize <- pkm(formula_p = p ~ HabitatType, formula_k = k ~ HabitatType, data = mock$SE, obsCol = c("Search1", "Search2", "Search3", "Search4"), sizeCol = "Size", allCombos = TRUE) cpmModsSize <- cpm(formula_l = l ~ Visibility, formula_s = s ~ Visibility, data = mock$CP, left = "LastPresentDecimalDays", right = "FirstAbsentDecimalDays", dist = c("exponential", "lognormal"), sizeCol = "Size", allCombos = TRUE) pkMods <- c("S" = "p ~ 1; k ~ 1", "L" = "p ~ 1; k ~ 1", "M" = "p ~ 1; k ~ 1", "XL" = "p ~ 1; k ~ 1" ) cpMods <- c("S" = "dist: exponential; l ~ 1; NULL", "L" = "dist: exponential; l ~ 1; NULL", "M" = "dist: exponential; l ~ 1; NULL", "XL" = "dist: exponential; l ~ 1; NULL" ) avgSS <- averageSS(mock$SS) gsGeneric <- estgGenericSize(nsim = 1000, days = avgSS, modelSetSize_SE = pkmModsSize, modelSetSize_CP = cpmModsSize, modelSizeSelections_SE = pkMods, modelSizeSelections_CP = cpMods )
Given given fitted Searcher Efficiency and Carcass Persistence models; Search Schedule, Density Weighted Proportion, and Carcass Observation data; and information about the fraction of the the facility that was surveyed.
estM( data_CO, data_SS, data_DWP = NULL, frac = 1, COdate = "DateFound", model_SE, model_CP, model_DWP = NULL, unitCol = NULL, SSdate = NULL, sizeCol = NULL, IDcol = NULL, DWPCol = NULL, nsim = 1000, max_intervals = 8 )
estM( data_CO, data_SS, data_DWP = NULL, frac = 1, COdate = "DateFound", model_SE, model_CP, model_DWP = NULL, unitCol = NULL, SSdate = NULL, sizeCol = NULL, IDcol = NULL, DWPCol = NULL, nsim = 1000, max_intervals = 8 )
data_CO |
Carcass Observation data |
data_SS |
Search Schedule data |
data_DWP |
Survey unit (rows) by carcass class (columns) density weighted proportion table |
frac |
fraction carcasses on ground that was surveyed but not accounted for in DWP |
COdate |
Column name for the date found data |
model_SE |
Searcher Efficiency model (or list of models if there are multiple carcass classes) |
model_CP |
Carcass Persistence model (or list of models if there are multiple carcass classes) |
model_DWP |
fitted dwp model (optional) |
unitCol |
Column name for the unit indicator (optional) |
SSdate |
Column name for the date searched data |
sizeCol |
Name of colum in |
IDcol |
column with unique carcass (CO) identifier |
DWPCol |
Column name for the DWP values in the DWP table when no
carcass class is used and there is more than one column in |
nsim |
the number of simulation draws |
max_intervals |
maximum number of arrival intervals to consider for each carcass |
list of Mhat, Aj, ghat, DWP (by carcass), and Xtot = total number of carcasses observe
## Not run: data(mock) model_SE <- pkm(formula_p = p ~ HabitatType, formula_k = k ~ 1, data = mock$SE ) model_CP <- cpm(formula_l = l ~ Visibility, formula_s = s ~ Visibility, data = mock$CP, dist = "weibull", left = "LastPresentDecimalDays", right = "FirstAbsentDecimalDays" ) eM <- estM(nsim = 1000, data_CO = mock$CO, data_SS = mock$SS, data_DWP = mock$DWP, frac = 1, model_SE = model_SE, model_CP = model_CP, COdate = "DateFound", DWPCol = "S", sizeCol = NULL ) ## End(Not run)
## Not run: data(mock) model_SE <- pkm(formula_p = p ~ HabitatType, formula_k = k ~ 1, data = mock$SE ) model_CP <- cpm(formula_l = l ~ Visibility, formula_s = s ~ Visibility, data = mock$CP, dist = "weibull", left = "LastPresentDecimalDays", right = "FirstAbsentDecimalDays" ) eM <- estM(nsim = 1000, data_CO = mock$CO, data_SS = mock$SS, data_DWP = mock$DWP, frac = 1, model_SE = model_SE, model_CP = model_CP, COdate = "DateFound", DWPCol = "S", sizeCol = NULL ) ## End(Not run)
Expand the exponential models across the other distributions
expandModelSetCP(modelSet)
expandModelSetCP(modelSet)
modelSet |
cp model set of class cpmSet |
updated model set
This package is designed to analyze searcher efficiency, carcass persistence, search schedule, and carcass observation data for the estimation of bird and bat mortality at wind and solar power facilities.
browseVignettes("GenEst")
packageDescription("GenEst")
disclaimerUSGS()
disclaimerWEST()
mock
wind_cleared
wind_RP
wind_RPbat
solar_powerTower
solar_PV
solar_trough
pkm, cpm, dwpm
estimate searcher efficiency
(pk
), carcass persistence (cp
), and (dwp
) parameters
estM
estimate mortality given pkm
, cpm
and data
calcSplits
split mortality estimates by subcategories
plot
S3 function for pkm
,
pkmSet
, cpm
,
cpmSet
, estM
,
splitFull
,
splitSummary
,
gGeneric
, and
gGenericSize
objects
transposeSplits
transpose 2-d splits
summary
S3 function for estM
,
splitFull
,
gGeneric
,
gGenericSize
objects
aicc
S3 function for extracting models' AICc values
from pkm
, pkmSet
,
pkmSize
, pkmSetSize
,
cpm
, cpmSet
,
cpmSize
, and cpmSetSize
objects
desc
Calculate descriptive statistics for a fitted CP model
estgGeneric
estimate detection probability (g) for given searcher efficiency and carcass persistence model
runGenEst()
start the GUI
rpk
, qpk
, rcp
, rdwp
estg
, calcg
ppersist
, SEsi
alogit
, logit
pkLogLik
, cpLogLik
calcRate
, calcTsplit
,
ltranspose
refMod
countCarcs
simpleMplot
estgGenericSize
prepSS
averageSS
tidyModelSetCP
tidyModelSetSE
checkDate
dateCols
dateToDay
defineUnitCol
dlModTabSE
prettyModTabCP
prettyModTabSE
prettySplitTab
trimSetSize
combinePreds
combinePredsAcrossModels
pkmSetSizeFailRemove
pkmSetFailRemove
cpmSetSizeFailRemove
cpmSetSizeFail
cpmSetFailRemove
CO_DWP
CPcols
cpmCPCellPlot
cpmFail
cpmSetFail
cpmSetSpecCPCellPlot
DWPCols
expandModelSetCP
obsCols_SE
pkmFail
pkmSetAllFail
pkmSetFail
pkmSetSizeFail
plotCPCells
plotCPFigure
plotCPHeader
predsCols
SEsi_left
SEsi_right
SEsi0
sizeCols
matchCells
checkComponents
checkSpecificModelCP
checkSpecificModelSE
combinePredsAcrossModels
CPdistOptions
obsCols_fta
obsCols_ltp
pkmParamPlot
pkmSECellPlot
pkmSet
pkmSetSpecParamPlot
pkmSetSpecSECellPlot
plotSEBoxPlots
plotSEBoxTemplate
plotSECells
plotSEFigure
plotSEHeader
prepPredictors
readCSV
removeCols
_GenEst_calcRateC
_GenEst_calcTsplitC
calcRateC
calcTsplitC
aboutContent
aboutPanel
analysisPanel
b
big
cButtonStyle
center
classText
clearNotifications
CPMainPanel
CPPanel
downloadCPFig
estText
CPSidebar
initialReactiveValues
createvtext
dataDownloadWidget
dataInputPanel
dataInputSidebar
dataInputWidget
dataTabPanel
disclaimersContent
disclaimersPanel
downloadCPFig
downloadCPMod
downloadCPMres
downloadSEmod
downloadgFig
downloadMFig
downloadSEFig
downloadsPanel
downloadTable
eventReaction
GeneralInputSidebar
GeneralInputsPanel
GenEstAcknowledgements
GenEstAuthors
GenEstGUIauthors
GenEstInlineCSS
GenEstLicense
GenEstLogos
GenEstShinyJS
GenEstUI
GenEstServer
gettingStartedContent
gettingStartedPanel
gMainPanel
gPanel
gSidebar
helpPanel
initialOutput
kFixedWidget
kFixedWidgetHeader
kFixedWidgetRow
li
loadedDataPanel
MMainPanel
modelInputWidget
modelOutputPanel
modelOutputWidget
modelRunWidget
modelSelectionWidget
modelSelectionWidgetHeader
modelSelectionWidgetRow
modelSetCells
modelSetModelCells
modelSetModelPredictors
modelSetPredictors
modNamePaste
modNameSplit
MPanel
msgFracNote
msgList
msgModDone
msgModFail
msgModPartialFail
msgModRun
msgModSENobs
msgModWarning
msgSampleSize
msgSplitFail
msgSSavgFail
msgSSinputFail
MSidebar
navbar
ol
pickSizeclass
plotNA
prepSizeclassText
preTextMaker
reaction
reactionMessageDone
reactionMessageRun
reNULL
reVal
SEboxes
SEcols
selectData
selectedDataPanel
SEMainPanel
SEPanel
SEpanel
SESidebar
setkNeed
setNotSuspending
small
splitButtonWidget
style
trimSetSize
u
ul
update_input
update_output
update_rv
updateColNames_size
updateSizeclasses
updatesizeCol
widgetMaker
Compute the logit or anti-logit
logit(x) alogit(x)
logit(x) alogit(x)
x |
A number. For |
logit
: The logit of x
.
alogit
: The anti-logit of x
.
logit(0.5) alogit(0)
logit(0.5) alogit(0)
A list of n
arrays, each with dimension m
x
k
is redimensioned to a list of m
arrays, each with
dimension m
x k
. NOTE: Attributes are not preserved.
ltranspose(M)
ltranspose(M)
M |
a list of |
a list of m
n
x k
arrays
A template dataset used for testing purposes. Dataset containing SE, CP, SS, DWP, and CO data. Data are mostly random without patterns.
mock
mock
A list with 5 items:
Searcher efficiency trial data
Carcass persistence trial data
Search schedule data
Density weighted proportion of area searched data
Carcass observations
mock
model utility functions that are not exported
matchCells(specific, modelSet) modelSetModelPredictors(modelSet) modelSetPredictors(modelSet) modelSetModelCells(modelSet) modelSetCells(modelSet)
matchCells(specific, modelSet) modelSetModelPredictors(modelSet) modelSetPredictors(modelSet) modelSetModelCells(modelSet) modelSetCells(modelSet)
specific |
specific model compared against the full set |
modelSet |
full model set to compare to the specific |
Simple function to facilitate selection of columns that could be First Time Absent observations for a CP model
obsCols_fta(data)
obsCols_fta(data)
data |
data table |
column names of columns that can be observations
Simple function to facilitate selection of columns that could be Last Time Present observations for a CP model
obsCols_ltp(data)
obsCols_ltp(data)
data |
data table |
column names of columns that can be observations
Simple function to facilitate selection of columns that could be observations for an SE model
obsCols_SE(data)
obsCols_SE(data)
data |
data table |
column names of columns that can be observations
The function used to calculate the negative-loglikelihood of
a given searcher efficiency model (pkm
) with a given data
set
pkLogLik( misses, foundOn, beta, nbeta_p, cellByCarc, maxmisses, cellMM, kFixed = NULL )
pkLogLik( misses, foundOn, beta, nbeta_p, cellByCarc, maxmisses, cellMM, kFixed = NULL )
misses |
Number of searches when carcass was present but not found. |
foundOn |
Search on which carcass was found. |
beta |
Parameters to be optimized. |
nbeta_p |
Number of parameters associated with p. |
cellByCarc |
Which cell each observation belongs to. |
maxmisses |
Maximum possible number of misses for a carcass. |
cellMM |
Combined pk model matrix. |
kFixed |
Value of k if fixed. |
Negative log likelihood of the observations, given the parameters.
Searcher efficiency is modeled as a function of the number of
times a carcass has been missed in previous searches and any number of
covariates. Format and usage parallel that of common R
functions
lm
, glm
, and gam
. However, the input data
(data
) is structured differently to accommodate the
multiple-search searcher efficiency trials (see Details), and model
formulas may be entered for both p
(akin to an intercept) and
k
(akin to a slope).
pkm( formula_p, formula_k = NULL, data, obsCol = NULL, kFixed = NULL, allCombos = FALSE, sizeCol = NULL, CL = 0.9, kInit = 0.7, quiet = FALSE, ... ) pkm0( formula_p, formula_k = NULL, data, obsCol = NULL, kFixed = NULL, kInit = 0.7, CL = 0.9, quiet = FALSE ) pkmSet( formula_p, formula_k = NULL, data, obsCol = NULL, kFixed = NULL, kInit = 0.7, CL = 0.9, quiet = FALSE ) pkmSize( formula_p, formula_k = NULL, data, kFixed = NULL, obsCol = NULL, sizeCol = NULL, allCombos = FALSE, kInit = 0.7, CL = 0.9, quiet = FALSE )
pkm( formula_p, formula_k = NULL, data, obsCol = NULL, kFixed = NULL, allCombos = FALSE, sizeCol = NULL, CL = 0.9, kInit = 0.7, quiet = FALSE, ... ) pkm0( formula_p, formula_k = NULL, data, obsCol = NULL, kFixed = NULL, kInit = 0.7, CL = 0.9, quiet = FALSE ) pkmSet( formula_p, formula_k = NULL, data, obsCol = NULL, kFixed = NULL, kInit = 0.7, CL = 0.9, quiet = FALSE ) pkmSize( formula_p, formula_k = NULL, data, kFixed = NULL, obsCol = NULL, sizeCol = NULL, allCombos = FALSE, kInit = 0.7, CL = 0.9, quiet = FALSE )
formula_p |
Formula for p; an object of class |
formula_k |
Formula for k; an object of class |
data |
Data frame with results from searcher efficiency trials and any
covariates included in |
obsCol |
Vector of names of columns in |
kFixed |
Parameter for user-specified |
allCombos |
logical. If |
sizeCol |
character string. The name of the column in |
CL |
numeric value in (0, 1). confidence level |
kInit |
numeric value in (0, 1). Initial value used for numerical
optimization of |
quiet |
Logical indicator of whether or not to print messsages |
... |
additional arguments passed to subfunctions |
The probability of finding a carcass that is present at the time of
search is p
on the first search after carcass arrival and is
assumed to decrease by a factor of k
each time the carcass is
missed in searches. Both p
and k
may depend on covariates
such as ground cover, season, species, etc., and a separate model format
(formula_p
and formula_k
) may be entered for each. The
models are entered as they would be in the familiar lm
or
glm
functions in R. For example, p
might vary with
A
and B
, while k
varies
only with A
. A user might then enter p ~ A + B
for formula_p
and k ~ A
for
formula_k
. Other R conventions for defining formulas may also be
used, with A:B
for the interaction between covariates
A and B and A * B
as short-hand for A + B + A:B
.
Search trial data
must be entered in a data frame with data in
each row giving the fate of a single carcass in the field trials. There
must be a column for each search occassion, with 0, 1, or NA depending on
whether the carcass was missed, found, or not available (typically
because it was found and removed on a previous search, had been earlier
removed by scavengers, or was not searched for) on the given search
occasion. Additional columns with values for categorical covariates
(e.g., visibility = E, M, or D) may also be included.
When all trial carcasses are either found on the first search or
are missed on the first search after carcass placement, pkm effects a
necessary adjustment to the for accuracy; otherwise, the model would not be
able to determine the uncertainty and would substantially over-estimate the
variance of the parameter estimates, giving essentially equal
to 0 or 1 with approximately equal probability. The adjustment is to fit the
model on an adjusted data set with duplicated copies of the original data
(
2n
observations) but with one carcass having the opposite fate of the
others. For example, in field trials with very high searcher efficiency and
n = 10
carcasses, all of which are found in the first search after
carcass placement, the original data set would have a carcass observation
column consisting of 1s (rep(1, 10)
). The adjusted data set would
have an observation column consisting of 2n - 1
1s and one 0. In this
case, the point estimate of p
is 1/(2n)
with distribution that
closely resembling the Bayesian posterior distributions of p
with a
uniform or a Jeffreys prior. The adjustment is applied on a cellwise basis
in full cell models (e.g., 1, A, B, A * B). In the additive model with two
predictors (A + B), the adjustment is made only when a full level of
covariate A or B is all 0s or 1s.
an object of an object of class pkm
, pkmSet
,
pkmSize
, or pkmSetSize
.
pkm0()
returns a pkm
object, which is a description
of a single, fitted pk model. Due to the large number and complexity of
components of apkm
model, only a subset of them is printed
automatically; the rest can be viewed/accessed via the $
operator
if desired. These are described in detail in the 'pkm
Components'
section.
pkmSet()
returns a list of pkm
objects, one for each
of the submodels, as described with parameter allCombos = TRUE
.
pkmSize()
returns a list of pkmSet
objects (one for
each 'size') if allCombos = T
, or a list of pkm
objects (one
for each 'size') if allCombos = T
pkm
returns a pkm
, pkmSet
, pkmSize
, or
pkmSetSize
object:
pkm
object if allCombos = FALSE, sizeCol = NULL
pkmSet
object if allCombos = TRUE, sizeCol = NULL
pkmSize
object if allCombos = FALSE, sizeCol != NULL
pkmSetSize
object if allCombos = TRUE, sizeCol != NULL
pkm
ComponentsThe following components of a pkm
object are displayed automatically:
call
the function call to fit the model
formula_p
the model formula for the p
parameter
formula_k
the model formula for the k
parameter
predictors
list of covariates of p
and/or k
AICc
the AIC value as corrected for small sample size
convergence
convergence status of the numerical optimization
to find the maximum likelihood estimates of p
and k
. A
value of 0
indicates that the model was fit successfully. For
help in deciphering other values, see optim
.
cell_pk
summary statistics for estimated cellwise estimates
of p
and k
, including the number of carcasses in each cell,
medians and upper & lower bounds on CIs for each parameter, indexed by
cell (or combination of covariate levels).
The following components are not printed automatically but can be accessed
via the $
operator:
data
the data used to fit the model
data0
$data
with NA rows removed
betahat_p, betahat_k
parameter estimates for the terms in the
regression model for for p
and k
(logit scale). If k
is fixed or not provided, then betahat_k
is not calculated.
varbeta
the variance-covariance matrix of the estimators
for c(betahat_p, betahat_k)
.
cellMM_p, cellMM_k
cellwise model (design) matrices for
covariate structures of p_formula
and k_formula
levels_p, levels_k
all levels of each covariate of p
and k
nbeta_p, nbeta_k
number of parameters to fit the p
and k
models
cells
cell structure of the pk-model, i.e., combinations of
all levels for each covariate of p
and k
. For example, if
covar1
has levels "a"
, "b"
, and "c"
, and
covar2
has levels "X"
and "Y"
, then the cells
would consist of a.X
, a.Y
, b.X
, b.Y
,
c.X
, and c.Y
.
ncell
total number of cells
predictors_k, predictors_p
covariates of p
and k
observations
observations used to fit the model
kFixed
the input kFixed
AIC
the AIC value for the fitted model
carcCells
the cell to which each carcass belongs
CL
the input CL
loglik
the log-liklihood for the maximum likelihood estimate
pOnly
a logical value telling whether k
is included in
the model. pOnly = TRUE
if and only if length(obsCol) == 1)
and kFixed = NULL
.
data_adj
data0
as adjusted for the 2n fix to accommodate
scenarios in which all trial carcasses are either found or all are not
found on the first search occasion (uncommon)
fixBadCells
vector giving the names of cells adjusted for the 2n fix
pkmSize
may also be used to fit a single model for each carcass class if
allCombos = FALSE
. To do so, formula_p
and formula_k
must be a named list of formulas with names matching the sizes listed in
unique(data[, sizeCol])
. The return value is then a list of
pkm
objects, one for each size.
head(data(wind_RP)) mod1 <- pkm(formula_p = p ~ Season, formula_k = k ~ 1, data = wind_RP$SE) class(mod1) mod2 <- pkm(formula_p = p ~ Season, formula_k = k ~ 1, data = wind_RP$SE, allCombos = TRUE) class(mod2) names(mod2) class(mod2[[1]]) mod3 <- pkm(formula_p = p ~ Season, formula_k = k ~ 1, data = wind_RP$SE, allCombos = TRUE, sizeCol = "Size") class(mod3) names(mod3) class(mod3[[1]]) class(mod3[[1]][[1]])
head(data(wind_RP)) mod1 <- pkm(formula_p = p ~ Season, formula_k = k ~ 1, data = wind_RP$SE) class(mod1) mod2 <- pkm(formula_p = p ~ Season, formula_k = k ~ 1, data = wind_RP$SE, allCombos = TRUE) class(mod2) names(mod2) class(mod2[[1]]) mod3 <- pkm(formula_p = p ~ Season, formula_k = k ~ 1, data = wind_RP$SE, allCombos = TRUE, sizeCol = "Size") class(mod3) names(mod3) class(mod3[[1]]) class(mod3[[1]][[1]])
Run a check the arg is a well-fit pkm object
pkmFail(pkmod)
pkmFail(pkmod)
pkmod |
A |
logical value indicating a failed fit (TRUE) or successful (FALSE)
Boxplot for pk model cells (soon to be deprecated)
pkmParamPlot(model, pk = "p", col)
pkmParamPlot(model, pk = "p", col)
model |
model of class pkm |
pk |
character of "p" or "k" to delineate between parameter graphed |
col |
color to use |
a parameter plot panel
Plot cell-specific decay curve for searcher efficiency
pkmSECellPlot(model, specificCell, col, axis_y = TRUE, axis_x = TRUE)
pkmSECellPlot(model, specificCell, col, axis_y = TRUE, axis_x = TRUE)
model |
model of class pkm |
specificCell |
name of the specific cell to plot (soon to be deprecated) |
col |
color to use |
axis_y |
logical of whether or not to plot the y axis |
axis_x |
logical of whether or not to plot the x axis |
a cell plot panel
Run a check on each model within a pkmSet
object to determine if they all failed or not
pkmSetAllFail(pkmSetToCheck)
pkmSetAllFail(pkmSetToCheck)
pkmSetToCheck |
A |
A logical value indicating if all models failed in the set
Run a check on each model within a pkmSet
object to determine if it failed or not
pkmSetFail(pkmSetToCheck)
pkmSetFail(pkmSetToCheck)
pkmSetToCheck |
A |
A vector of logical values indicating if each of the models failed
pkmSet
objectRemove all failed models within a pkmSet
object
pkmSetFailRemove(pkmSetToTidy)
pkmSetFailRemove(pkmSetToTidy)
pkmSetToTidy |
A |
A pkmSet
object with failed models removed
Run a check on each model within a pkmSetSize
object to determine if they all failed or not
pkmSetSizeFail(pkmSetSizeToCheck)
pkmSetSizeFail(pkmSetSizeToCheck)
pkmSetSizeToCheck |
A |
A list of logical vectors indicating which models failed
pkmSetSize
objectRemove failed models from a pkmSetSize
object
pkmSetSizeFailRemove(pkmSetSizeToTidy)
pkmSetSizeFailRemove(pkmSetSizeToTidy)
pkmSetSizeToTidy |
A list of |
A list of pkmSet
objects with failed models removed
Plot parameter box plots for each cell within a model for either p or k with comparison to the cellwise model (soor to be deprecated)
pkmSetSpecParamPlot(modelSet, specificModel, pk = "p", cols)
pkmSetSpecParamPlot(modelSet, specificModel, pk = "p", cols)
modelSet |
modelSet of class pkmSet |
specificModel |
name of the specific submodel to plot |
pk |
character of "p" or "k" to delineate between parameter graphed |
cols |
named vector of colors to use for the specific and reference models |
a specific parameter plot panel
Plot cell-specific decay curve for searcher efficiency for a specific model with comparison to the cellwise model
pkmSetSpecSECellPlot(modelSet, specificModel, specificCell, cols, axes)
pkmSetSpecSECellPlot(modelSet, specificModel, specificCell, cols, axes)
modelSet |
modelSet of class pkmSet (soon to be deprecated) |
specificModel |
name of the specific submodel to plot |
specificCell |
name of the specific cell to plot |
cols |
named vector of colors to use for the specific and reference models |
axes |
named vector of logical values indicating whether or not to plot the x axis and the y axis |
a specific cell plot panel
The CDF of the loglogistic distribution
pllogis(q, pda, pdb)
pllogis(q, pda, pdb)
q |
a numeric vector of quantiles |
pda |
the |
pdb |
the |
There are several common parameterizations of the loglogistic distribution. The one used here gives the following:
Pr(X <= x) = 1/(1 + (x/
)^-
)
Pr(X = x) = (
/
) * (x/
)^(
- 1)/(1 + (x/
)^
)^2
Pr(X <= q | pda, pdb)
Plot a single cpm
model
## S3 method for class 'cpm' plot(x, col = "black", ...)
## S3 method for class 'cpm' plot(x, col = "black", ...)
x |
model of class cpm |
col |
color to use |
... |
to be passed down |
data(wind_RP) mod <- cpm(formula_l = l ~ Season, formula_s = s ~ Season, data = wind_RP$CP, left = "LastPresent", right = "FirstAbsent") plot(mod)
data(wind_RP) mod <- cpm(formula_l = l ~ Season, formula_s = s ~ Season, data = wind_RP$CP, left = "LastPresent", right = "FirstAbsent") plot(mod)
Produce a set of figures for a set of CP models, as fit by
cpmSet
## S3 method for class 'cpmSet' plot(x, specificModel = NULL, cols = NULL, ...)
## S3 method for class 'cpmSet' plot(x, specificModel = NULL, cols = NULL, ...)
x |
pk model set of class pkmSet |
specificModel |
the name(s) or index number(s) of specific model(s) to restrict the plot |
cols |
named vector of the colors to use for the distributions |
... |
to be passed down |
data(wind_RP) mod <- cpmSet(formula_l = l ~ Season, formula_s = s ~ Season, data = wind_RP$CP, left = "LastPresent", right = "FirstAbsent") plot(mod)
data(wind_RP) mod <- cpmSet(formula_l = l ~ Season, formula_s = s ~ Season, data = wind_RP$CP, left = "LastPresent", right = "FirstAbsent") plot(mod)
plot
defined for class estM
objects
## S3 method for class 'estM' plot(x, ..., CL = 0.9)
## S3 method for class 'estM' plot(x, ..., CL = 0.9)
x |
|
... |
arguments to pass down |
CL |
confidence level |
## Not run: data(mock) model_SE <- pkm(formula_p = p ~ HabitatType, formula_k = k ~ 1, data = mock$SE) model_CP <- cpm(formula_l = l ~ Visibility, formula_s = s ~ Visibility, data = mock$CP, dist = "weibull", left = "LastPresentDecimalDays", right = "FirstAbsentDecimalDays") eM <- estM(nsim = 1000, data_CO = mock$CO, data_SS = mock$SS, data_DWP = mock$DWP, frac = 1, model_SE = model_SE, model_CP = model_CP, COdate = "DateFound", DWPCol = "S", sizeCol = NULL) plot(eM) ## End(Not run)
## Not run: data(mock) model_SE <- pkm(formula_p = p ~ HabitatType, formula_k = k ~ 1, data = mock$SE) model_CP <- cpm(formula_l = l ~ Visibility, formula_s = s ~ Visibility, data = mock$CP, dist = "weibull", left = "LastPresentDecimalDays", right = "FirstAbsentDecimalDays") eM <- estM(nsim = 1000, data_CO = mock$CO, data_SS = mock$SS, data_DWP = mock$DWP, frac = 1, model_SE = model_SE, model_CP = model_CP, COdate = "DateFound", DWPCol = "S", sizeCol = NULL) plot(eM) ## End(Not run)
Plot method for a single generic ghat
estimation
## S3 method for class 'gGeneric' plot(x, CL = 0.9, ...)
## S3 method for class 'gGeneric' plot(x, CL = 0.9, ...)
x |
|
CL |
confidence level to use |
... |
to be passed down |
generic detection probability plot
data(mock) model_SE <- pkm(formula_p = p ~ HabitatType, formula_k = k ~ 1, data = mock$SE) model_CP <- cpm(formula_l = l ~ Visibility, formula_s = s ~ Visibility, data = mock$CP, left = "LastPresentDecimalDays", right = "FirstAbsentDecimalDays") avgSS <- averageSS(mock$SS) ghatsGeneric <- estgGeneric(nsim = 1000, avgSS, model_SE, model_CP) plot(ghatsGeneric)
data(mock) model_SE <- pkm(formula_p = p ~ HabitatType, formula_k = k ~ 1, data = mock$SE) model_CP <- cpm(formula_l = l ~ Visibility, formula_s = s ~ Visibility, data = mock$CP, left = "LastPresentDecimalDays", right = "FirstAbsentDecimalDays") avgSS <- averageSS(mock$SS) ghatsGeneric <- estgGeneric(nsim = 1000, avgSS, model_SE, model_CP) plot(ghatsGeneric)
Plot method for a size-based generic ghat
estimation
## S3 method for class 'gGenericSize' plot(x, CL = 0.9, ...)
## S3 method for class 'gGenericSize' plot(x, CL = 0.9, ...)
x |
|
CL |
confidence level to use |
... |
to be passed down |
size-based detection probability plot
data(mock) pkmModsSize <- pkm(formula_p = p ~ HabitatType, formula_k = k ~ HabitatType, data = mock$SE, obsCol = c("Search1", "Search2", "Search3", "Search4"), sizeCol = "Size", allCombos = TRUE) cpmModsSize <- cpm(formula_l = l ~ Visibility, formula_s = s ~ Visibility, data = mock$CP, left = "LastPresentDecimalDays", right = "FirstAbsentDecimalDays", dist = c("exponential", "lognormal"), sizeCol = "Size", allCombos = TRUE) pkMods <- c("S" = "p ~ 1; k ~ 1", "L" = "p ~ 1; k ~ 1", "M" = "p ~ 1; k ~ 1", "XL" = "p ~ 1; k ~ 1" ) cpMods <- c("S" = "dist: exponential; l ~ 1; NULL", "L" = "dist: exponential; l ~ 1; NULL", "M" = "dist: exponential; l ~ 1; NULL", "XL" = "dist: exponential; l ~ 1; NULL" ) avgSS <- averageSS(mock$SS) gsGeneric <- estgGenericSize(nsim = 1000, days = avgSS, modelSetSize_SE = pkmModsSize, modelSetSize_CP = cpmModsSize, modelSizeSelections_SE = pkMods, modelSizeSelections_CP = cpMods ) plot(gsGeneric)
data(mock) pkmModsSize <- pkm(formula_p = p ~ HabitatType, formula_k = k ~ HabitatType, data = mock$SE, obsCol = c("Search1", "Search2", "Search3", "Search4"), sizeCol = "Size", allCombos = TRUE) cpmModsSize <- cpm(formula_l = l ~ Visibility, formula_s = s ~ Visibility, data = mock$CP, left = "LastPresentDecimalDays", right = "FirstAbsentDecimalDays", dist = c("exponential", "lognormal"), sizeCol = "Size", allCombos = TRUE) pkMods <- c("S" = "p ~ 1; k ~ 1", "L" = "p ~ 1; k ~ 1", "M" = "p ~ 1; k ~ 1", "XL" = "p ~ 1; k ~ 1" ) cpMods <- c("S" = "dist: exponential; l ~ 1; NULL", "L" = "dist: exponential; l ~ 1; NULL", "M" = "dist: exponential; l ~ 1; NULL", "XL" = "dist: exponential; l ~ 1; NULL" ) avgSS <- averageSS(mock$SS) gsGeneric <- estgGenericSize(nsim = 1000, days = avgSS, modelSetSize_SE = pkmModsSize, modelSetSize_CP = cpmModsSize, modelSizeSelections_SE = pkMods, modelSizeSelections_CP = cpMods ) plot(gsGeneric)
Plot a single pkm
model
## S3 method for class 'pkm' plot(x, col = NULL, CL = NULL, ...)
## S3 method for class 'pkm' plot(x, col = NULL, CL = NULL, ...)
x |
model of class pkm |
col |
color to use |
CL |
confidence level to show in boxplots and confidence bounds |
... |
arguments to be passed to sub functions |
a plot
data(wind_RP) mod <- pkm(formula_p = p ~ Season, formula_k = k ~ 1, data = wind_RP$SE) plot(mod)
data(wind_RP) mod <- pkm(formula_p = p ~ Season, formula_k = k ~ 1, data = wind_RP$SE) plot(mod)
Produce a set of figures for a set of SE models, as fit by
pkmSet
## S3 method for class 'pkmSet' plot(x, specificModel = NULL, cols = NULL, CL = NULL, ...)
## S3 method for class 'pkmSet' plot(x, specificModel = NULL, cols = NULL, CL = NULL, ...)
x |
pk model set of class pkmSet |
specificModel |
the name(s) or index number(s) of specific model(s) to restrict the plot |
cols |
named vector of colors to use for the specific and reference models |
CL |
confidence level |
... |
to be sent to subfunctions |
a set of plots
data(wind_RP) mod <- pkmSet(formula_p = p ~ Season, formula_k = k ~ Season, data = wind_RP$SE ) plot(mod)
data(wind_RP) mod <- pkmSet(formula_p = p ~ Season, formula_k = k ~ Season, data = wind_RP$SE ) plot(mod)
The S3 plot
method for splitFull
objects
constructs boxplots of the mortality estimates for all combinations of
splitting covariates summarized in the splits
variable. This is a
simple wrapper function for creating a splitSummary
object by
calling summary.splitFull
and plotting the result via
plot.splitSummary
.
## S3 method for class 'splitFull' plot(x, rate = FALSE, CL = 0.9, commonScale = FALSE, ...)
## S3 method for class 'splitFull' plot(x, rate = FALSE, CL = 0.9, commonScale = FALSE, ...)
x |
A |
rate |
|
CL |
desired confidence level to show in box plots |
commonScale |
Boolean: Should panels share a common y-axis scale? Relevant only when there are two splitting variables. |
... |
to be passed down |
The S3 plot
method for splitSummary
objects
constructs boxplots of the mortality estimates for all combinations of
splitting covariates summarized in the splits
variable.
For 1-covariate splits, box plots showing median, IQR, and confidence
intervals (for the CL
attribute for the splits object). For
2-covariate splits, the box plots are in an array with levels of
the temporal split (split_SS
or split_time
) arranged
horizontally (if present) and the levels of the split_CO
variable
arranged vertically. If no temporal splits are present, then the box
plots along the levels of the first split_CO
variable are arranged
horizontally and the levels of the second variable are are arranged
vertically.
## S3 method for class 'splitSummary' plot(x, rate = FALSE, commonScale = FALSE, ...)
## S3 method for class 'splitSummary' plot(x, rate = FALSE, commonScale = FALSE, ...)
x |
A |
rate |
|
commonScale |
boolean to indicate whether to plot separate splits panels with a common scale on their y-axes (or have y-axes scaled to fit each graph separately) |
... |
additional arguments to be passed down |
Produce a set of cellwise figures for a specific CP model, as
fit by cpmSet
plotCPCells(modelSet, specificModel, cols)
plotCPCells(modelSet, specificModel, cols)
modelSet |
cp model set of class cpmSet |
specificModel |
the name of the specific model for the plot |
cols |
named vector of the colors to use for the distributions |
a plot
Produce a figures for a specific CP model, as fit by
cpmSet
plotCPFigure(modelSet, specificModel, cols = CPcols())
plotCPFigure(modelSet, specificModel, cols = CPcols())
modelSet |
cp model set of class |
specificModel |
the name of the specific model for the plot |
cols |
named vector of the colors to use for the distributions |
a plot
Produce the header for a CP plot
plotCPHeader(modelSet, specificModel, cols = CPcols())
plotCPHeader(modelSet, specificModel, cols = CPcols())
modelSet |
cp model set of class cpmSet |
specificModel |
the name of the specific model for the plot |
cols |
named vector of the colors to use for the distributions |
a plot
Plot parameter box plots for each cell within a model for both p and k with comparison to the cellwise model (soon to be deprecated)
plotSEBoxPlots(modelSet, specificModel, cols)
plotSEBoxPlots(modelSet, specificModel, cols)
modelSet |
modelSet of class pkmSet |
specificModel |
name of the specific submodel to plot |
cols |
named vector of colors to use for the specific and reference models |
a set of parameter plot panels
Plot template box plot (soon to be deprecated)
plotSEBoxTemplate(modelSet, specificModel, cols)
plotSEBoxTemplate(modelSet, specificModel, cols)
modelSet |
modelSet of class pkmSet |
specificModel |
name of the specific submodel to plot |
cols |
named vector of colors to use for the specific and reference models |
a template box plot
Produce a set of cellwise figures for a specific SE model, as
fit by pkmSet
(soon to be deprecated)
plotSECells(modelSet, specificModel, cols)
plotSECells(modelSet, specificModel, cols)
modelSet |
pk model set of class pkmSet |
specificModel |
the name of the specific model for the plot |
cols |
named vector of colors to use for the specific and reference models |
a plot
Produce a figures for a specific SE model, as fit by
pkmSet
(soon to be deprecated)
plotSEFigure(modelSet, specificModel, app, cols)
plotSEFigure(modelSet, specificModel, app, cols)
modelSet |
pk model set of class |
specificModel |
the name of the specific model for the plot |
app |
logical indicating if the plot is for the app |
cols |
named vector of colors to use for the specific and reference models |
a plot
Produce the header for an SE plot (soon to be deprecated)
plotSEHeader(modelSet, specificModel, app = FALSE, cols = SEcols())
plotSEHeader(modelSet, specificModel, app = FALSE, cols = SEcols())
modelSet |
pk model set of class pkmSet |
specificModel |
the name of the specific model for the plot |
app |
logical indicating if the plot is for the app |
cols |
named vector of colors to use for the specific and reference models |
a plot
Given a set of CP parameters (of "ppersist"
type),
calculate the probability of persistence to detection for a carcass.
ppersist(pda, pdb, dist, t_arrive0, t_arrive1, t_search)
ppersist(pda, pdb, dist, t_arrive0, t_arrive1, t_search)
pda |
parameter a. |
pdb |
parameter b. |
dist |
Distribution used. |
t_arrive0 |
Beginning of arrival window. |
t_arrive1 |
End of arrival window. |
t_search |
Search time. |
Probability of persistence of detection to at t_search, given arrival between t_arrive0 and t_arrive1
Simple function to facilitate selection of columns that could be predictors for SE or CP models from a data table
predsCols(data)
predsCols(data)
data |
data table |
column names of columns that can be predictors
Prepare predictor inputs from the app for use in the model function
prepPredictors(preds = NULL)
prepPredictors(preds = NULL)
preds |
predictors, as input to the app |
prepared predictors (or 1 if no predictors)
Since data_SS columns largely have a specific, required
format, the prepSS
function can often automatically decipher the
data, but the user may specify explicit instructions for parsing the data
for safety if desired. If the data are formatted properly, the automatic
parsing is reliable in most cases. There are two exceptions. (1) If
there is more than one column with possible dates (formatted as formal
dates (as class Date
, POSIXlt
or POSIXct
) or
character strings or factors that can be unambiguously interpreted as
dates (with assumed format "2018-05-15" or "2018/5/15"). In that case,
the user must specify the desired dates as dateColumn
. (2) If
there is a covariate column consisting entirely of 0s and 1s. In that
case, the user must specify the column(s) in covars
.
prepSS(data_SS, SSdate = NULL, preds = NULL)
prepSS(data_SS, SSdate = NULL, preds = NULL)
data_SS |
data frame or matrix with search schedule parameters, including columns for search dates, covariates (describing characteristics of the search intervals), and each unit (with 1s and 0s to indicate whether the given unit was searched (= 1) or not (= 0) on the given date) |
SSdate |
name of the column with the search dates in it
(optional). If no |
preds |
vector of character strings giving the names of columns to be
interpreted as potential covariates (optional). Typically, it is not
necessary for a user to provide a value for |
prepSS
object that can be conveniently used in the splitting
functions.
data(mock) prepSS(mock$SS)
data(mock) prepSS(mock$SS)
Format a reader-friendly version of the parameter table from a carcass persistence model showing CIs for medianCP and for rI's for intervals of Ir
prettyModTabCP(modTab)
prettyModTabCP(modTab)
modTab |
|
pretty version of the CP model table in a data frame with point and interval estimates for medianCP and rI statistics. Output table is ready for rendering in shiny and posting in the GUI
Format reader-friendly versions of results summary tables for searcher efficiency (GUI display and download), carcass persistence, and splits.
prettyModTabSE(modTab, CL = 0.9)
prettyModTabSE(modTab, CL = 0.9)
modTab |
model table |
CL |
Confidence level |
pretty version of the SE model table
Format a reader-friendly version of the split summary table a mortality estimation
prettySplitTab(splitSummary)
prettySplitTab(splitSummary)
splitSummary |
a split summary |
split pretty table
cpm
model objectPrint a cpm
model object
## S3 method for class 'cpm' print(x, ...)
## S3 method for class 'cpm' print(x, ...)
x |
a |
... |
to be passed down |
pkm
model objectPrint a pkm
model object
## S3 method for class 'pkm' print(x, ...)
## S3 method for class 'pkm' print(x, ...)
x |
a |
... |
to be passed down |
and
Calculate quantiles of marginal distributions of
and
for a
pkm
model object
qpk(p, model)
qpk(p, model)
p |
vector of probabilities |
model |
A |
either a list of ncell
length(p)
matrices
of quantiles for $p
and $k
for cells defined by the
model
object (if model$pOnly == FALSE
) or a ncell
length(p)
matrix of quantiles for p
# 90% confidence intervals for \code{p} and \code{k} mod <- pkm(formula_p = p ~ Visibility * Season, formula_k = k ~ Season, data = wind_cleared$SE) qpk(p = c(0.05, 0.95), model = mod)
# 90% confidence intervals for \code{p} and \code{k} mod <- pkm(formula_p = p ~ Visibility * Season, formula_k = k ~ Season, data = wind_cleared$SE) qpk(p = c(0.05, 0.95), model = mod)
Simulate parameters from a cpm
model object, and
format them as either type "survreg"
or "ppersist"
rcp(n, model, type = "survreg")
rcp(n, model, type = "survreg")
n |
the number of simulation draws |
model |
A |
type |
The type of parameters requested. |
list of two matrices of n
simulated l
and s
(if type = "survreg"
) or a
and b
(if type =
"ppersist"
)for cells defined by the model
object.
data(wind_RP) mod <- cpm(formula_l = l ~ 1, data = wind_RP$CP, left = "LastPresent", right = "FirstAbsent" ) rcp(n = 10, model = mod, type = "survreg") rcp(n = 10, model = mod, type = "ppersist")
data(wind_RP) mod <- cpm(formula_l = l ~ 1, data = wind_RP$CP, left = "LastPresent", right = "FirstAbsent" ) rcp(n = 10, model = mod, type = "survreg") rcp(n = 10, model = mod, type = "ppersist")
Simulate parameters from a dwpm
model object
rdwp(n, model)
rdwp(n, model)
n |
the number of simulation draws |
model |
A |
If the model type = data
, then the number of simulated columns
must be either >=n
(in which case the first n colunms are taken as the
simulated DWP) or 1 (in which case, DWP is assumed constant).
array of n
simulated dwp
values for each unit.
Dimensions = c(n, number of units).
Handle reading in of a csv that is either comma-decimal or semicolon-comma separation style
readCSV(path)
readCSV(path)
path |
file path |
read in data table
Compares all fitted models in a list and returns the model with the greatest log-likelihood
refMod(modelSet)
refMod(modelSet)
modelSet |
a list of fitted models with a |
The model object with the greatest log-likelihood among
the models in modelSet
Simple function to facilitate removal of columns selected
removeCols(colNames, selCols)
removeCols(colNames, selCols)
colNames |
column names from which some could be removed |
selCols |
selected columns to be removed |
column names without selected columns
Simulate parameters from a pkm
model object
rpk(n, model)
rpk(n, model)
n |
the number of simulation draws |
model |
A |
list of pairs of matrices of n
simulated p
and
k
for cells defined by the model
object.
data(wind_RP) mod <- pkm(formula_p = p ~ 1, formula_k = k ~ Season, data = wind_RP$SE) rpk(n = 10, model = mod)
data(wind_RP) mod <- pkm(formula_p = p ~ 1, formula_k = k ~ Season, data = wind_RP$SE) rpk(n = 10, model = mod)
Launches a local version of the GenEst application by running
runApp
pointed to the app
subdirectory in the
local GenEst
package folder.
runGenEst()
runGenEst()
Produce a named vectory with standard SE plot colors. soon to be deprecated.
SEcols()
SEcols()
Each call to SEpanel
produces a single panel showing
searcher efficiency as a function of number of searches. Includes raw data
(found
and available
) and model fits for a specific model
(y_spc
) and for the reference model (y_ref
) for the
pkmSet
object from the reference model was extracted. For interal use
only, for producing figs for plot.pkmSet
.
SEpanel(found, available, y_spc, y_ref, xends, cols_SE)
SEpanel(found, available, y_spc, y_ref, xends, cols_SE)
found |
vector of number carcasses found on the ith attempt |
available |
vector of number carcasses found on the ith attempt |
y_spc |
vector of model fits for the specific model |
y_ref |
vector of model fits for the reference model |
xends |
x-axis buffer (numeric scalar) on sides of figs |
cols_SE |
named vector of colors (character) |
NULL inserts a panel with no labels into a preformatted figure
Calculate searcher efficiency after some searches under pk values
SEsi(days, pk)
SEsi(days, pk)
days |
search days |
pk |
|
searcher efficiency that matches the output of ppersist
Calculate the conditional probability of observing a carcass at search oi as a function arrival interval (assuming carcass is not removed by scavengers before the time of the final search)
SEsi_left(oi, pk, rng = NULL)
SEsi_left(oi, pk, rng = NULL)
oi |
number of searches after arrival |
pk |
numeric array of searcher efficiency p and k parameters (p = pk[ , 1] and k = pk[ , 2]) |
rng |
optional parameter giving the range of intervals to consider |
numeric array of probability of observing a carcass at oi for
given that it arrived in intervals 1:oi if rng = NULL (or in intervals
rng
), assuming the carcass had not been previously discovered or
removed by scavengers
Calculate the conditional probability of observing a carcass after i = 1:nsi searches (assuming carcass is not previous discovered by searchers or removed by scavengers)
SEsi_right(nsi, pk)
SEsi_right(nsi, pk)
nsi |
number of searches after arrival |
pk |
numeric array of searcher efficiency p and k parameters (p = pk[ , 1] and k = pk[ , 2]) |
numeric nsi x dim(pk)[1] array of probabilities of observing a carcass after 1:nsi searches (assuming that the carcass had not been previously discovered or removed by scavengers
Calculate searcher efficiency after some searches for a single pk combination
SEsi0(days, pk)
SEsi0(days, pk)
days |
search days |
pk |
pk combination |
searcher efficiency that matches the output of ppersist
Function underneath plot.estM
, which
defines the plot method for a mortality object, composed of a hisogram
with the empirical PDF and summary statistics
simpleMplot(M, ..., Xmin = 0, CL = 0.9)
simpleMplot(M, ..., Xmin = 0, CL = 0.9)
M |
Mortality object |
... |
arguments to pass down |
Xmin |
minimum number of observable carcasses |
CL |
confidence level |
Simple function to facilitate selection of columns that could be carcass class values from a data table.
sizeCols(data)
sizeCols(data)
data |
data table |
column names of columns that can be carcass class values
An example data set for estimating fatalities from a concentrating solar-thermal (power tower) generation facility.
The simulated site consists of a single tower generating approximately 130 MW. The tower is surrounded by a 250 meter radius circular inner field of heliostats, searched on a weekly schedule. From the inner circle, 18 concentric rings of heliostats 50 meters deep extend to the boundaries of the simulated site. Rings are subdivided into 8 arcs each, with arcs 1-8 immediately adjacent to the central circle. Arcs are search using distance sampling techniques on a weekly schedule, with 29 arcs searched per weekday.
There are two sources of mortality simulated: flux and non-flux (collision or unknown cause).Flux carcasses are generated (weibull) about the tower, with 5% to be found in the outer field. Non-flux mortality is assumed uniform across the site.
The dataset consists of five parts: Data on carcass observations (CO) from inner and outer heliostat searches, field trials for estimating carcass persistence (CP) and searcher efficiency (SE), search schedule (SS), and density weighted proportion (DWP) of area searched at each turbine (which is an area adjustment factor to account for incomplete search coverage).
solar_powerTower
solar_powerTower
solar_powerTower
is a list with 5 elements:
SE
Searcher efficiency trial data
CP
Carcass persistence trial data
SS
Search schedule parameters
DWP
Density weighted proportion of area searched
CO
Carcass observations
SE
)$SE
is a data frame with each row representing the fate of a single
carcass in the searcher efficiency trials. There are columns for:
Season
"winter"
, "spring"
, "summer"
, or
"fall"
Size
"bat"
; or "lrg"
, "med"
, or
"sml"
bird
Field
indicates carcass placed in inner or outer heliostat
field, with levels "inner"
or outer
.
"Search1",...,"Search5"
fate of carcass on the 1st, 2nd, 3rd,
4th, and 5th search after placement. A value of 1 implies that a carcass
was discovered by searchers, 0 implies the carcass was present but not
discovered, and any other value is interpreted as "no search" or
"carcass not present" and ignored in the model. In this data set,
NA
indicates that a carcass had been previously discovered and
removed from the field. A user may use a variety of values to
differentiate different reasons no search was conducted or the carcass
was not present. For example, "NS" to indicate the search
was not scheduled in that location at that time, or "SC" to indicate the
carcass had been removed by scavengers prior to the search.
CP
)$CP
is a data frame with each row representing the fate of a single
carcass in the carcass persistence trials. There are columns for:
cpID
unique ID for each carcass
Season
"winter"
, "spring"
, "summer"
, or
"fall"
Size
"bat"
; or "lrg"
, "med"
, or
"sml"
bird
LastPresent
, FirstAbsent
endpoints of the interval bracketing
the time the carcass was scavenged or otherwise removed from the field.
For example, LastPresent = 2.04
, FirstAbsent = 3.21
indicates that the
carcass was last observed 2.04 days after being placed in the field and
was noted missing 3.21 days after being placed. If the precise time of
carcass removal is known (e.g., recorded by camera), then LastPresent
and
FirstAbsent
should be set equal to each other. If a carcass persists
beyond the last day of the field trial, LastPresent
is the last time it
was observed and FirstAbsent
is entered as Inf
or NA
.
SS
)$SS
is a data frame with a row for each date an arc at the site
was searched, a column of SearchDate
s, and a column for each arc, and
one column at the end for the inner heliostat field, labeled center
.
In addition, there is a column to indicate the Season
. A column with
search dates and columns for each distinct area (arcs and center) searched
are required. Other columns are optional.
SearchDate
columns of dates on which an arc was searched.
Format in this data is "%Y-%m-%d CDT"
, but time zone (CDT
)
is optional. A time stamp may be included if desired (e.g.,
2018-03-20 02:15:41
). Alternatively, \
can be used in place
of -
.
Season
"winter"
, "spring"
, "summer"
, or
"fall"
to indicate which season the search was conducted in.
Season
is optional but may be used as a temporal covariate for
fatality estimates.
DWP
)$DWP
is a data frame with a row for each arc and columns for each
carcass size class (labels must match those of the class factors in the
carcass observation file). Values represent the density-weighted proportion
of the searched area for each size (or the fraction of carcasses that fall
in the searched area). In this example, within the inner field (center)
observers are unobstructed in ability to discover carcasses, for a DWP of 1.
In the outer heliostat field observers walk along transects separated by 50
meters, but the entire area is surveyed, so DWP = 1.
Unit
unique ID for each arc, plus one labeled center
for the inner heliostat field. IDs match those used in the $CO
data
frame and the column names in the $SS
data.
bat
DWP associated with size class Bat
sml
DWP associated with size class Small
med
DWP associated with size class Medium
lrg
DWP associated with size class Large
CO
)$CO
is a data frame with a row for carcass observed in the carcass
searches and a number of columns giving information about the given
carcass (date found, size, species, etc.)
carcID
unique identifier for each carcass.
Unit
identifier for which unit the given carcass was found
at: "arc19"
, "arc65"
, etc, for arcs in the outer heliostat
field, or "center"
, indicating the inner heliostat field.
Species
species of the carcass: "BA"
, "BB"
,
"BC"
, "BD"
, "BE"
, "LA"
, "LB"
,
"LD"
, "LE"
, "MA"
, "MB"
, "SA"
,
"SB"
, "SC"
, "SD"
, "SE"
, "SF"
,
"SG"
Size
size: "bat"
, "lrg"
, "med"
,
"sml"
Season
"winter"
, "spring"
, "summer"
, or
"fall"
Flux
An optional field indicating whether there Was evidence
the animal was killed by flux. "TRUE"
, or "False"
.
Field
Optional indicator of whether the animal found in the
"inner"
or "outer"
heliostat field?
Ring
Optional note animals found in the outer heliostat field indicating which concentric ring the carcass was found in.
Distance
Optional note animals found in the outer heliostat field representing the perpendicular distance from the searcher the carcass was discovered at.
DateFound
dates entered in the same format as in
$SS$SearchDate
. Every date entered here is (and must be) included
in the search schedule ($SS$SearchDate
X
Distance in meters from the Western edge of the facility.
Y
Distance in meters from the Southern edge of the facility.
solar_powerTower
An example data set for estimating fatalities from a large photovoltaic solar generation facility.
The simulated site is organized into 300 arrays of panels. As observers walk north-south along paths between arrays, they look east or west down rows between solar panels 150 meters long, with 38 searchable rows per array. Observers consistently look for animals down one cardinal direction, making this a one-sided distance sample. Searches are scheduled on a seven day rotation, with 60 arrays searched per weekday. A sitewide clearout search is implemented before the first scheduled winter search.
The dataset consists of five parts: Data on carcass observations (CO) from array searches, field trials for estimating carcass persistence (CP) and searcher efficiency (SE), search schedule (SS), and density weighted proportion (DWP) of area searched at each array (which is an area adjustment factor to account for incomplete search coverage).
solar_PV
solar_PV
solar_PV
is a list with 5 elements:
SE
Searcher efficiency trial data
CP
Carcass persistence trial data
SS
Search schedule parameters
DWP
Density weighted proportion of area searched
CO
Carcass observations
SE
)$SE
is a data frame with each row representing the fate of a single
carcass in the searcher efficiency trials. There are columns for:
Season
"winter"
, "spring"
, "summer"
, or
"fall"
Size
"bat"
; or "lrg"
, "med"
, or
"sml"
bird
"Search1",...,"Search5"
fate of carcass on the 1st, 2nd, 3rd,
4th, and 5th search after placement. A value of 1 implies that a carcass
was discovered by searchers, 0 implies the carcass was present but not
discovered, and any other value is interpreted as "no search" or
"carcass not present" and ignored in the model. In this data set,
NA
indicates that a carcass had been previously discovered and
removed from the field. A user may use a variety of values to
differentiate different reasons no search was conducted or the carcass
was not present. For example, "NS" to indicate the search
was not scheduled in that location at that time, or "SC" to indicate the
carcass had been removed by scavengers prior to the search.
Distance
the distance a carcass was placed from the observer's transect. Used in determining probability to detect with distance sampling.
CP
)$CP
is a data frame with each row representing the fate of a single
carcass in the carcass persistence trials. There are columns for:
Index
unique ID for each carcass
Season
"winter"
, "spring"
, "summer"
, or
"fall"
Size
"bat"
; or "lrg"
, "med"
, or
"sml"
bird
LastPresent
, FirstAbsent
endpoints of the interval bracketing
the time the carcass was scavenged or otherwise removed from the field.
For example, LastPresent = 2.04
, FirstAbsent = 3.21
indicates that the
carcass was last observed 2.04 days after being placed in the field and
was noted missing 3.21 days after being placed. If the precise time of
carcass removal is known (e.g., recorded by camera), then LastPresent
and
FirstAbsent
should be set equal to each other. If a carcass persists
beyond the last day of the field trial, LastPresent
is the last time it
was observed and FirstAbsent
is entered as Inf
or NA
.
SS
)$SS
is a data frame with a row for each date an array at the site was
searched, a column of SearchDate
s, and a column for each array. In
addition, there is an optional column to indicate the Season
. The
columns for distinct area (array) and the date column are required, and the
names of the columns for search areas must match the names of areas used in
the DWP and CO files.
SearchDate
columns of dates when arrays were searched. Format
in this data is "%Y-%m-%d CDT"
, but time zone (CDT
) is
optional. A time stamp may be included if desired (e.g.,
2018-03-20 02:15:41
). Alternatively, \
can be used in
place of -
.
Season
"winter"
, "spring"
, "summer"
,
or "fall"
to indicate which season the search was conducted in.
Season
is optional but may be used as a temporal covariate for
fatality estimates.
DWP
)$DWP
is a data frame with a row for each array and columns for each
carcass size class (labels must match those of the class factors in the
carcass observation file). Values represent the density-weighted proportion
of the searched area for each size (or the fraction of carcasses that fall
in the searched area). In this example, observers walk along transects
separated by 150 meters, and search coverage is assumed to be 100
DWP = 1 for each unit. This requires that carcasses be placed at random
locations in the field, even at distances from the transects that would make
it unlikely to observe small carcasses.
Unit
unique ID for each array. IDs match those used in the
$CO
data frame and the column names in the $SS
data.
bat
DWP associated with size class Bat
sml
DWP associated with size class Small
med
DWP associated with size class Medium
lrg
DWP associated with size class Large
CO
)$CO
is a data frame with a row for carcass observed in the carcass
searches and a number of columns giving information about the given
carcass (date found, size, species, etc.)
Index
unique identifier for each carcass.
Unit
identifier for which unit the given carcass was found
at: "arc19"
, "arc65"
, etc, for arcs in the outer heliostat
field, or "center"
, indicating the inner heliostat field.
Species
species of the carcass: "BA"
, "BB"
,
"BC"
, "BD"
, "BE"
, "LA"
, "LB"
,
"LD"
, "LE"
, "MA"
, "MB"
, "SA"
,
"SB"
, "SC"
, "SD"
, "SE"
, "SF"
,
"SG"
Size
size: "bat"
, "lrg"
, "med"
,
"sml"
Row
Optional indicator of which row within an array a carcass was found at.
Distance
The perpendicular distance from the searcher's transect at which the carcass was discovered at.
DateFound
dates entered in the same format as in
$SS$SearchDate
. Every date entered here is (and must be) included in
the search schedule
($SS$SearchDate
X
UTM Easting of carcass.
Y
UTM Northing of carcass.
solar_PV
An example data set for estimating fatalities from a trough-based solar thermal electric power generation facility. The simulated site is inspected daily along ten 2000 meter long transects, which run north-south. Observers look up to 150 meters away down the rows created by troughs (east-west). One sided distance sampling will be used, with observers looking consistently in one cardinal direction as they travel through the facility. A sitewide clearout search is implemented before the first scheduled winter search.
The dataset consists of five parts: Data on carcass observations (CO) from daily searches, field trials for estimating carcass persistence (CP) and searcher efficiency (SE), search schedule (SS), and density weighted proportion (DWP) of area searched for the rows within each transect (which is an area adjustment factor to account for incomplete search coverage).
solar_trough
solar_trough
solar_trough
is a list with 5 elements:
SE
Searcher efficiency trial data
CP
Carcass persistence trial data
SS
Search schedule parameters
DWP
Density weighted proportion of area searched
CO
Carcass observations
SE
)$SE
is a data frame with each row representing the fate of a single
carcass in the searcher efficiency trials. There are columns for:
Season
"winter"
, "spring"
, "summer"
, or
"fall"
Size
"bat"
; or "lrg"
, "med"
, or
"sml"
bird
"Search1",...,"Search5"
fate of carcass on the 1st, 2nd, 3rd,
4th, and 5th search after placement. A value of 1 implies that a carcass
was discovered by searchers, 0 implies the carcass was present but not
discovered, and any other value is interpreted as "no search" or
"carcass not present" and ignored in the model. In this data set,
NA
indicates that a carcass had been previously discovered and
removed from the field. A user may use a variety of values to
differentiate different reasons no search was conducted or the carcass
was not present. For example, "NS" to indicate the search
was not scheduled in that location at that time, or "SC" to indicate the
carcass had been removed by scavengers prior to the search.
Distance
the distance a carcass was placed from the observer's transect.
CP
)$CP
is a data frame with each row representing the fate of a single
carcass in the carcass persistence trials. There are columns for:
Index
unique ID for each carcass
Season
"winter"
, "spring"
, "summer"
, or
"fall"
Size
"bat"
; or "lrg"
, "med"
, or
"sml"
bird
LastPresent
, FirstAbsent
endpoints of the interval bracketing the
time the carcass was scavenged or otherwise removed from the field. For
example, LastPresent = 2.04
, FirstAbsent = 3.21
indicates that the carcass
was last observed 2.04 days after being placed in the field and was noted
missing 3.21 days after being placed. If the precise time of carcass
removal is known (e.g., recorded by camera), then LastPresent
and
FirstAbsent
should be set equal to each other. If a carcass persists
beyond the last day of the field trial, LastPresent
is the last time it was
observed and FirstAbsent
is entered as Inf
or NA
.
SS
)$SS
is a data frame with a row for each date a transect at the site
was searched, a column of SearchDate
s, and a column for each
transect. In addition, there is an optional column to indicate the
Season
. The columns for distinct area (array) and the date column
are required, and the names of the columns for search areas must match the
names of areas used in the DWP and CO files.
SearchDate
columns of dates when a transect was searched.
Format in this data is "%Y-%m-%d CDT"
, but time zone (CDT
)
is optional. A time stamp may be included if desired (e.g.,
2018-03-20 02:15:41
). Alternatively, \
can be used in
place of -
.
Season
"winter"
, "spring"
, "summer"
, or
"fall"
to indicate which season the search was conducted in.
Season
is optional but may be used as a temporal covariate for
fatality estimates.
DWP
)$DWP
is a data frame with a row for each transect and columns for
each carcass size class (labels must match those of the class factors in the
carcass observation file). Values represent the density-weighted proportion
of the searched area for each size (or the fractionof carcasses that fall
in the searched area). Since the whole site was searched, DWP is uniformly
set equal to 1.
Unit
unique ID for each transect. IDs match those used in
the $CO
data frame and the column names in the $SS
data.
bat
DWP associated with size class Bat
sml
DWP associated with size class Small
med
DWP associated with size class Medium
lrg
DWP associated with size class Large
CO
)$CO
is a data frame with a row for carcass observed in the carcass
searches and a number of columns giving information about the given carcass
(date found, size, species, etc.)
Index
unique identifier for each carcass.
Unit
identifier for which transect the given carcass was found at. Values must match with DWP Transect values Search Schedule column names.
Species
species of the carcass: "BA"
, "BB"
,
"BC"
, "BD"
, "BE"
, "LA"
, "LB"
,
"LD"
, "LE"
, "MA"
, "MB"
, "SA"
,
"SB"
, "SC"
, "SD"
, "SE"
, "SF"
,
"SG"
Size
size: "bat"
, "lrg"
, "med"
,
"sml"
Row
Optional indicator of which row within an array a carcass was found at.
Distance
The perpendicular distance from the searcher's transect at which the carcass was discovered at.
DateFound
dates entered in the same format as in
$SS$SearchDate
.
Every date entered here is (and must be) included in the search schedule
($SS$SearchDate
)
X
UTM Easting of carcass.
Y
UTM Northing of carcass.
solar_trough
summary
defined for class estM
objects
## S3 method for class 'estM' summary(object, ..., CL = 0.9)
## S3 method for class 'estM' summary(object, ..., CL = 0.9)
object |
|
... |
arguments to pass down |
CL |
confidence level |
methods for summary
applied to a gGeneric
list
## S3 method for class 'gGeneric' summary(object, ..., CL = 0.9)
## S3 method for class 'gGeneric' summary(object, ..., CL = 0.9)
object |
gGeneric output list (each element is a named vector of gGeneric values for a cell in the model combinations) |
... |
arguments to be passed down |
CL |
confidence level |
a summary table of g values (medians and confidence bounds) for each cell combination within the gGeneric list
data(mock) model_SE <- pkm(formula_p = p ~ HabitatType, formula_k = k ~ 1, data = mock$SE) model_CP <- cpm(formula_l = l ~ Visibility, formula_s = s ~ Visibility, data = mock$CP, left = "LastPresentDecimalDays", right = "FirstAbsentDecimalDays") avgSS <- averageSS(mock$SS) ghatsGeneric <- estgGeneric(nsim = 1000, avgSS, model_SE, model_CP) summary(ghatsGeneric)
data(mock) model_SE <- pkm(formula_p = p ~ HabitatType, formula_k = k ~ 1, data = mock$SE) model_CP <- cpm(formula_l = l ~ Visibility, formula_s = s ~ Visibility, data = mock$CP, left = "LastPresentDecimalDays", right = "FirstAbsentDecimalDays") avgSS <- averageSS(mock$SS) ghatsGeneric <- estgGeneric(nsim = 1000, avgSS, model_SE, model_CP) summary(ghatsGeneric)
methods for summary
applied to a gGenericSize
list
## S3 method for class 'gGenericSize' summary(object, ..., CL = 0.9)
## S3 method for class 'gGenericSize' summary(object, ..., CL = 0.9)
object |
gGenericSize output list (each element is a size-named list of named vectors of gGeneric values for a cell in the model combinations) |
... |
arguments to be passed down |
CL |
confidence level |
a list of summary tables of g values (medians and confidence bounds) for each cell combination within the gGeneric list
data(mock) pkmModsSize <- pkm(formula_p = p ~ HabitatType, formula_k = k ~ HabitatType, data = mock$SE, obsCol = c("Search1", "Search2", "Search3", "Search4"), sizeCol = "Size", allCombos = TRUE) cpmModsSize <- cpm(formula_l = l ~ Visibility, formula_s = s ~ Visibility, data = mock$CP, left = "LastPresentDecimalDays", right = "FirstAbsentDecimalDays", dist = c("exponential", "lognormal"), sizeCol = "Size", allCombos = TRUE) pkMods <- c("S" = "p ~ 1; k ~ 1", "L" = "p ~ 1; k ~ 1", "M" = "p ~ 1; k ~ 1", "XL" = "p ~ 1; k ~ 1" ) cpMods <- c("S" = "dist: exponential; l ~ 1; NULL", "L" = "dist: exponential; l ~ 1; NULL", "M" = "dist: exponential; l ~ 1; NULL", "XL" = "dist: exponential; l ~ 1; NULL" ) avgSS <- averageSS(mock$SS) gsGeneric <- estgGenericSize(nsim = 1000, days = avgSS, modelSetSize_SE = pkmModsSize, modelSetSize_CP = cpmModsSize, modelSizeSelections_SE = pkMods, modelSizeSelections_CP = cpMods ) summary(gsGeneric)
data(mock) pkmModsSize <- pkm(formula_p = p ~ HabitatType, formula_k = k ~ HabitatType, data = mock$SE, obsCol = c("Search1", "Search2", "Search3", "Search4"), sizeCol = "Size", allCombos = TRUE) cpmModsSize <- cpm(formula_l = l ~ Visibility, formula_s = s ~ Visibility, data = mock$CP, left = "LastPresentDecimalDays", right = "FirstAbsentDecimalDays", dist = c("exponential", "lognormal"), sizeCol = "Size", allCombos = TRUE) pkMods <- c("S" = "p ~ 1; k ~ 1", "L" = "p ~ 1; k ~ 1", "M" = "p ~ 1; k ~ 1", "XL" = "p ~ 1; k ~ 1" ) cpMods <- c("S" = "dist: exponential; l ~ 1; NULL", "L" = "dist: exponential; l ~ 1; NULL", "M" = "dist: exponential; l ~ 1; NULL", "XL" = "dist: exponential; l ~ 1; NULL" ) avgSS <- averageSS(mock$SS) gsGeneric <- estgGenericSize(nsim = 1000, days = avgSS, modelSetSize_SE = pkmModsSize, modelSetSize_CP = cpmModsSize, modelSizeSelections_SE = pkMods, modelSizeSelections_CP = cpMods ) summary(gsGeneric)
Mortality estimates can be calculated for the various levels
of splitting covariates such as season, species, or visibility class
using calcSplits
, which gives full arrays of simulated M
estimates (i.e., for each level of each splitting covariate, each
discovered carcass, and each simulation draw). summary(splits, CL = 0.90,
...) gives summary statistics of the estimates.
## S3 method for class 'splitFull' summary(object, CL = 0.9, ...)
## S3 method for class 'splitFull' summary(object, CL = 0.9, ...)
object |
A |
CL |
desired confidence level for summary CIs (numeric scalar in (0, 1)) |
... |
to be passed down |
an object of class splitSummary
, which gives 5-number
summaries for all combinations of levels among the splitting covariates
in the splits
. The 5-number summaries include the mean and
alpha/2, 0.25, 0.5, 0.75, and 1 - alpha/2 quantiles of mortality
estimates, where alpha = 1 - CL. A graphical representation of the
results can be produced using plot(splits, CL, ...)
. For splits
along CO covariates, the levels are organized alphabetically (but with
numeric suffixes appearing in numeric order, e.g., "t1", "t2", "t10"
rather than "t1", "t10", "t2").
Remove bad fit models
tidyModelSetCP(modelSet)
tidyModelSetCP(modelSet)
modelSet |
cp model set of class cpmSet |
a trimmed model set
Remove bad fit models
tidyModelSetSE(modelSet)
tidyModelSetSE(modelSet)
modelSet |
pk model set of class pkmSet |
a trimmed model set
splitFull
array (preserving attributes)Transpose a splitFull
array (preserving attributes)
transposeSplits(splits)
transposeSplits(splits)
splits |
a |
a list of m
n
x k
arrays as a splitFull
object
Select a single model from each carcass class (based on the model names).
trimSetSize(modSetSize, mods)
trimSetSize(modSetSize, mods)
modSetSize |
modSetSize complex (cpm or pkm) |
mods |
named (according to carcass classes) vector of model names to use |
modSetSize reduced to a single model per carcass class
When an event occurs in the GenEst GUI, the input values may need to be updated. This function contains all of the possible updates based on the event options (or lacks any updates if the event doesn't require any).
update_input(eventName, rv, input, session)
update_input(eventName, rv, input, session)
eventName |
Character name of the event. One of "clear_all", "file_SE", "file_SE_clear", "file_CP", "file_CP_clear", "file_SS", "file_SS_clear", "file_DWP", "file_DWP_clear", "file_CO", "file_CO_clear", "class", "obsSE", "predsSE", "run_SE", "run_SE_clear", "outSEclass", "outSEp", "outSEk", "ltp", "fta", "predsCP", "run_CP", "run_CP_clear", "outCPclass", "outCPdist", "outCPl", "outCPs", "run_M", "run_M_clear", "split_M", "split_M_clear", "transpose_split", "run_g", "run_g_clear", or "outgclass". |
rv |
Reactive values list for the GenEst GUI. |
input |
|
session |
Environment for the GenEst GUI. |
When an event occurs in the GenEst GUI, the output values may need to be updated. This function contains all of the possible updates based on the event options (or lacks any updates if the event doesn't require any).
update_output(eventName, rv, output, input)
update_output(eventName, rv, output, input)
eventName |
Character name of the event. One of "clear_all", "file_SE", "file_SE_clear", "file_CP", "file_CP_clear", "file_SS", "file_SS_clear", "file_DWP", "file_DWP_clear", "file_CO", "file_CO_clear", "class", "obsSE", "predsSE", "run_SE", "run_SE_clear", "outSEclass", "outSEp", "outSEk", "ltp", "fta", "predsCP", "run_CP", "run_CP_clear", "outCPclass", "outCPdist", "outCPl", "outCPs", "run_M", "run_M_clear", "split_M", "split_M_clear", "transpose_split", "run_g", "run_g_clear", or "outgclass". |
rv |
Reactive values list for the GenEst GUI. |
output |
|
input |
|
Updated output
list.
When an event occurs in the GenEst GUI, the reactive values need to be updated. This function contains all of the possible updates based on the event options.
update_rv(eventName, rv, input)
update_rv(eventName, rv, input)
eventName |
Character name of the event. One of "clear_all", "file_SE", "file_SE_clear", "file_CP", "file_CP_clear", "file_SS", "file_SS_clear", "file_DWP", "file_DWP_clear", "file_CO", "file_CO_clear", "class", "obsSE", "predsSE", "run_SE", "run_SE_clear", "outSEclass", "outSEp", "outSEk", "ltp", "fta", "predsCP", "run_CP", "run_CP_clear", "outCPclass", "outCPdist", "outCPl", "outCPs", "run_M", "run_M_clear", "split_M", "split_M_clear", "transpose_split", "run_g", "run_g_clear", "outgclass", "load_RP", "load_RPbat", "load_cleared", "load_PV", "load_trough", "load_powerTower", or "load_mock" |
rv |
Reactive values list for the GenEst GUI, created by
|
input |
|
Updated rv
list.
A complete example data set for estimating fatalities from 60 m cleared plots at 23 out of 100 searches at a wind power facility. Data on carcass observations (CO) from a search of all terrain out to 60m from each of 100 turbines at a theoretical site, field trials for estimating carcass persistence (CP) and searcher efficiency (SE), search schedule (SS) parameters (for example, which turbines were searched on which days), and density weighted proportion (DWP) of area searched at each turbine (which is an area adjustment factor to account for incomplete search coverage).
wind_cleared
wind_cleared
wind_cleared
is a list with 5 elements:
SE
Searcher efficiency trial data
CP
Carcass persistence trial data
SS
Search schedule parameters
DWP
Density weighted proportion of area searched
CO
Carcass observations
SE
)$SE
is a data frame with each row representing the fate of a single
carcass in the searcher efficiency trials. There are columns for:
pkID
unique ID for each carcass
Size
"bat"
; or "lrg"
, "med"
, or
"sml"
bird
Season
"spring"
, "summer"
, or "fall"
Visibility
indicator for visibility class of the ground, with
"RP"
for carcasses placed on a road or turbine pad, "M"
for moderate visibility (e.g., plowed field; short, sparse vegetation),
or "D"
for difficult visibility
"s1",...,"s5"
fate of carcass on the 1st, 2nd, 3rd, 4th, and
5th search after placement. A value of 1 implies that a carcass was
discovered by searchers, 0 implies the carcass was present but not
discovered, and any other value is interpreted as "no search" or
"carcass not present" and ignored in the model. In this data set,
NA
indicates that a carcass had been previously discovered and
removed from the field. A user may use a variety of values to
differentiate different reasons no search was conducted or the carcass
was not present. For example, "SN" could be used to indicate that the
turbine was not searched because of snow, or "NS" to indicate the search
was not scheduled in that location at that time, or "SC" to indicate the
carcass had been removed by scavengers prior to the search.
CP
)$CP
is a data frame with each row representing the fate of a single
carcass in the carcass persistence trials. There are columns for:
cpID
unique ID for each carcass
Size
"bat"
; or "lrg"
, "med"
, or
"sml"
bird
Season
"spring"
, "summer"
, or "fall"
Visibility
indicator for visibility class of the ground, with
"RP"
for carcasses placed on a road or turbine pad, "M"
for
moderate visibility (e.g., plowed field; short, sparse vegetation), or
"D"
for difficult visibility.
LastPresent
,
FirstAbsent
endpoints of the interval bracketing the time the carcass
was scavenged or otherwise removed from the field. For example,
LastPresent = 2.04
, FirstAbsent = 3.21
indicates that the carcass was
last observed 2.04 days after being placed in the field and was noted
missing 3.21 days after being placed. If the precise time of carcass
removal is known (e.g., recorded by camera), then LastPresent
and
FirstAbsent
should be set equal to each other. If a carcass persists
beyond the last day of the field trial, LastPresent
is the last time it
was observed and FirstAbsent
is entered as Inf
or NA
.
SS
)$SS
is a data frame with a row for each date a turbine at the site
was searched, a column of SearchDate
s, and a column for each turbine.
In addition, there is a column to indicate the Season
. A column with
search dates and columns for each turbine searched are required. Other
columns are optional.
SearchDate
columns of dates on which at least one turbine was
searched. Format in this data is "%Y-%m-%d CDT"
, but time zone
(CDT
) is optional. A time stamp may be included if desired (e.g.,
2018-03-20 02:15:41
). Alternatively, \
can be used in place
of -
.
Season
"spring"
, "summer"
, or "fall"
to
indicate which season the search was conducted in. Season
is
optional but may be used as a temporal covariate for fatality estimates.
t1
, etc.unique ID for all turbines that were searched on at least one search date. Values are either 1 or 0, indicating whether the given turbine (column) was searched or not on the given date (row).
DWP
)$DWP
is a data frame with a row for each turbine and columns for
each carcass size class. Values represent the density-weighted proportion
of the searched area for each size (or the fraction of carcasses that fall
in the searched area).
Turbine
unique ID for each turbine. IDs match those used in
the $CO
data frame and the column names in the $SS
data.
Size
bat
, sml
, med
, lrg
Season
"spring"
, "summer"
, or "fall"
to
indicate which season the search was conducted in. Season
is
optional but may be used as a temporal covariate for fatality estimates.
CO
)$CO
is a data frame with a row for carcass observed in the carcass
searches and a number of columns giving information about the given carcass
(date found, size, species, etc.)
carcID
unique identifier for each carcass: "x30"
,
"x46"
, etc.
Turbine
identifier for which turbine the given carcass was
found at: "t19"
, "t65"
, "t49"
, etc.
TurbineType
the type of turbine: "X"
, "Y"
or
"Z"
.
DateFound
dates entered in the same format as in
$SS$SearchDate
. Every date entered here is (and must be) included
in the search schedule ($SS$SearchDate
)
Visibility
visibility class: "RP"
, "M"
, or
"D"
, as described in $CP
and $SE
Species
species of the carcass: "BA"
, "BB"
,
"BC"
, "BD"
, "BE"
, "LA"
, "LB"
,
"LD"
, "LE"
, "MA"
, "MB"
, "SA"
,
"SB"
, "SC"
, "SD"
, "SE"
, "SF"
,
"SG"
SpeciesGroup
species group: "bat0"
, "bat1"
,
"brd1"
, "brd2"
, "brd3"
Size
size: "bat"
, "lrg"
, "med"
,
"sml"
Distance
distance from the turbine
wind_cleared
This example dataset is based on 120 m radius road and pad searches of all 100 turbines at a theoretical site. The simulated site consists of 100 turbines, searched on roads and pads only, out to 120 meters. Search schedule differs by turbine and season, with more frequent searches in the fall, and a subset of twenty turbines searched at every scheduled search.
Data on carcass observations (CO) from searches, field trials for estimating carcass persistence (CP) and searcher efficiency (SE), search schedule (SS) parameters (for example, which turbines were searched on which days), and density weighted proportion (DWP) of area searched at each turbine (which is an area adjustment factor to account for incomplete search coverage).
wind_RP
wind_RP
wind_RP
is a list with 5 elements:
SE
Searcher efficiency trial data
CP
Carcass persistence trial data
SS
Search schedule parameters
DWP
Density weighted proportion of area searched
CO
Carcass observations
SE
)$SE
is a data frame with each row representing the fate of a single
carcass in the searcher efficiency trials. There are columns for:
pkID
unique ID for each carcass
Size
"bat"
; or "lrg"
, "med"
, or
"sml"
bird
Season
"spring"
, "summer"
, or "fall"
"s1",...,"s5"
fate of carcass on the 1st, 2nd, 3rd, 4th, and
5th search after placement. A value of 1 implies that a carcass was
discovered by searchers, 0 implies the carcass was present but not
discovered, and any other value is interpreted as "no search" or
"carcass not present" and ignored in the model. In this data set,
NA
indicates that a carcass had been previously discovered and
removed from the field. A user may use a variety of values to
differentiate different reasons no search was conducted or the carcass
was not present. For example, "SN" could be used to indicate that the
turbine was not searched because of snow, or "NS" to indicate the search
was not scheduled in that location at that time, or "SC" to indicate the
carcass had been removed by scavengers prior to the search.
CP
)$CP
is a data frame with each row representing the fate of a single
carcass in the carcass persistence trials. There are columns for:
cpID
unique ID for each carcass
Size
"bat"
; or "lrg"
, "med"
, or
"sml"
bird.
Season
"spring"
, "summer"
, or "fall"
LastPresent
, FirstAbsent
endpoints of the interval bracketing the
time the carcass was scavenged or otherwise removed from the field. For
example, LastPresent = 2.04
, FirstAbsent = 3.21
indicates that the carcass
was last observed 2.04 days after being placed in the field and was noted
missing 3.21 days after being placed. If the precise time of carcass
removal is known (e.g., recorded by camera), then LastPresent
and
FirstAbsent
should be set equal to each other. If a carcass persists
beyond the last day of the field trial, LastPresent
is the last time it
was observed and FirstAbsent
is entered as Inf
or NA
.
SS
)$SS
is a data frame with a row for each date a turbine at the site
was searched, a column of SearchDate
s, and a column for each turbine.
In addition, there is a column to indicate the Season
. A column with
search dates and columns for each turbine searched are required. Other
columns are optional.
SearchDate
columns of dates on which at least one turbine was
searched. Format in this data is "%Y-%m-%d CDT"
, but time zone
(CDT
) is optional. A time stamp may be included if desired
(e.g., 2018-03-20 02:15:41
). Alternatively, \
can be used
in place of -
.
Season
"spring"
, "summer"
, or "fall"
to
indicate which season the search was conducted in. Season
is
optional but may be used as a temporal covariate for fatality estimates.
t1
, etc.unique ID for all turbines that were searched on at least one search date. Values are either 1 or 0, indicating whether the given turbine (column) was searched or not on the given date (row).
DWP
)$DWP
is a data frame with a row for each turbine and columns for
each carcass size class. Values represent the density-weighted proportion
of the searched area for each size (or the fraction of carcasses that fall
in the searched area).
Turbine
unique ID for each turbine. IDs match those used in
the $CO
data frame and the column names in the $SS
data.
bat
DWP associated with size class Bat.
sml
DWP associated with size class Small.
med
DWP associated with size class Medium.
lrg
DWP associated with size class Large.
CO
)$CO
is a data frame with a row for carcass observed in the carcass
searches and a number of columns giving information about the given
carcass (date found, size, species, etc.)
carcID
unique identifier for each carcass: "x30"
,
"x46"
, etc.
Turbine
identifier for which turbine the given carcass was
found at: "t19"
, "t65"
, "t49"
, etc.
TurbineType
the type of turbine: "X"
, "Y"
or
"Z"
.
DateFound
dates entered in the same format as in
$SS$SearchDate
. Every date entered here is (and must be) included
in the search schedule ($SS$SearchDate
Species
species of the carcass: "BA"
, "BB"
,
"BC"
, "BD"
, "BE"
, "LA"
, "LB"
,
"LD"
, "LE"
, "MA"
, "MB"
, "SA"
,
"SB"
, "SC"
, "SD"
, "SE"
, "SF"
,
"SG"
SpeciesGroup
species group: "bat0"
, "bat1"
,
"brd1"
, "brd2"
, "brd3"
Size
size: "bat"
, "lrg"
, "med"
,
"sml"
Distance
distance from the turbine
wind_RP
This example dataset considers only bats found on 120 m radius road and pad searches of all 100 turbines at a theoretical site. The simulated site consists of 100 turbines, searched on roads and pads only, out to 120 meters. Search schedule differs by turbine and season, with more frequent searches in the fall, and a subset of twenty turbines searched at every scheduled search.
Data on carcass observations (CO) from searches, field trials for estimating carcass persistence (CP) and searcher efficiency (SE), search schedule (SS) parameters (for example, which turbines were searched on which days), and density weighted proportion (DWP) of area searched at each turbine (which is an area adjustment factor to account for incomplete search coverage).
wind_RPbat
wind_RPbat
wind_RPbat
is a list with 5 elements:
SE
Searcher efficiency trial data
CP
Carcass persistence trial data
SS
Search schedule parameters
DWP
Density weighted proportion of area searched
CO
Carcass observations
SE
)$SE
is a data frame with each row representing the fate of a single
carcass in the searcher efficiency trials. There are columns for:
pkID
unique ID for each carcass
Season
"spring"
, "summer"
, or "fall"
"s1",...,"s5"
fate of carcass on the 1st, 2nd, 3rd, 4th, and
5th search after placement. A value of 1 implies that a carcass was
discovered by searchers, 0 implies the carcass was present but not
discovered, and any other value is interpreted as "no search" or
"carcass not present" and ignored in the model. In this data set,
NA
indicates that a carcass had been previously discovered and
removed from the field. A user may use a variety of values to
differentiate different reasons no search was conducted or the carcass
was not present. For example, "SN" could be used to indicate that the
turbine was not searched because of snow, or "NS" to indicate the search
was not scheduled in that location at that time, or "SC" to indicate the
carcass had been removed by scavengers prior to the search.
CP
)$CP
is a data frame with each row representing the fate of a single
carcass in the carcass persistence trials. There are columns for:
cpID
unique ID for each carcass
Season
"spring"
, "summer"
, or "fall"
LastPresent
, FirstAbsent
endpoints of the interval bracketing
the time the carcass was scavenged or otherwise removed from the field.
For example, LastPresent = 2.04
, FirstAbsent = 3.21
indicates that the
carcass was last observed 2.04 days after being placed in the field and
was noted missing 3.21 days after being placed. If the precise time of
carcass removal is known (e.g., recorded by camera), then LastPresent
and
FirstAbsent
should be set equal to each other. If a carcass persists
beyond the last day of the field trial, LastPresent
is the last time it
was observed and FirstAbsent
is entered as Inf
or NA
.
SS
)$SS
is a data frame with a row for each date a turbine at the site
was searched, a column of SearchDate
s, and a column for each turbine.
In addition, there is a column to indicate the Season
. A column with
search dates and columns for each turbine searched are required. Other
columns are optional.
SearchDate
columns of dates on which at least one turbine was
searched. Format in this data is "%Y-%m-%d CDT"
, but time zone
(CDT
) is optional. A time stamp may be included if desired
(e.g., 2018-03-20 02:15:41
). Alternatively, \
can be used
in place of -
.
Season
"spring"
, "summer"
, or "fall"
to
indicate which season the search was conducted in. Season
is
optional but may be used as a temporal covariate for fatality estimates.
t1
, etc.unique ID for all turbines that were searched on at least one search date. Values are either 1 or 0, indicating whether the given turbine (column) was searched or not on the given date (row).
DWP
)$DWP
is a data frame with a row for each turbine and columns for
each carcass size class. Values represent the density-weighted proportion
of the searched area for each size (or the fraction of carcasses that fall
in the searched area).
Turbine
unique ID for each turbine. IDs match those used in
the $CO
data frame and the column names in the $SS
data.
bat
Contains the DWP for each turbine, with respect to size class (in this case, bats only.
CO
)$CO
is a data frame with a row for carcass observed in the carcass
searches and a number of columns giving information about the given
carcass (date found, size, species, etc.)
carcID
unique identifier for each carcass: "x30"
,
"x46"
, etc.
Turbine
identifier for which turbine the given carcass was
found at: "t19"
, "t65"
, "t49"
, etc.
TurbineType
the type of turbine: "X"
, "Y"
or
"Z"
.
DateFound
dates entered in the same format as in
$SS$SearchDate
. Every date entered here is (and must be) included
in the search schedule ($SS$SearchDate
Species
species of the carcass: "BA"
, "BB"
,
"BC"
, "BD"
, "BE"
, "LA"
, "LB"
,
"LD"
, "LE"
, "MA"
, "MB"
, "SA"
,
"SB"
, "SC"
, "SD"
, "SE"
, "SF"
,
"SG"
SpeciesGroup
species group: "bat0"
, "bat1"
,
"brd1"
, "brd2"
, "brd3"
Distance
Distance from the turbine.
wind_RPbat