
Last chance! 50% off unlimited learning
Sale ends in
Computes principal components using the sampling weights.
svyprcomp(formula, design, center = TRUE, scale. = FALSE, tol = NULL, scores = FALSE, ...)
# S3 method for svyprcomp
biplot(x, cols=c("black","darkred"),xlabs=NULL,
weight=c("transparent","scaled","none"),
max.alpha=0.5,max.cex=0.5,xlim=NULL,ylim=NULL,pc.biplot=FALSE,
expand=1,xlab=NULL,ylab=NULL, arrow.len=0.1, ...)
model formula describing variables to be used
survey design object.
Center data before analysis?
Scale to unit variance before analysis?
Tolerance for omitting components from the results; a proportion of the standard deviation of the first component. The default is to keep all components.
Return scores on each component? These are needed for biplot
.
A svyprcomp
object
Base colors for observations and variables respectively
Formula, or character vector, giving labels for each observation
How to display the sampling weights: "scaled"
changes the size of the point label, "transparent"
uses opacity proportional to sampling weight, "none"
changes neither.
Opacity for the largest sampling weight, or for all points if weight!="transparent"
Character size (as a multiple of par("cex")
) for the largest sampling weight, or for all points if weight!="scaled"
Graphical parameters
See biplot
See link{biplot.prcomp}
Other arguments to prcomp
, or graphical parameters for biplot
svyprcomp
returns an object of class svyprcomp
, similar to
class prcomp
but including design information
# NOT RUN {
data(api)
dclus2<-svydesign(id=~dnum+snum, fpc=~fpc1+fpc2, data=apiclus2)
pc <- svyprcomp(~api99+api00+ell+hsg+meals+emer, design=dclus2,scale=TRUE,scores=TRUE)
pc
biplot(pc, xlabs=~dnum, weight="none")
biplot(pc, xlabs=~dnum,max.alpha=1)
biplot(pc, weight="scaled",max.cex=1.5, xlabs=~dnum)
# }
Run the code above in your browser using DataLab