Learn R Programming

⚠️There's a newer version (1.4.9) of this package.Take me there.

GenEst

GenEst: Generalized Fatality Estimator

GenEst is a tool for estimating mortalities from efficiency, persistence, and carcass data.

DISCLAIMER

This software is preliminary or provisional and is subject to revision. It is being provided to meet the need for timely best science. The software has not received final approval by the U.S. Geological Survey (USGS). No warranty, expressed or implied, is made by the USGS or the U.S. Government as to the functionality of the software and related material nor shall the fact of release constitute any such warranty. The software is provided on the condition that neither the USGS nor the U.S. Government shall be held liable for any damages resulting from the authorized or unauthorized use of the software.

Installation

Setup and installation require several steps. Do not skip any steps.

Updated version of R (>= 3.5.0, released on 23 April 2018):

R is free and open source software for statistical computing. If R is not installed on your computer or if your version of R is <3.5.0, download and install the latest version from https://cran.r-project.org/, following the instructions provided at the site. In particular, "Download" and then "install R for the first time" (if working in Windows), or "Download" and then follow the further instructions on the subsequent web page (if working on Mac OS or Linux-like OS). If you already have an older copy of R installed on your computer, the new version will be installed alongside the old. Unless you know a reason why you want to keep both versions, it is usually a good idea to uninstall the old version to avoid confusion and clutter.

NOTE TO EXPERIENCED R USERS: When you install a new version of R, packages that you previously installed under an older version may not be immediately available to the new R. If not, the easiest way to make them available is to copy the package folders in your old "library" folder into the "library" folder in your new R installation. Then, enter update.packages() in R. If asked about a CRAN mirror, choose the nearest location. If you are working in Windows OS and are asked whether you want to install packages "from source", choose "No".

Third-party packages:

Several third-party pacakges are required; all are free and open source and available from CRAN. The easiest way to install them is to run the following commands in R (with guidance concerning potential dialog boxes given below the commands):


package_new <- c("cbinom", "corpus", "DT", "gsl", "gtools", "htmltools", "lubridate", 
   "matrixStats", "mvtnorm", "Rcpp", "shiny", "shinyjs", "sticky", "survival", "zip")
package_new <- package_new[!(package_new %in% installed.packages()[,"Package"])] 
if(length(package_new) > 0) install.packages(package_new)

-- If asked about a "CRAN mirror", choose the nearest location.

-- If asked whether you want to use a "personal library", choose "Yes"

-- If you are on Windows and are asked whether you want to install packages and their dependencies "from source", choose "No" (unless you are ready to go to lunch, in which case, you can select "Yes" and the installation may well be done by the time you get back).

GenEst:

Click on "Tags" under the "Repository" tab on the left sidebar at https://code.usgs.gov/ecosystems/GenEst and then click the link for the specific release you want.

-- For Windows, download the compressed folder GenEst_1.x.x.zip (do not unzip) and note where it is stored. You will install from the local .zip folder.

-- For Mac OS or Unix-like OS, download the compressed file GenEst_1.x.x.tar.gz and note where it is stored. You will install from the local .tar.gz file.

If you are working directly in R (not R Studio), run the following command:

install.packages(file.choose()) # and navigate to the package archive file you just downloaded: GenEst_1.x.x.xxx

If you are working in R Studio:

Click "Install" in the Packages pane.

Select "Package Archive File (.zip; .tar.gz)" as "Install from:" in the dialog box.

Browse to where you saved the zip file, and open it so it appears in the "Package archive" space.

Click the Install button on the dialog box.

Getting Started

Graphical user interface (GUI): easy-to-use buttons and menus

To start the GUI, open R and enter the command:

library(GenEst)
runGenEst()

Download the User Guide from a link near the bottom of the "Help" page in the app or from https://pubs.usgs.gov/tm/7c19/tm7c19.pdf

R command line: more functionality and flexibility

library(GenEst)
browseVignettes("GenEst")
?GenEst

Also, help files for GenEst functions are accessible in the standard R way, for example:

?pkm

Further Reading

GenEst User Guide: https://doi.org/10.3133/tm7C19

GenEst Statistical Models: https://doi.org/10.3133/tm7A2

Copy Link

Version

Install

install.packages('GenEst')

Monthly Downloads

381

Version

1.2.0

License

CC0

Maintainer

Dan Dalthorp

Last Published

December 6th, 2018

Functions in GenEst (1.2.0)

Ecbinom

Expected value of a continuous binomial with size = 1/g
aicc.pkmSetSize

Create the AICc tables for a list of sets of searcher efficiency models
aicc.pkmSize

Create the AICc tables for a list of sets of searcher efficiency models
combinePreds

Combine predictors
combinePredsAcrossModels

Combine predictors across models
cpmSetSizeFailRemove

Remove failed cpm models from a cpmSetSize object
cpmSetSpecCPCellPlot

Plot cell-specific decay curve for carcass persistence
dlModTabCP

Create the download version of the Carcass Persistence model table
dlModTabSE

