Generates population data for generating 'green-book' estimates (Scott et al. 2005). Plots that are totally nonsampled are excluded from estimation dataset. Next, an adjustment factor is calculated by strata to adjust for nonsampled (nonresponse) conditions that have proportion less than 1. Attributes adjusted to a per-acre value are summed by plot, divided by the adjustment factor, and averaged by stratum. Strata means are combined using the strata weights and then expanded to using the total land area in the population.

modGBpop(
  popType = "VOL",
  popTabs = popTables(),
  popTabIDs = popTableIDs(),
  popFilter = popFilters(),
  pltassgn = NULL,
  pltassgnid = "PLT_CN",
  dsn = NULL,
  pjoinid = "CN",
  areawt = "CONDPROP_UNADJ",
  areawt2 = NULL,
  adj = "samp",
  unitvar = NULL,
  unitarea = NULL,
  areavar = "ACRES",
  strata = TRUE,
  stratalut = NULL,
  strvar = "STRATUMCD",
  returndata = TRUE,
  savedata = FALSE,
  saveobj = FALSE,
  objnm = "GBpopdat",
  unit_opts = NULL,
  strata_opts = NULL,
  savedata_opts = NULL,
  GBdata = NULL,
  pltdat = NULL,
  stratdat = NULL,
  auxdat = NULL,
  gui = FALSE,
  ...
)

Arguments

popType

String. Type of evaluation(s) to include in population data. Note: currently only c('CURR', 'VOL', 'LULC', 'DWM') are available. See details below for descriptions of each.

popTabs

List of population tables the user would like returned. See help(popTables) for a list of options.

popTabIDs

List of unique IDs corresponding to the population tables that the user has requested. See help(popTableIDs) for a list of options.

popFilter

List of population filters. See help(popFilters) for a list of options.

pltassgn

DF/DT, Optional. R object, sf R object, comma-delimited file(.csv), layer or spatial layer in dsn, or shapefile(.shp). Plot-level assignment of estimation unit and/or strata, with one record for each plot.

pltassgnid

String.

dsn

