search for: svytot

Displaying 16 results from an estimated 16 matches for "svytot".

Did you mean: svyplot
2010 Aug 25
1
Surprising behaviour survey-package with missing values
Dear list, I got some surprising results when using the svytotal routine from the survey package with data containing missing values. Some example code demonstrating the behaviour is included below. I have a stratified sampling design where I want to estimate the total income. In some strata some of the incomes are missing. I want to ignore these missing inc...
2006 Jul 07
2
Multistage Sampling
...me(cluster=c(1,1,1,1 ,2,2,2, 3,3), id=c(1,2,3,4, 1,2,3, 1,2), nl=c(4,4,4,4, 3,3,3, 2,2), Nl=c(100,100,100,100, 50,50,50, 75,75), M=rep(23,9), y=c(23,33,77,25, 35,74,27, 37,72) ) dmulti3 <- svydesign(id=~cluster+id, fpc=~M+Nl, data=multi3) svymean (~y, dmulti3) mean SE y 45.796 5.5483 svytotal(~y, dmulti3) total SE y 78999 13643 and I estimate the population total as N=M/m sum(Nl) = 23/3*(100+50+75)=1725. With this, my variance estimator is: y1<-mean(multi3$y[1:4]) # 39.5 y2<-mean(multi3$y[5:7]) # 45.33 y3<-mean(multi3$y[8:9]) # 54.5 yT1<-100*y1 # 3950 total cluster...
2008 Oct 22
1
Package survey
Hi, I’m using the svyby for total statistics, for example: svyby(~p_igov,~div_a,desenho_nps,svytotal,drop.empty.groups=TRUE,vartype =c("se","var","cvpct")) In the numerical variable p_igov (and others) I have many non responses but if I maintain the NA it doesn’t work. summary(base_nps$p_igov) Min. 1st Qu. Median Mean 3rd Qu. Max. NA's...
2010 Apr 07
0
Help with manipulation of svytotal output
...xample I would like to insert a row between rows 5 and 6, 10 and 11, 15 and 16, 20 and 21 and put in the sum of the rows 1-5, 6-10, 11-15, 16-20 and to delete row 21 which has NA in it. I would then like to delete all the headings. svyby(~agestrata, ~cbc1+fruitveg4, dudleyls1rake.male,na.rm=TRUE, svytotal, keep.var=FALSE, keep.names=FALSE) cbc1 fruitveg4 statistic.agestrata18-24 statistic.agestrata25-34 statistic.agestrata35-44 statistic.agestrata45-54 1 Quintile 1 - Most deprived At least 5 portions a day 130.31565...
2006 Feb 07
2
getting strata/cluster level values with survey package?
...C,16,20.66825543 C,16,17.05977818 C,16,17.80118916 C,16,15.16641698 where this is read into stand.data. When I use the following survey designs, srv1 <- svydesign(ids=~1, strata=~strata, data=stand.data ) or, srv1 <- svydesign(ids=~cluster, strata=~strata, data=stand.data ) with, print( svytotal( ~vol, srv1 ) ) I only obtain the total, > print( svytotal( ~vol, srv1 ) ) total SE vol 2377 34.464 or worse, print( svytotal( ~vol + strata, srv1 ) ) total SE vol 2377.0 34.464 strataA 42.0 0.000 strataB 64.0 0.000 strataC 34.0 0.000 which reports the n...
2010 Dec 19
1
package survey
...could someone help me to find out which formulas, for standard error calculation, are used in following example: a=data.frame(weights=rep(c(10,1),c(4,1)),fpc=rep(41,5),uk=rep(1,5)) srs<-svydesign(id=~1, weights=~weights, data=a) srs1<-svydesign(id=~1, weights=~weights,fpc=~fpc, data=a) svytotal(~uk,srs) total SE uk 41 9 svytotal(~uk,srs1) total SE uk 41 8.4334 and does anyone know if it is possible to find the codes for functions in survey package? thanks in advance Andrija [[alternative HTML version deleted]]
2008 Aug 15
2
Design-consistent variance estimate
...y(score, group, sum, na.rm=TRUE)) ## Mean of the total ss <- mean(xx, na.rm=T) ## get total variance k <- length(xx) totvar <- sum((xx-ss)^2) * k/(k-1) ## The SE is then N <- nrow(mm) sqrt(totvar/N^2) One additional thing to point out is this: ## sqrt of variance of the total is: > svytotal(~score, gg) total SE score -1.7923 21.139 ## sqrt of variance of total from my code > sqrt(totvar) [1] 21.13849 ### Now, the code below presents only the output as this is from ### a data file I am working with. ### I can send data to anyone interested ### It is the same code as...
2011 Aug 28
4
How do I get a weighted frequency table?
? stato filtrato un testo allegato il cui set di caratteri non era indicato... Nome: non disponibile URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20110828/d35f51a1/attachment.pl>
2006 Aug 21
1
"vcov" error in svyby and svytable functions
Hi, I'm trying to compute survey svytable statistic on subsets by using the svyby function. Here is the code: b<-svyby(~V024+V751, by=~V025, design=strat2, svytable, round=TRUE) The vars, V024, V751 and V025 are factors. The by var has 2 levels, and hence there will be two subsets. strat2 is created by the svydesign function. It's giving me the following error: >
2007 Sep 20
2
Package Survey
Hello, How I use the function as.svrepdesign without memory.size problems? desenho_npc_JK <- as.svrepdesign(desenho_npc,type="JKn") Error: cannot allocate vector of size 161.3 Mb In addition: Warning messages: 1: Reached total allocation of 1022Mb: see help(memory.size) 2: Reached total allocation of 1022Mb: see help(memory.size) 3: Reached total allocation of 1022Mb:
2004 Apr 12
2
Complex sample variances
Hello, Is there a way to get complex sample variances in the survey package on summary statistics other than means? If not, can they be added to a future version? It would be be great to have them on totals, quantiles, ratios, and tables (eg row percent, columns percent, etc). Thanks. Fred --------------------------------- [[alternative HTML version deleted]]
2006 Jun 18
1
Post Stratification
...)), Nh=rep(c(15,12),c(5,3)), y=c(23,25,27,21,22, 77,72,74) ) pop.types <- table(stratum=age$stratum) age.post <- svydesign(ids=~1, strata=NULL, data=age, fpc=~Nh) ## no clusters, no strata post <- postStratify(design=age.post, strata=~stratum, population=pop.types) svymean (~y, post) svytotal (~y, post) gives mean SE y 42.625 0.5467 total SE y 341 4.3737 So, is it correct to define pop.types as the number of elements sampled per stratum (nh) or rather the total of elements per stratum (Nh)? If so: pop.types <- data.frame(stratum = c("S1","S2&quo...
2004 Sep 02
1
Question on survey package
...would have to be computed by linearization or replication since the denominator of each percentage is an estimate. I'd also like the option of getting row, column, or total percentages. Is this possible? A colleague and I have read the manuals closely and tried many variations with svytable, svytotal with no success. Version R 1.9.1 on Windows XP TIA, Richard Valliant [[alternative HTML version deleted]]
2008 Sep 09
1
survey package
Version 3.9 of the survey package is now on CRAN. Since the last announcement (version 3.6-11, about a year ago) the main changes are - Database-backed survey objects: the data can live in a SQLite (or other DBI-compatible) database and be loaded as needed. - Ordinal logistic regression - Support for the 'mitools' package and multiply-imputed data - Conditioning plots,
2008 Sep 09
1
survey package
Version 3.9 of the survey package is now on CRAN. Since the last announcement (version 3.6-11, about a year ago) the main changes are - Database-backed survey objects: the data can live in a SQLite (or other DBI-compatible) database and be loaded as needed. - Ordinal logistic regression - Support for the 'mitools' package and multiply-imputed data - Conditioning plots,
2012 Sep 21
1
Exactly Replicating Stata's Survey Data Confidence Intervals in R
...a" ) dclus1<-svydesign(id=~dnum, fpc=~fpc, data=x) # mean matches exactly coef(svymean(~I(ell==0), dclus1)) # SE matches exactly SE(svymean(~I(ell==0), dclus1)) # design df matches exactly degf(dclus1) # unwtd count matches exactly unwtd.count( ~ell, dclus1) # wtd count matches exactly svytotal( ~!is.na(ell), dclus1) # number of clusters match exactly dclus1 # none of the confidence interval options match exactly # the standard confint() will certainly be wrong, # since stata gives an asymmetric confidence interval confint(svymean(~I(ell==0), dclus1)) svyciprop(~I(ell==0), dclus1,...