Create the download version of the Searcher Efficiency model table
GenEstInlineCSS

Generate the Inline CSS Definition
GenEstServer

The GenEst server definition function
SEsi0

Calculate decayed searcher efficiency for a single pk
downloadMFig

Download the M figure
SEsi_left

Calculate conditional probability of observation at a search
CPcols

Produce a named vector of standard CP plot colors
CPdistOptions

Produce the options for the distributions in the CP model
SEsi_right

Calculate conditional probability of observation after a series of searches
aboutContent

Create the Content for the About Pabel
calcRate

Estimate the number of fatalities in each search interval throughout the monitoring period.
averageSS

Tabulate an average search schedule from a multi-unit SS data table
cButtonStyle

Define Clear Button Style
classText

Prepare class text header
DWPCols

Select the DWP-ok columns from a data table
calcSplits

Estimate the number of fatalities by up to two splitting covariates
checkComponents

Check for model components
downloadSEFig

Download the SE figure
checkDate

Checks whether a vector of data can be interpreted as dates
clearNotifications

Clear all notifications
kFixedWidget

Make a kFixed Widget
GenEstShinyJS

Shiny Java Script (via shinyjs) Enabler
cpmFail

Check if a CP model is well-fit
cpm

Fit cp carcass persistence models
DWPbyCarcass

Assign DWP value to each carcass
cpmCPCellPlot

Plot cell-specific decay curve for carcass persistence
aicc.cpmSetSize

Create the AICc tables for a list of sets of searcher efficiency models
aicc.cpmSet

Create the AICc tables for a set of carcass persistence models
calcTsplit

Estimate the number of fatalities by time interval
countCarcs

Count the minimum number of carcasses in the cells
calcg

Calculate cell-level generic detection probability
GenEstUI

Create the GenEst User Interface HTML
cpmSetFail

Check if cpm models fail
dataInputWidget

Create a Data Input Widget for the GenEst User Interface HTML
logit

Compute the logit or anti-logit
modelSetModelPredictors

Determine the predictors from each model in a model set
estM

Estimate mortality
dataTabPanel

Create a Data Tab Panel for the GenEst User Interface HTML
estText

Prepare the text for the estimation table
msgModSENobs

Create the SE data size notification
modelSetPredictors

Determine the predictors for a whole model set
defineUnitCol