String. Name of database where tree, cond, and plot-level tables reside. The dsn varies by driver. See gdal OGR vector formats (https://www.gdal.org/ogr_formats.html).

pjoinid

String. Join variable in plot to match pltassgnid. Does not need to be uniqueid. If using most current XY coordinates for plot assignments, use identifier for plot (e.g., PLOT_ID).

areawt

String. Name of variable in cond for summarizing area weights (e.g., CONDPROP_UNADJ).

areawt2

String. An equation to multiply to areawt for estimation. All variables in equation must be in cond. weights (e.g., CONDPROP_UNADJ).

adj

String. How to calculate adjustment factors for nonsampled (nonresponse) conditions based on summed proportions for by plot ('samp', 'plot'). 'samp' - adjustments are calculated at strata/estimation unit level; 'plot' - adjustments are calculated at plot-level. Adjustments are only calculated for annual inventory plots (DESIGNCD=1).

unitvar

String. Name of the estimation unit variable in unitarea and cond or pltassgn data frame with estimation unit assignment for each plot (e.g., 'ESTN_UNIT'). Optional if only one estimation unit.

unitarea

Numeric or DF. Total area by estimation unit. If only 1 estimation unit, include number of total acreage for the area of interest or a data frame with area and estimation unit. If more than one estimation unit, provide a data frame of total area by estimation unit, including unitvar and areavar.

areavar

String. Name of area variable in unitarea. Default="ACRES".

strata

Logical. If TRUE, include information for post-stratification.

stratalut

DF/DT. If strata=TRUE, look-up table with pixel counts or area by strata or proportion or area ('strwt') by strata (and estimation unit). If 'strwt' is not included, set getwt=TRUE and getwtvar as the name of variable to calculate weights from (e.g., pixel counts).

strvar

String. If strata=TRUE, name of the strata variable in stratalut and cond or pltassgn data frame with stratum assignment for each plot (Default = 'STRATUMCD').

returndata

Logical. If TRUE, returns data objects.

savedata

Logical. If TRUE, saves table(s) to outfolder.

saveobj

Logical. If TRUE, saves returned list object to outfolder.

objnm

String. Name of *.rds object.

unit_opts

List. See help(unit_options()) for a list of options.

strata_opts

List. See help(strata_options()) for a list of options. Only used when strata = TRUE.

savedata_opts

List. See help(savedata_options()) for a list of options. Only used when savedata = TRUE.

GBdata

R List object. Output data list components from FIESTA::anGBdata().

pltdat

R List object. Output data list components from FIESTA::spGetPlots().

stratdat

R List object. Output data list components from FIESTA::spGetStrata().

auxdat

R List object. Output data list components from FIESTA::spGetAuxiliary().

gui

Logical. If gui, user is prompted for parameters.

...

For extendibility.

Value

A list with population data for Green-Book estimates.

condx

Data frame. Condition-level data including plot-level assignment of estimation unit and stratum (if strata=TRUE), condition proportion adjustment factor (cadjfac), and adjusted condition proportions (CONDPROP_ADJ).

cuniqueid

String. Unique identifier of plot in condx and pltcondx.

condid

String. Unique identifier of condition in condx and pltcondx.

treex

Data frame. Tree data within population, used for estimation, including trees per acre adjustment factor (tadjfac), and adjusted trees per acre (TPA_ADJ) (if treef is included).

tuniqueid

String. Unique identifier of plot in treex (if treef is included).

ACI.filter

String. If ACI=FALSE, ACI.filter="COND_STATUS_CD == 1".

unitarea

String. Returned table of area by estimation unit.

unitvar

String. Variable name for estimation unit.

strlut

String. Strata-level table with pixel counts by strata (P1POINTCNT), strata weights (strwt), number of plots by strata (n.strata), total number of plots in estimation unit (n.total), sum of condition proportions (_UNADJ_SUM), area adjustments (*_ADJFAC), total area, and area expansion by strata (EXPNS).

strvar

String. Variable name for strata. If strata=FALSE, strvar="ONESTRAT".

expcondtab

String. If ACI=FALSE, ACI.filter="COND_STATUS_CD == 1".

plotsampcnt

Data frame. Number of plots by PLOT_STATUS_CD.

condsampcnt

Data frame. Number of conditions by COND_STATUS_CD.

states

String. State names in dataset.

invyrs

String. Range of inventory years in dataset.

stratdat

Data frame. Strata information by estimation unit.

VariableDescription
unitvarestimation unit
strvarstratum value
strwtvarnumber of pixels by strata and estimation unit
n.stratanumber of plots in strata (after totally nonsampled plots removed)
n.totalnumber of plots for estimation unit
strwtproportion of area (or plots) by strata and estimation unit (i.e., strata weight)
CONDPROP_UNADJ_SUMsummed conditionproportion by strata and estimation unit
CONDPROP_ADJFACadjusted condition proportion by strata after nonsampled plots removed
AREA_USEDtotal area of estimation unit
expfacstrata-level expansion factor after nonsampled plots and conditions removed (AREA_USED/n.strata)
EXPNSstrata-level area expansions (expfac * strwt)

Table(s) are also written to outfolder.

Details

Population types

popType Description
ALLPopulation data, including nonsampled plots.
CURRPopulation data for area estimates, excluding nonsampled plots.
VOLPopulation data for area/tree estimates, excluding nonsampled plots.
LULCPopulation data for land use/land cover transitional estimates, including only plots with previous measurements and excluding nonsampled plots.

If variables are NULL, then it will prompt user to input variables.

Necessary variables:

DataVariableDescription
treetuniqueidUnique identifier for each plot in tree table.
CONDIDUnique identifier of each condition on plot. Set CONDID=1, if only 1 condition per plot.
TPA_UNADJNumber of trees per acre each sample tree represents (e.g., DESIGNCD=1: TPA_UNADJ=6.018046 for trees on subplot; 74.965282 for trees on microplot).
condcuniqueidUnique identifier for each plot in cond table.
CONDIDUnique identifier of each condition on plot. Set CONDID=1, if only 1 condition per plot.
CONDPROP_UNADJUnadjusted proportion of condition on each plot. Set CONDPROP_UNADJ=1, if only 1 condition per plot.
COND_STATUS_CDStatus of each forested condition on plot (i.e. accessible forest, nonforest, water, etc.)
NF_COND_STATUS_CDIf ACI=TRUE. Status of each nonforest condition on plot (i.e. accessible nonforest, nonsampled nonforest)
SITECLCDIf landarea=TIMBERLAND. Measure of site productivity.
RESERVCDIf landarea=TIMBERLAND. Reserved status.
SUBPROP_UNADJUnadjusted proportion of subplot conditions on each plot. Set SUBPROP_UNADJ=1, if only 1 condition per subplot.
MICRPROP_UNADJIf microplot tree attributes. Unadjusted proportion of microplot conditions on each plot. Set MICRPROP_UNADJ=1, if only 1 condition per microplot.
MACRPROP_UNADJIf macroplot tree attributes. Unadjusted proportion of macroplot conditions on each plot. Set MACRPROP_UNADJ=1, if only 1 condition per macroplot.
pltassgnpltassgnidUnique identifier for each plot in pltassgn.
STATECDIdentifies state each plot is located in.
INVYRIdentifies inventory year of each plot.
PLOT_STATUS_CDStatus of each plot (i.e. sampled, nonsampled). If not included, all plots are assumed as sampled.

For available reference tables: sort(unique(FIESTAutils::ref_codes$VARIABLE))

Note

ADJUSTMENT FACTOR:
The adjustment factor is necessary to account for nonsampled conditions. It is calculated for each estimation unit by strata. by summing the unadjusted proportions of the subplot, microplot, and macroplot (i.e. *PROP_UNADJ) and dividing by the number of plots in the strata/estimation unit).

