TrendNPS_Count: Trend for Count Outcomes from Complex Survey Designs

Description Usage Arguments Details Value Method requirements Data frame dat Options for variable type Author(s) References See Also Examples

View source: R/TrendNPS_Count.R

Description

TrendNPS_Count fits trend models of count outcomes for four approaches:

  1. the unreplicated generalized linear mixed model with variance components as specified by Piepho and Ogutu (2002) that does not incorporate design weights ("PO");

  2. simple linear regression of annual design-based estimates ("SLRDB");

  3. weighted linear regression of annual design-based estimates ("WLRDB");

  4. and probability-weighted iterative generalized least squares ("PWIGLS")

Fixed effects structure includes a year term for trend estimation and an optional two-level stratification factor. The function assumes random site and year intercepts, and an optional random site-level slope effect may be included.

Usage

1
2
3
TrendNPS_Count(alpha, dat, method, slope = TRUE, type = NA, stratum = NA,
  Y, lat = NA, long = NA, stage1wt = NA, stage2wt = NA, str1prop = NA,
  nbhd = TRUE)

Arguments

alpha

The probability of a Type I error.

dat

Data frame containing columns at least for Site, WYear, Year, and the count outcome of interest Y. See section "Data frame dat" below.

method

Method for trend estimation entered as a string. Valid values include "PO" for the generalized linear mixed model extension of the Piepho and Ogutu (2002) unreplicated linear mixed model, "SLRDB" for simple linear regression of design-based estimates, "WLRDB" for weighted linear regression of design-based estimates, or "PWIGLS" for probability-weighted iterative generalized least squares (Pfeffermann et al. 1998, Asparouhov 2002).

slope

Logical value indicating inclusion of a random site-level slope effect in the variance components structure used for the "PO" and "PWIGLS" trend methods. Site- and year-level random intercept terms included as default.

type

Scaling type when method="PWIGLS". Valid values include "Aonly", "A", "AI", "B", "BI" "C". See section "Options for variable type" below.

stratum

Text string identifying an optional two-level stratification factor in dat.

Y

Text string indicating the binary outcome variable in dat.

lat

Site latitudes using an equal-area projection, e.g., UTM or Albers.

long

Site longitudes using an equal-area projection, e.g., UTM or Albers.

stage1wt

Design weights from the original sample draw without accounting for temporal revisit designs.

stage2wt

Panel inclusion weights for each site each year.

str1prop

Proportion of the first stratum in the population in a two-level stratification variable.

nbhd

Logical indictor for the neighborhood variance estimator when method="WLRDB". If FALSE, "WLRDB" calculates the design-based mean estimate's standard error assuming independent random sampling.

Details

For long-term monitoring, TrendNPS_Count assumes a single annual sampling occasion per unique record of WYear and Site in data frame dat.

Sampling (stage1wt) and temporal-revisit (stage2wt) design weights must be adjusted for any missing data or frame error prior to trend analysis. See Oh and Scheuren (1983), Little and Rubin (2002), and Starcevich et al. (2016).

For background on the variance structure, see Piepho & Ogutu (2002). For more information on the LaPlace approximation, see Wolfinger (1993) and Raudenbush et al. (2000). For information on the probability-weighted generalized least squares approach, see Pfeffermann et al. (1998), Asparouhov (2006), and Starcevich et al. (2017).

Value

A list containing three or four elements, depending on the specified trend method. The first element of the list, ModelEstimates, contains a data frame with the trend model output:

mu Estimated intercept from the trend model.
trend Estimated trend of the outcome Y on the link function scale from the trend model.
SEtrend Estimated standard error of the trend estimate.
sig2a Estimated site-to-site variation.
sig2b Estimated year-to-year variation.
sig2t Estimated variation among site-level slopes.
sig2e Estimated residual variation.
eta Degrees of freedom used to test for trend and calculate confidence intervals.

The contents of the second list element, TrendTest, include the trend coefficient on the link scale, the trend standard error, the t-statistic, degrees of freedom, and p-value for a two-sided test of no trend.

The contents of the third list element, TrendCI, include the back-transformed trend on the original scale and the lower and upper (1-alpha)*100%-confidence interval bounds.

A fourth list element, DBests, contains the annual design-based estimates and is returned only when the SLRDB and WLRDB trend approaches are used. The design-based estimates may be used to assess the assumption of independence for the linear regression models. The output of the DBests list element include:

Year Year of survey.
Est.Mean Design-based estimate of the mean of the outcome of interest.
SE Estimated standard error of design-based mean estimate if nbhd=TRUE.
WYear WYear variable.
Resid Residuals from the linear model fit.

Method requirements

Spatially balanced samples utilizing method="SLRDB" or method="WLRDB" require specification of lat and long on setting the neighborhood variance estimator nbhd=TRUE. If spatial balance cannot be assumed, set option nbhd=FALSE for non-spatially balanced designs so that the "SLRDB" and "WLRDB" methods assume independent random sampling for standard errors.

The stratification variable stratum is required for all methods when design strata are used. Note that method="PWIGLS" further requires a value for type. See section "Options for variable type" below.

Specify stage1wt and stage2wt for all methods except unweighted method="PO".

Data frame dat

Data frame dat requires at least variables Site, WYear, Year, and Y. Variable Site defines the sampling unit.

Underlying statistical functions called by TrendNPS_Cont require two separate temporal variables: Year is a factor and WYear is a scalar-year value. WYear is shifted so that the year for which Y is least variable is centered on 0. See Piepho & Ogutu (2002) for more information.

Ultimately, WYear represents time in the fixed-effects portion of the trend model. The regression coefficient associated with WYear provides the basis for trend estimation and testing.

Variable Year enters the model as a random effect and provides the basis for estimation of random year-to-year variation among survey occasions.

