Description Usage Arguments Details Value Author(s) References See Also Examples
View source: R/cont.analysis.R
This function organizes input and output for analysis of continuous data generated by a probability survey. Input can be either an object belonging to class spsurvey.analysis (see the documentation for function spsurvey.analysis) or through use of the other arguments to this function.
1 2 3 4 
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 spsurvey.obj is not provided, then this argument is required. 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. 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 spsurvey.obj is not provided, then this argument is required. The default is NULL. 
design 
a data frame consisting of design variables. If spsurvey.obj is
not provided, then this argument is required. The default is NULL.
Variables should be named as follows: 
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. If spsurvey.obj is not provided, then this argument is required. 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. 
popsize 
known size of the resource, which is used to perform ratio
adjustment to estimators expressed using measurement units for the
resource and to calculate strata proportions for calculating estimates for
a stratified sample. For a finite resource, this argument is either the
total number of sampling units or the known sum of sizeweights. 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. 
popcorrect 
a logical value that indicates whether finite or continuous population correction factors should be employed during variance estimation, where TRUE = use the correction factor and FALSE = do not use the correction factor. The default is FALSE. To employ the correction factor for a singlestage sample, values must be supplied for argument pcfsize and for the support variable of the design argument. To employ the correction factor for a twostage sample, values must be supplied for arguments N.cluster and stage1size, and for the support variable of the design argument. 
pcfsize 
size of the resource, which is required for calculation of finite and continuous population correction factors for a singlestage 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 twostage 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 twostage sample, which is required for calculation of finite and continuous population correction factors for a twostage 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. 
sizeweight 
a logical value that indicates whether sizeweights should be used in the analysis, where TRUE = use the sizeweights and FALSE = do not use the sizeweights. The default is FALSE. 
total 
a logical value that indicates whether the population total estimate should be included in the output Pct data frame, where TRUE = include the total estimate and FALSE = do not include the estimate. The default is FALSE. 
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}. 
spsurvey.obj 
A list of class spsurvey.analysis that was produced by the function spsurvey.analysis. Depending on input to that function, some elements of the list may be NULL. The default is NULL. 
CDF estimates are calculated for all unique values of a response variable.
Value is a list containing either two or four data frames of population estimates for all combinations of population Types, subpopulations within Types, and response variables. The data frames containing deconvoluted CDF estimates and deconvoluted percentile estimates are only included in the output list when an input value for measurement error variance is provided to the function. CDF estimates are calculated for both proportion and size of the population. Standard error estimates and confidence interval estimates also are calculated. The four data frames are:
CDF
 a data frame containing the CDF estimates
Pct
 a data frame containing the percentile estimates plus
population mean, standard deviation, and variance estimates
CDF.D
 a data frame containing the deconvoluted CDF estimates
Pct.D
 a data frame containing the deconvoluted percentile
estimates
Tony Olsen [email protected]
Tom Kincaid [email protected]
DiazRamos, S., D.L. Stevens, Jr., and A.R. Olsen. (1996). EMAP Statistical Methods Manual. EPA/620/R96/XXX. Corvallis, OR: U.S. Environmental Protection Agency, Office of Research and Development, National Health Effects and Environmental Research Laboratory, Western Ecology Division.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24  # Continuous variable example:
mysiteID < paste("Site", 1:100, sep="")
mysites < data.frame(siteID=mysiteID, Active=rep(TRUE, 100))
mysubpop < data.frame(siteID=mysiteID, All.Sites=rep("All Sites",100),
Resource.Class=rep(c("Good","Poor"), c(55,45)))
mydesign < data.frame(siteID=mysiteID, wgt=runif(100, 10, 100),
xcoord=runif(100), ycoord=runif(100), stratum=rep(c("Stratum1",
"Stratum2"), 50))
ContVar < rnorm(100, 10, 1)
mydata.cont < data.frame(siteID=mysiteID, ContVar=ContVar)
mypopsize < list(All.Sites=c(Stratum1=3500, Stratum2=2000),
Resource.Class=list(Good=c(Stratum1=2500, Stratum2=1500),
Poor=c(Stratum1=1000, Stratum2=500)))
cont.analysis(sites=mysites, subpop=mysubpop, design=mydesign,
data.cont=mydata.cont, popsize=mypopsize)
# Include deconvolution estimates:
mydata.cont < data.frame(siteID=mysiteID, ContVar=ContVar,
ContVar.1=ContVar + rnorm(100, 0, sqrt(0.25)),
ContVar.2=ContVar + rnorm(100, 0, sqrt(0.50)))
mysigma < c(NA, 0.25, 0.50)
names(mysigma) < c("ContVar", "ContVar.1", "ContVar.2")
cont.analysis(sites=mysites, subpop=mysubpop[,1:2], design=mydesign,
data.cont=mydata.cont, sigma=mysigma, popsize=mypopsize[1])

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.