An adjustment factor is determined for each tree based on the size of the plot it was measured on. This is identified using TPA_UNADJ as follows:

PLOT SIZETPA_UNADJ
SUBPLOT6.018046
MICROPLOT74.965282
MACROPLOT0.999188

If ACI=FALSE, only nonsampled forest conditions are accounted for in the adjustment factor.
If ACI=TRUE, the nonsampled nonforest conditions are removed as well and accounted for in adjustment factor. This is if you are interested in estimates for all lands or nonforest lands in the All-Condition-Inventory.

unitcombine:
If TRUE and less than 2 plots in any one estimation unit, all estimation units with 10 or less plots are combined. The current method for combining is to group the estimation unit with less than 10 plots with the estimation unit following in consecutive order (numeric or alphabetical), restrained by survey unit (UNITCD) if included in dataset, and continuing until the number of plots equals 10. If there are no estimation units following in order, it is combined with the estimation unit previous in order.

stratcombine:
If TRUE and less than 2 plots in any one strata class within an estimation unit, all strata classes with 2 or less plots are combined. The current method for combining is to group the strata with less than 2 plots with the strata class following in consecutive order (numeric or alphabetical), restrained by estimation unit (if unitcombine=FALSE), and continuing until the number of plots equals 10. If there are no strata classes following in order, it is combined with the estimation unit previous in order.

References

Scott, Charles T.; Bechtold, William A.; Reams, Gregory A.; Smith, William D.; Westfall, James A.; Hansen, Mark H.; Moisen, Gretchen G. 2005. Sample-based estimators used by the Forest Inventory and Analysis national information management system. Gen. Tech. Rep. SRS-80. Asheville, NC: U.S. Department of Agriculture, Forest Service, Southern Research Station, p.53-77.

Author

Tracey S. Frescino, Paul L. Patterson, Elizabeth A. Freeman

Examples