Auto-parsing to find the name of the unit column (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.
aicc

Generic S3 function for summarizing AICc
gettingStartedContent

Create the Content for the Getting Started Pabel
initialOutput

Update the output list upon initiation of the app
msgModWarning

Create the warning message for a model run (if needed)
modNameSplit

Split model names into their components and remove only a desired one
msgList

Produce the message list
msgFracNote

Create the message for when an incorrect FFS is input
modelInputWidget

Create a Model Input Widget for the GenEst User Interface HTML
disclaimersContent

Create the Content for the Disclaimers Pabel
estgGenericSize

Estimate generic detection probability for multiple size classes
pickSizeclass

Locate the sizeclass selected by the inputs
msgSampleSize

Create the warning message text for small sample sizes
cpLogLik

Calculate the negative log-likelihood of a carcass persistence model
pkmSetAllFail

Check if all of the pkm models fail within a given set
pkLogLik

Calculate the negative log-likelihood of a searcher efficiency model
msgSplitFail

Create the fail message for when splits aren't done correctly
expandModelSetCP

Expand a CP model set for plotting
initialReactiveValues

Create the main reactive value list for GenEst
cpmSetFailRemove

aicc.cpm

Extract AIC and AICc for a carcass persistence model
isNeverDecreasing

Is a vector never decreasing?
cpmSetSizeFail

Check if all of the cpm models fail
dateCols

Select the date columns from a data table
pkmSetFail

Check if pkm models fail
plotCPCells

Plot the cellwise results of a single model in a set of CP models
pkmParamPlot

Plot parameter box plots for each cell for either p or k
dateToDay

Calculate day of study from calendar date
plotCPFigure

Plot results of a single CP model in a set
pkmSECellPlot

Plot cell-specific decay curve for searcher efficiency
plot.gGeneric

Plot results of a single generic ghat estimation
aicc.pkm

extract AICc value from pkm object
checkSpecificModelCP

Error check a specific model selection for a CP plot
modelRunWidget

Create a Model Run Widget for the GenEst User Interface HTML
modelSelectionWidget

Make a Model Selection Widget
plotSEBoxPlots

p and k box plots for an SE model set
aicc.pkmSet

Create the AICc tables for a set of searcher efficiency models
plotSEBoxTemplate

template box plot
msgSSavgFail

Create the warning message for when the SS average doesn't work
prettySplitTab

Create the pretty version of the split summary table
msgSSinputFail

Create the warning message for when the SS based on inputs doesn't work
print.corpus_frame

Generic S3 function for printing corpus_frame
downloadTable

Download a table
plot.gGenericSize

Plot results of a set of size-based generic ghat estimations
plotCPHeader

The CP plot header
checkSpecificModelSE

Error check a specific model selection for an SE plot
removeCols

Remove selected columns from column names
refMod

Return the model with the greatest log-likelihood
obsCols_fta

Select the columns from a data table that could be CP First Time Absent observations
simpleMplot

Plot a total mortality estimation for a simple situation
downloadgFig

Download the g figure
obsCols_ltp

Select the columns from a data table that could be CP Last Time Present observations
sizeCols

Select the potential size class columns from a data table
pkmSetSpecParamPlot

p or k box plots for an SE model set
pkmSetSizeFailRemove

Remove failed pkm models from a pkmSetSize object
plotNA

Produce a blank plot for unsucessful fits
transposeSplits

Transpose a splitFull array (preserving attributes)
createvtext

Create the version text for GenEst
prepSS

Create search schedule data into an prepSS object for convenient splits analyses
dataDownloadWidget

Create a Data Download Widget for the GenEst User Interface HTML
trimSetSize

Trim a Model-Set-Size Complex to a Single Model Per Size
ltranspose

Transpose a list of arrays
plot.splitFull

Plot summary statistics for splits of mortality estimates
plot.splitSummary

Plot summary statistics for splits of mortality estimates
prepSizeclassText

Prepare text for size classes
renderDTns

Render a data table without server-side processing
wind_RP

Wind Road and Pad (120m) Example
predsCols

Select the predictor-ok columns from a data table
rpk

Simulate parameters from a fitted pk model
downloadCPFig

Download the CP figure
downloadData

Download a zipped data set
matchCells

Match cells between models.
modelSetCells

Determine the cell table for a full model set
estg

Estimate all carcass-level detection rates and arrival intervals
estgGeneric

Estimate generic g
mock

A mock example data set
solar_trough

Trough-based solar thermal power simulated example
modNamePaste

Paste the parts of a model's name back together
modelSetModelCells

Determine the cells from each model in a model set
wind_RPbat

Wind Bat-Only Road and Pad (120m) Example
style

HTML tag functions
tidyModelSetCP

Tidy a CP model set
modelOutputWidget

Create a Model Output Widget for the GenEst User Interface HTML
modelOutputPanel

Create a Model Output Tab Panel for the GenEst User Interface HTML
prepPredictors

Prepare predictors based on inputs
prettyModTabCP

Create the pretty version of the Carcass Persistence model table
prettyModTabSE

Create the pretty version of the Searcher Efficiency model table
tidyModelSetSE

Tidy an SE model set
selectedDataPanel

Create a Selected Data Tab Panel for the GenEst User Interface HTML
msgModDone

Create a model done message
setFigW

Set Figure width and height based on the number of cells
setNotSuspending

(Re)set outputOptions to not suspending for given elements
update_output

Update the outputs when an event occurs
setkNeed

Create the kNeed text
msgModPartialFail

Create the warning message text for when only some models are fit successfully
trueLength

Get the length of real (non-NA) things
msgModRun

Create a model running message
navbar

Create the HTML for the navigation bar UI element
obsCols_SE

Select the columns from a data table that could be SE observations
msgModFail

Create the error message for when no models are fit successfully
update_rv

Update the reactive value list when an event occurs
pkmSetSpecSECellPlot

Plot cell-specific decay curve for searcher efficiency for a specific model with comparison to the cellwise model
pkmSetSizeFail

Check if all of the pkm models fail
pkm

Fit pk searcher efficiency models.
pkmSetFailRemove

Remove failed pkm models from a pkmSet object
pkmFail

Check if a pk model is well-fit
plot.cpm

Plot results of a single CP model
plot.cpmSet

Plot results of a set of CP models
plotSEHeader

The SE plot header
plot.pkm

Plot results of a single pk model
plot.estM

Plot total mortality estimation
updateColNames_size

Update the string of column names that are in all the needed tables
plot.pkmSet

Plot results of a set of SE models
plotSECells

Plot the cellwise results of a single model in a set of SE models
widgetMaker

Input Widget Maker
updatesizeCol

Update the name of the size class column based on available names
ppersist

Calculate the probability of persistence to detection
plotSEFigure

Plot results of a single SE model in a set
reNULL

Reset values of a list to NULL
print.cpm

Print a cpm model object
rcp

Simulate parameters from a fitted cp model
print.pkm

Print a pkm model object
reVal

Reset values of a reactive values list
readCSV

Read in csv files in either format
runGenEst

Launch the GenEst Application
solar_PV

Photovoltaic Example Dataset
summary.estM

Summarize total mortality estimation
selectData

Select particular columns from a data set
solar_powerTower

Power Tower Example Dataset
summary.gGeneric

Summarize the gGeneric list to a simple table
summary.gGenericSize

Summarize the gGenericSize list to a list of simple tables
updateSizeclasses

Update the size classes
update_input

Update the inputs when an event occurs
summary.splitFull

Summarize results of mortality estimate splits
wind_cleared

Wind cleared plot (60m) Search Example
GenEst

Generalized estimation of mortality
SEcols

Produce a named vectory with standard SE plot colors
SEsi

Calculate decayed searcher efficiency