checkValidCovars: checkValidCovars

View source: R/checkValidCovars.r

checkValidCovarsR Documentation

checkValidCovars

Description

Check a data frame of efficiency trials and covariates for a trap location for complete data.

Usage

checkValidCovars(df, tmp.df, min.date, max.date, covarB, site, strt.dt, end.dt)

Arguments

df

The data frame for a specific TrapPositionID containing efficiency-trial information and covariates, if available, at the time of fitting enhanced efficiency trials in eff_model.r (or F.efficiency.model ).

tmp.df

The reduced data frame originating from df containing only efficiency-trial dates; i.e., those with non-NA nReleased values.

min.date

The start date for data to include. This is a text string in the format %Y-%m-%d, or YYYY-MM-DD.

max.date

The end date for data to include. Same format as min.date.

covarB

A character vector containing the covariates deemed important in the enhanced efficiency model tied to the TrapPositionID returned from df.

site

The identification number of the site for which estimates are required.

strt.dt

The remapped start date associated with the current trap's minimum (earliest) spline date.

end.dt

The remapped end date associated with the current trap's maximum (latest) spline date.

Details

The values of min.date and max.date are the same as those provided by the user in the initial passage estimation run.

Function checkValidCovars first assesses the degree of presence of each covariate (other than temporal spline basis vectors) required to run that particular TrapPositionID's enhanced efficiency model via df.

It performs three checks.

The first ensures that all covariates listed in covarB are actually present in data frame df. A covariate could have been used for enhanced efficiency fitting, but yet be missing in a particular year requested for passage, if over ALL years on which the enhanced efficiency estimation was fit, more than 90 covariate in question. This implies that, inevitably, one year could "take the blame," and thus, prevent enhanced-efficiency estimation. This behavior occurs on the Stanislaw in 1998 on subsiteID=1004, where covariate waterDepth_cm is missing for the majority of the e-trial year. Thus, passage involving this year and trap utilized original spline-style efficiency modeling.

The second assesses for presence, for each batchDate, with respect to the user-provided min.date and max.date, which could be arbitrary, while the third assesses for covariate presence within the batchDate date range over which efficiency trials took place within the provided min.date and max.date.

All covariates tied to an enhanced-efficiency fit must at least be present for all inclusive efficiency-trial batchDates to fit the TrapPositionID's enhanced efficiency model.

Value

A modified dataframe input of df, containing possibly filled-in values for NA observed outside the temporal range of efficiency trials returned from min.date and max.date.

Examples

## Not run: 
checkValidCovars(df,tmp.df,min.date,max.date,covarB,site)

## End(Not run)

tmcd82070/CAMP_RST documentation built on April 6, 2022, 12:07 a.m.