GBpopdat <- modGBpop(
popTabs = list(cond = FIESTA::WYcond,  
               tree = FIESTA::WYtree,        
               seed = FIESTA::WYseed),      
popTabIDs = list(cond = "PLT_CN"),            
pltassgn = FIESTA::WYpltassgn,  
pltassgnid = "CN",        
pjoinid = "PLT_CN",         
unitarea = FIESTA::WYunitarea,
unitvar = "ESTN_UNIT",        
strata = TRUE,           
stratalut = WYstratalut,    
strata_opts = strata_options(getwt = TRUE)   
)
#> INTENSITY not in dataset.. assuming single intensity plots
#> DESIGNCD not in dataset.. assuming DESIGNCD = 1 (annual inventory)
#> For FIA estimation, adjustment factors are calculated to account for plots with partial nonresponse.
#> ...there are 14 nonsampled forest conditions in the dataset.
#> filter removed 14 records: COND_STATUS_CD != 5
#> calculating adjustment factors...
#> calculating adjustment factors...

str(GBpopdat, max.level = 1)
#> List of 28
#>  $ module     : chr "GB"
#>  $ popType    : chr "VOL"
#>  $ condx      :Classes ‘data.table’ and 'data.frame':	3210 obs. of  13 variables:
#>   ..- attr(*, "sorted")= chr [1:2] "PLT_CN" "CONDID"
#>   ..- attr(*, ".internal.selfref")=<externalptr> 
#>  $ pltcondx   :Classes ‘data.table’ and 'data.frame':	3210 obs. of  29 variables:
#>   ..- attr(*, ".internal.selfref")=<externalptr> 
#>   ..- attr(*, "sorted")= chr [1:2] "PLT_CN" "CONDID"
#>  $ cuniqueid  : chr "PLT_CN"
#>  $ condid     : chr "CONDID"
#>  $ ACI.filter : chr "COND_STATUS_CD == 1"
#>  $ unitarea   :Classes ‘data.table’ and 'data.frame':	23 obs. of  2 variables:
#>   ..- attr(*, ".internal.selfref")=<externalptr> 
#>   ..- attr(*, "sorted")= chr "ESTN_UNIT"
#>  $ areavar    : chr "ACRES"
#>  $ areaunits  : chr "acres"
#>  $ unitvar    : chr "ESTN_UNIT"
#>  $ unitvars   : chr "ESTN_UNIT"
#>  $ strata     : logi TRUE
#>  $ stratalut  :Classes ‘data.table’ and 'data.frame':	35 obs. of  14 variables:
#>   ..- attr(*, ".internal.selfref")=<externalptr> 
#>   ..- attr(*, "sorted")= chr [1:2] "ESTN_UNIT" "STRATUMCD"
#>  $ strvar     : chr "STRATUMCD"
#>  $ strwtvar   : chr "strwt"
#>  $ expcondtab :Classes ‘data.table’ and 'data.frame':	3210 obs. of  12 variables:
#>   ..- attr(*, ".internal.selfref")=<externalptr> 
#>   ..- attr(*, "sorted")= chr [1:2] "PLT_CN" "CONDID"
#>  $ plotsampcnt:'data.frame':	2 obs. of  3 variables:
#>  $ condsampcnt:'data.frame':	5 obs. of  3 variables:
#>  $ states     : chr "Wyoming"
#>  $ invyrs     :List of 1
#>  $ estvar.area: chr "CONDPROP_ADJ"
#>  $ adj        : chr "samp"
#>  $ P2POINTCNT :'data.frame':	35 obs. of  3 variables:
#>  $ treex      :Classes ‘data.table’ and 'data.frame':	18380 obs. of  21 variables:
#>   ..- attr(*, ".internal.selfref")=<externalptr> 
#>   ..- attr(*, "sorted")= chr [1:2] "PLT_CN" "CONDID"
#>  $ tuniqueid  : chr "PLT_CN"
#>  $ adjtree    : logi FALSE
#>  $ seedx      :Classes ‘data.table’ and 'data.frame':	1607 obs. of  11 variables:
#>   ..- attr(*, ".internal.selfref")=<externalptr> 
#>   ..- attr(*, "sorted")= chr [1:2] "PLT_CN" "CONDID"