Usage
spsurvey.analysis(sites=NULL, subpop=NULL, design=NULL, data.cat=NULL, data.cont=NULL, siteID=NULL, wgt=NULL, sigma=NULL, var.sigma=NULL, xcoord=NULL, ycoord=NULL, stratum=NULL, cluster=NULL, wgt1=NULL, xcoord1=NULL, ycoord1=NULL, popsize=NULL, popcorrect=FALSE, pcfsize=NULL, N.cluster=NULL, stage1size=NULL, support=NULL, sizeweight=FALSE, swgt=NULL, swgt1=NULL, vartype="Local", conf=95, pctval=c(5,10,25,50,75,90,95))
Arguments
sites
a data frame consisting of two variables: the first variable is
site IDs and the second variable is a logical vector indicating which
sites to use in the analysis. If this data frame is not provided,
then the data frame will be created, where (1) site IDs are obtained
either from the design argument, the siteID argument, or both (when
siteID is a formula); and (2) a variable named use.sites that contains the
value TRUE for all sites is created.
The default is NULL.
subpop
a data frame describing sets of populations and subpopulations
for which estimates will be calculated. The first variable is site
IDs and each subsequent variable identifies a Type of population,
where the variable name is used to identify Type. A Type variable
identifies each site with one of the subpopulations of that Type. If
this data frame is not provided, then the data frame will be created,
where (1) site IDs are obtained either from the design argument, the
siteID argument, or both (when siteID is a formula); and (2) a single Type
variable named all.sites that contains the value "All Sites" for all sites
is created. The default is NULL.
design
a data frame consisting of design variables. If variable names
are provided as formulas in the corresponding arguments, then the
formulas are interpreted using this data frame. If this data frame is
not provided, then the data frame will be created from inputs to the
design variables in the argument list. The default is NULL. If
variable names are not provided as formulas, then variables should be
named as follows:
siteID = site IDs
wgt = final adjusted weights
xcoord = x-coordinates for location
ycoord = y-coordinates for location
stratum = stratum codes
cluster = stage one sampling unit codes
wgt1 = final adjusted stage one weights
xcoord1 = stage one x-coordinates for location
ycoord1 = stage one y-coordinates for location
support = support values
swgt = size-weights
swgt1 = stage one size-weights
data.cat
a data frame of categorical response variables. The first
variable is site IDs. Subsequent variables are response variables.
Missing data (NA) is allowed. The default is NULL.
data.cont
a data frame of continuous response variables. The first
variable is site IDs. Subsequent variables are response variables.
Missing data (NA) is allowed. The default is NULL.
siteID
site IDs. This variable can be input directly or as a formula
and must be supplied either as this argument or in the design data
frame. The default is NULL.
wgt
the final adjusted weight (inverse of the sample inclusion
probability) for each site, which is either the weight for a
single-stage sample or the stage two weight for a two-stage sample.
The default is NULL.
sigma
measurement error variance. This variable must be a vector
containing a value for each response variable and must have the names
attribute set to identify the response variable names. Missing data (NA)
is allowed. The default is NULL.
var.sigma
variance of the measurement error variance. This variable
must be a vector containing a value for each response variable and must have
the names attribute set to identify the response variable names. Missing
data (NA) is allowed. The default is NULL.
xcoord
x-coordinate for location for each site, which is either the
x-coordinate for a single-stage sample or the stage two
x-coordinate for a two-stage sample. The default is NULL.
ycoord
y-coordinate for location for each site, which is either the
y-coordinate for a single-stage sample or the stage two
y-coordinate for a two-stage sample. The default is NULL.
stratum
the stratum codes. This variable can be input directly or as a
formula. The default is NULL.
cluster
the stage one sampling unit (primary sampling unit or cluster)
codes. This variable can be input directly or as a formula. The
default is NULL.
wgt1
the final adjusted stage one weights. This variable can be input
directly or as a formula. The default is NULL.
xcoord1
the stage one x-coordinates for location. This variable can be
input directly or as a formula. The default is NULL.
ycoord1
the stage one y-coordinates for location. This variable can be
input directly or as a formula. The default is NULL.
popsize
known size of the resource, which is used to perform ratio
adjustment to estimators expressed using measurement units for the
resource. For a finite resource, this argument is either the total number
of sampling units or the known sum of size-weights. For an extensive
resource, this argument is the measure of the resource, i.e., either known
total length for a linear resource or known total area for an areal
resource. The argument must be in the form of a list containing an
element for each population Type in the subpop data frame, where NULL is a
valid choice for a population Type. The list must be named using the
column names for the population Types in subpop. If a population Type
doesn't contain subpopulations, then each element of the list is either a
single value for an unstratified sample or a vector containing a value for
each stratum for a stratified sample, where elements of the vector are
named using the stratum codes. If a population Type contains
subpopulations, then each element of the list is a list containing an
element for each subpopulation, where the list is named using the
subpopulation names. The element for each subpopulation will be either a
single value for an unstratified sample or a named vector of values for a
stratified sample. The default is NULL.
Example popsize for a stratified sample:
popsize = list("Pop 1"=c("Stratum 1"=750,
"Stratum 2"=500,
"Stratum 3"=250),
"Pop 2"=list("SubPop 1"=c("Stratum 1"=350,
"Stratum 2"=250,
"Stratum 3"=150),
"SubPop 2"=c("Stratum 1"=250,
"Stratum 2"=150,
"Stratum 3"=100),
"SubPop 3"=c("Stratum 1"=150,
"Stratum 2"=150,
"Stratum 3"=75)),
"Pop 3"=NULL)
Example popsize for an unstratified sample:
popsize = list("Pop 1"=1500,
"Pop 2"=list("SubPop 1"=750,
"SubPop 2"=500,
"SubPop 3"=375),
"Pop 3"=NULL)
popcorrect
a logical value that indicates whether finite or continuous
population correction factors should be employed during variance
estimation, where TRUE = use the correction factors and FALSE = do not
use the correction factors. The default is FALSE.
pcfsize
size of the resource, which is required for calculation of
finite and continuous population correction factors for a single-stage
sample. For a stratified sample this argument must be a vector containing a
value for each stratum and must have the names attribute set to identify the
stratum codes. The default is NULL.
N.cluster
the number of stage one sampling units in the resource, which
is required for calculation of finite and continuous population
correction factors for a two-stage sample. For a stratified sample
this variable must be a vector containing a value for each stratum and
must have the names attribute set to identify the stratum codes. The
default is NULL.
stage1size
size of the stage one sampling units of a two-stage sample,
which is required for calculation of finite and continuous population
correction factors for a two-stage sample and must have the names
attribute set to identify the stage one sampling unit codes. For a
stratified sample, the names attribute must be set to identify both
stratum codes and stage one sampling unit codes using a convention where
the two codes are separated by the & symbol, e.g., "Stratum 1&Cluster 1".
The default is NULL.
support
the support value for each site - the value one (1) for a
site from a finite resource or the measure of the sampling unit
associated with a site from an extensive resource, which is required
for calculation of finite and continuous population correction
factors. This variable can be input directly or as a formula. The default
is NULL.
sizeweight
a logical value that indicates whether size-weights should
be used in the analysis, where TRUE = use the size-weights and FALSE =
do not use the size-weights. The default is FALSE.
swgt
the size-weight for each site, which is the stage two size-weight
for a two-stage sample. This variable can be input directly or as a
formula. The default is NULL.
swgt1
the stage one size-weight for each site. This variable can be
input directly or as a formula. The default is NULL.
vartype
the choice of variance estimator, where "Local" = local mean
estimator and "SRS" = SRS estimator. The default is "Local".
conf
the confidence level. The default is 95%.
pctval
the set of values at which percentiles are estimated. The
default set is: {5, 10, 25, 50, 75, 90, 95}.