svyqqplot: Quantile-quantile plots for survey data

View source: R/svyqq.R

svyqqplotR Documentation

Quantile-quantile plots for survey data

Description

Quantile-quantile plots either against a specified distribution function or comparing two variables from the same or different designs.

Usage

svyqqplot(formula, design, designx = NULL, na.rm = TRUE, qrule = "hf8",
    xlab = NULL, ylab = NULL, ...)
svyqqmath(x, design, null=qnorm, na.rm=TRUE, xlab="Expected",ylab="Observed",...)

Arguments

x, formula

A one-sided formula for svyqqmath or a two-sided formula for svyqqplot

design

Survey design object to look up variables

designx

Survey design object to look up the RHS variable in svyqqplot, if different from the LHS variable

null

Quantile function to compare the data quantiles to

na.rm

Remove missing values

qrule

How to define quantiles for svyqqplot – see svyquantile for possible values

xlab, ylab

Passed to plot. For svyqqplot, if these are NULL they are replaced by the variable names

...

Graphical options to be passed to plot

Value

None

See Also

quantile qqnorm qqplot

Examples

data(api)

dstrat<-svydesign(id=~1,strata=~stype, weights=~pw, data=apistrat,
fpc=~fpc)

svyqqmath(~api99, design=dstrat)
svyqqplot(api00~api99, design=dstrat)

dclus1<-svydesign(id=~dnum, weights=~pw, data=apiclus1, fpc=~fpc)
opar<-par(mfrow=c(1,2))

## sample distributions very different
qqplot(apiclus1$enroll, apistrat$enroll); abline(0,1)

## estimated population distributions much more similar
svyqqplot(enroll~enroll, design=dstrat,designx=dclus1,qrule=survey:::qrule_hf8); abline(0,1)
par(opar)


survey documentation built on Aug. 28, 2024, 3 a.m.