Displaying 4 results from an estimated 4 matches for "apiclus2".
Did you mean:
apiclus1
2016 Apr 30
0
Unexpected scores from weighted PCA with svyprcomp()
...variance.matrix <- svyvar(formula, design)
variables <- diag(covariance.matrix)
correlation.matrix <- covariance.matrix / sqrt(variables %*%
t(variables))
return(correlation.matrix)
}
library(survey)
data(api)
dclus2 <- svydesign(ids = ~ dnum + snum, fpc = ~ fpc1 + fpc2, data =
apiclus2)
pc <- svyprcomp( ~ api99 + api00, design = dclus2, scale = TRUE, scores
= TRUE)
dclus2$variables$pc1 <- pc$x[, "PC1"]
dclus2$variables$pc2 <- predict(pc, apiclus2)[, "PC1"]
mycoef <- pc$rotation[, "PC1"] / pc$scale
dclus2$variables$pc3 <- with(apiclus2,...
2012 Oct 18
3
svyplot and svysmooth with hexbin
...with Lattice graphics, but for the life of me I can not figure out how. Dr. Lumley in his excellent book on page 118 mentions that there is code on his website to do this, but I can not find it.
So for example:
library(survey)
data(api)
dclus2<-svydesign(id=~dnum+snum, fpc=~fpc1+fpc2, data=apiclus2)
svyplot(api00~api99, dclus2)
s1 <-svysmooth(api00~api99, dclus2)
lines(s1)
#works
svyplot(api00~api99, dclus2, style="grayhex")
lines(s1)
#does not work (line either appears in the wrong position in RGui or crashes RStudio).
VR
James
James T. Durant, MSPH CIH
Environmental He...
2008 Sep 12
2
Fw: Complex sampling survey _ Use of survey package
--------------------------------------------------
From: "Ahoussou Sylvie" <sylvie.ahoussou at antilles.inra.fr>
Sent: Friday, September 12, 2008 9:48 AM
To: "Thomas Lumley" <tlumley at u.washington.edu>
Subject: Re: [R] Complex sampling survey _ Use of survey package
> Thanks for your answer
>
> I think I made a mistake when I recopied the 5 first rows of
2011 Mar 07
1
Risk differences with survey package
I'm trying to use the survey package to calculate a risk difference with
confidence interval for binge drinking between sexes. Variables are
X_RFBING2 (Yes, No) and SEX. Both are factors. I can get the group
prevalences easily enough with
result <- svyby(~X_RFBING2, ~SEX, la04.svy, svymean, na.rm = TRUE)
and then extract components from the svyby object with SE() and coef() to
do the