Description Usage Arguments Value See Also Examples
Estimates the population cumulative distribution function for specified
variables. In contrast to svyquantile
, this does not do
any interpolation: the result is a right-continuous step function.
1 2 3 4 5 |
formula |
one-sided formula giving variables from the design object |
design |
survey design object |
na.rm |
remove missing data (case-wise deletion)? |
... |
other arguments to |
x |
object of class |
xlab |
a vector of x-axis labels or |
An object of class svycdf
, which is a list of step functions (of
class stepfun
)
svyquantile
, svyhist
, plot.stepfun
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | data(api)
dstrat <- svydesign(id = ~1, strata = ~stype, weights = ~pw, data = apistrat,
fpc = ~fpc)
cdf.est<-svycdf(~enroll+api00+api99, dstrat)
cdf.est
## function
cdf.est[[1]]
## evaluate the function
cdf.est[[1]](800)
cdf.est[[2]](800)
## compare to population and sample CDFs.
opar<-par(mfrow=c(2,1))
cdf.pop<-ecdf(apipop$enroll)
cdf.samp<-ecdf(apistrat$enroll)
plot(cdf.pop,main="Population vs sample", xlab="Enrollment")
lines(cdf.samp,col.points="red")
plot(cdf.pop, main="Population vs estimate", xlab="Enrollment")
lines(cdf.est[[1]],col.points="red")
par(opar)
|
Loading required package: grid
Loading required package: Matrix
Loading required package: survival
Attaching package: 'survey'
The following object is masked from 'package:graphics':
dotchart
Weighted ECDFs: svycdf(~enroll + api00 + api99, dstrat)
Step function
Call: svycdf.default(formula = ~enroll, design = dstrat)
x[1:187] = 119, 143, 153, ..., 2552, 3156
188 plateau levels = 0, 0.0024378, 0.0095754, ..., 0.99756, 1
[1] 0.8223603
[1] 0.8463626
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.