Variable Y must contain only integer count values coded as numeric values 0, 1, 2, 3, ...

Options for variable type

Selection of method="PWIGLS" requires further specification of argument type. Valid options include

"Aonly" Probability weighting but no scaling at either stage
"A" Panel-weights scaling with mean site-level design weight
"AI" Panel-weights scaling with mean site-level design weight, but no site-level scaling
"B" Panel-weights scaling with effective mean site-level design weight
"BI" Panel-weights scaling with effective mean site-level design weight, but no site-level scaling
"C" Year-level scaling only with inverse of the average year-level weight

Author(s)

Leigh Ann Starcevich and Jason Mitchell of Western EcoSystems Technology, Inc.

References

Asparouhov, T. (2006). General multi-level modeling with sampling weights. Communications in Statistics - Theory and Methods 35: 439-460.

Little, J. A. R., and D. B. Rubin. (2002). Statistical analysis with missing data, 2nd edition. John Wiley and Sons, Inc., New Jersey.

Oh, H. L., and F. J. Scheuren. (1983). Weighting adjustment for unit nonresponse. Pages 143-184 in W.G. Madow, I. Olkin, and D.B. Rubin, editors. Incomplete data and in sample surveys. (Vol. 2). Academic Press, New York.

Pfeffermann, D., C. J. Skinner, D. J. Holmes, H. Goldstein, and J. Rasbash (1998). Weighting for unequal selection probabilities in multilevel models. Journal of the Royal Statistical Society, Series B 60(1): 23-40.

Piepho, H. P., & Ogutu, J. O. (2002). A simple mixed model for trend analysis in wildlife populations. Journal of Agricultural, Biological, and Environmental Statistics, 7(3), 350-360.

Raudenbush, S.W., M-L Yang, and M. Yosef. (2000). Maximum likelihood for generalized linear models with nested random effects via a high-order, multivariate Laplace approximation. Journal of Computational and Graphical Statistics 9(1): 141-157. Starcevich, L. A., G. DiDonato, T. McDonald, and J. Mitchell. (2016). A GRTS user's manual for the SDrawNPS package: A graphical user interface for generalized random tessellation stratified (GRTS) sampling and estimation. Natural Resource Report NPS/PWRO/NRR-2016/1233. National Park Service, Fort Collins, Colorado.

Starcevich, L. A., T. McDonald, A. Chung-MacCoubrey, A. Heard, and J. Nesmith. (2017). Trend Estimation for Complex Survey Designs. Natural Resource Report NPS/xxxx/NRR-2017/xxxx. National Park Service, Fort Collins, Colorado. R. Wolfinger. (1993). Laplace's approximation for nonlinear mixed models. Biometrika 80(4): 791-795.

See Also

lme4, lmerTest, spsurvey

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#  ---- Read example data set.
data(Seastar)

#  ---- Load dependent packages. 
pkgList <- c("lme4","lmerTest","spsurvey")
inst <- pkgList %in% installed.packages()
if (length(pkgList[!inst]) > 0) install.packages(pkgList[!inst])
lapply(pkgList, library, character.only = TRUE)

###########################
# Example 1: Trend analysis of annual site-level counts of leather sea stars
# with the PO approach: stratification and full random effects model.
TrendSeaster_PO_StRS = TrendNPS_Count(alpha=0.1,
dat=Seastar,method="PO",slope=TRUE,type=NA,stratum="Park",Y="Count",
stage1wt="wgt",stage2wt="PanelWt",str1prop=0.13227) 
# $ModelEstimates
#         mu      trend    SEtrend    sig2a       sig2t        sigat      sig2b
#   1.470868 0.04604476 0.04518698 0.248528 0.001259151 -0.007764177 0.03724626
# 
# $TrendTest
#        trend    SEtrend   z-stat    pvalue
#   0.04604476 0.04518698 1.018983 0.3082111
# 
# $TrendCI
#  Annual Pct Change      CI low   CI high
#         0.04712128 -0.02788504 0.1279149


# Example 2: Trend analysis of annual site-level counts of leather sea stars
# with the SLRDB approach for stratification.
TrendSeastar_SLRDB_StRS = TrendNPS_Count(alpha=0.1,
dat=Seastar,method="SLRDB",slope=TRUE,type=NA,stratum="Park",Y="Count",
lat="Lat",long="Long", stage1wt="wgt",stage2wt="PanelWt",str1prop=0.13227) 

# TrendSeastar_SLRDB_StRS
# $ModelEstimates
#        mu     trend    SEtrend sig2a sig2t sigat sig2b
#  2.687804 0.0317377 0.04920822     0     0     0     0
# 
# $TrendTest
#       trend    SEtrend    z-stat    pvalue
#   0.0317377 0.04920822 0.6449674 0.5189483
# 
# $TrendCI
#   Annual Pct Change      CI low   CI high
#          0.03224671 -0.04801179 0.1192715
# 
# $DBests
#   Year Est.Mean       SE WYear       Resid
#   2009 11.66248 2.268814     0 -0.23142756
#   2010 14.66567 4.057595     1 -0.03403269
#   2011 18.60000 6.206449     2  0.17188195
#   2012 17.17467 5.045078     3  0.06041852
#   2013 21.71013 5.658295     4  0.26302412
#   2014 20.29531 4.128595     5  0.16389719
#   2015 11.99475 2.917410     6 -0.39376154

# Plot trend on original scale
plot(TrendSeastar_SLRDB_StRS$DBests$Year,
     TrendSeastar_SLRDB_StRS$DBests$Est.Mean,
     xlab="Year", ylab="Mean Sea Star Counts")
lines(2009:2015, exp(2.687804 + 0.0317377*(0:6)), col=2)

LAStarcevich/TrendNPS documentation built on May 21, 2019, 9:19 a.m.