search for: dclus2

Displaying 4 results from an estimated 4 matches for "dclus2".

Did you mean: dclus1
2012 Oct 18
3
svyplot and svysmooth with hexbin
...uses the system to crash. I know this is something to do 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 RStudi...
2016 Apr 30
0
Unexpected scores from weighted PCA with svyprcomp()
...pipermail/r-help/2003-July/036645.html stopifnot(require(survey)) covariance.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$rotati...
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
2005 Jun 16
1
Survey - Cluster Sampling
...,35,74, 27,37,72) ) 1. Let M=m=3 and N=n=9. Then: dclus1<-svydesign(id=~cluster, data=clus1) svymean(~y, dclus1) mean SE y 44.778 0.294, the unweighted mean, assuming equal probability in the clusters. ok. 2. Let M=23, m=3 and N=72, n=9, then I am unable to use svydesign correctly: dclus2<-svydesign(id=~cluster, data=clus1, fpc=~N) svymean(~y, dclus2) mean SE y 44.778 0.2878, but it should be 23/72 * 1/3(133+134+136)=42.91, since I have to include the total number of clusters/total population M/N into the estimator. How can I include the information of the total number...