nwos_estimates_quantile: NWOS Quantile

View source: R/nwos_estimates_quantile.R

nwos_estimates_quantileR Documentation

NWOS Quantile

Description

This function calculates quantiles for NWOS estimates.

Usage

nwos_quantile(weight, area = 1, domain, variable, prob = c(0.00, 0.25, 0.50, 0.75, 1.00), max.iter = 1000)

Arguments

weight

vector of weights per ownership.

area

vector of area (e.g., forest acres) per ownership. Default = 1 (i.e., estimates are in terms of ownerships).

domain

vector with 1 indicating inclusion in the domain and 0 otherwise. Default = 1 (i.e., all ownerships are included).

variable

vector of variable of interest in terms of the quantile.

prob

vector of probabilities for quantiles. Defualt is 0.00, 0.25, 0.50, 0.75, 1.00 (i.e., quartiles).

max.iter

maximum number of iterations. Default = 1000.

References

Butler, B.J. In review. Weighting for the US Forest Service, National Woodland Owner Survey. U.S. Department of Agriculture, Forest Service, Northern Research Station. Newotwn Square, PA.

Examples

wi <- tbl_df(read.csv("data/wi.csv")) %>% mutate(ROW_NAME = row.names(wi), AC_WOOD = ACRES_FOREST, FFO = if_else(LAND_USE == 1 & OWN_CD == 45 & AC_WOOD >= 1, 1, 0), RESPONSE = if_else(RESPONSE_PROPENSITY >= 0.5, 1, 0), RESPONSE = if_else(is.na(RESPONSE_PROPENSITY), 0, RESPONSE))
WI_FFO_AREA <- nwos_stratum_area(stratum = wi$FFO, point.count = wi$POINT_COUNT, state.area = 33898733)
WI_FFO_RR <- nwos_response_rate(stratum = wi$FFO, point.count = wi$POINT_COUNT, response = wi$RESPONSE)
wi$WEIGHT <- nwos_weights(stratum = wi$FFO, point.count = wi$POINT_COUNT, response = wi$RESPONSE, area = wi$AC_WOOD, stratum.area = WI_FFO_AREA, response.rate = WI_FFO_RR)
nwos_quantile(weight = wi$WEIGHT, domain = wi$FFO, variable = wi$AC_WOOD)
nwos_quantile(weight = wi$WEIGHT, area = wi$AC_WOOD, domain = wi$FFO, variable = wi$AC_WOOD)

familyforestresearchcenter/nwos documentation built on April 12, 2025, 11:54 a.m.