srs.domainestimator {samplingR} | R Documentation |
Simple Random Sample parameter estimation of domains.
Description
Function to make estimations of diferent parameters on a given domain based on a Simple Random Sample.
Usage
srs.domainestimator(
Nh,
data,
estimator = c("total", "mean", "proportion", "class total"),
domain,
replace = FALSE,
alpha
)
Arguments
Nh |
Number of instances of the data set domain. |
data |
Sample of the data. It must constain a column with the data to estimate and a second column with the domain of each instance. |
estimator |
One of "total", "mean". Default is "total". |
domain |
Domain of the sample from which parameter estimation will be done. |
replace |
Whether the sample to be taken can have repeated instances or not. |
alpha |
Optional value to calculate estimation error and build 1-alpha confidence interval. |
Details
Data columns must be arranged with interest values on the first column
and domain values on the last column.
Domain parameter can be either numeric or character
and must be equal to one of the values of the domain column of data.
Value
A list containing different interest values:
estimator
variance
sampling.error
estimation.error
confint
References
Pérez, C. (1999) Técnicas de muestreo estadístico. Teoría, práctica y aplicaciones informáticas. 193-195
Examples
data<-cbind(rnorm(500, 50, 20), rep(c(1:2),250))
sample<-data[srs.sample(500, 100),]
sum(data[which(data[,-1]==1),1])
srs.domainestimator(Nh = 250, data = sample, estimator="total", domain=1)