summarize_two_stage: Summarize two-stage sample

Description Usage Arguments Value Author(s) Examples

View source: R/twostage.R

Description

Summarizes population-level statistics for two-stage sample data. The calculations are derived from Chapter 3 in Avery and Burkhart's (1967) Forest Measurements, Fifth Edition. The variance terms refer to the variance of the mean.

Usage

1
2
3
4
summarize_two_stage(data, plot = TRUE, attribute = NA,
                           populationClusters = 0,
                           populationElementsPerCluster = 0,
                           desiredConfidence = 0.95)

Arguments

data

data frame containing observations of variable of interest for either cluster-level of plot-level data.

plot

logical TRUE if parameter data is plot-level, FALSE if parameter data is cluster-level. Default is TRUE.

attribute

character name of attribute to be summarized.

populationClusters

numeric total number of clusters in the population.

populationElementsPerCluster

numeric total number of elements in the population.

desiredConfidence

numeric desired confidence level (e.g. 0.9).

Value

data frame of stand-level statistics including standard error and confidence interval limits. All final values are on a 'per plot' basis.

Author(s)

Karin Wolken

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
## Not run: 

# See Forest Sampling vignette for more details


# Data can be input as either clusters or plots.


# Cluster level data can be expressed as:

dataCluster <- data.frame(clusterID = c(1, 2, 3, 4, 5),
                          totClusterElements = c(5, 2, 1, 6, 5),
                          sampledElements = c(2, 2, 2, 2, 2),
                          isUsed = c(T, T, T, T, F),
                          attrSumCluster = c(1000, 1250, 950, 
                                             900, 1005))
# Example:
summarize_two_stage(dataCluster, F, 'attr')


# Plot level data can be expressed as:

dataPlot <- data.framedata.frame(clusterID = c(1, 1, 1, 2, 2, 2,  
                                               3, 3, 3, 4, 4, 4,  
                                               5, 5, 5, 6, 6, 6), 
                                 volume = c(500, 650, 610, 490,   
                                            475, 505, 940, 825,  
                                            915, 210, 185, 170,  
                                            450, 300, 500, 960, 
                                            975, 890),
                                 isUsed = c(T, T, T, T, T, T, T, 
                                            T, T, T, T, T, T, T,  
                                            T, T, T, T))
# Example:
summarize_two_stage(redData, T, 'volume', populationClusters = 16,
                    populationElementsPerCluster = 160)


## End(Not run)

SilviaTerra/forestsamplr documentation built on Jan. 3, 2020, 2:33 p.m.