search for: svydesign

Displaying 20 results from an estimated 115 matches for "svydesign".

2005 Apr 12
1
calling svydesign function that uses model.frame
I need help on calling the svydesign function in the survey package (although this error appears not to be specific to svydesign). I am passing parameters incorrectly but am not sure how to correct the problem. ## Call the main function PS.sim (one of mine). The dots are parameters I omitted to simplify the question. ## y.col, str.c...
2004 Jul 23
2
Complex Surveys...Specifying Design
...e who is familiar/has some experience with the survey package. The data that I am using is from the Medical Expenditure Panel Survey (www.meps.ahrq.gov <http://www.meps.ahrq.gov/> ). The STRATA and PSU variables are varstr01 and varpsu01 respectively. When I try to specify them with the svydesign function I get an error message. An excerpt of my session is as follows... library(foreign) > h60 <- read.xport("h:\\meps\\temptransports\\h60.tpt") > names(h60) <- casefold(names(h60)) > names(h60) [1] "dupersid" "sex" "inscov01"...
2010 Jul 22
1
svydesign syntax
This message is for those familiar with the survey package. I need to fit a weighted Cox model to accommodate the sampling weights as I have a case-control study with controls sampled at random from a database in a ratio 2:1 to cases (whom were all sampled). I want to make sure I am using the right svydesign syntax to specify this sampling design. Can anyone please check if the statement below is appropriate for my design? #group represents the case (total of 132) vs control (253 out of the total of 853 controls) groups; prob is 1 for cases and 253/853 for controls and ssize=132 for cases and 853 othe...
2008 Sep 12
2
Fw: Complex sampling survey _ Use of survey package
..._An > 2045 G 551 12 10 > 2046 C 551 68 11 > 2070 G 551 9 50 > 2070 S 551 9 51 > 2070 S 551 9 52 > > > > yes Totanim is the total number of animals in the farm and num is the > total number of herds > > I keep on obtaining this error message > > clustot<-svydesign(id=~num+ ~ Id_An, fpc=~fpc1+~Totanim, data=tab1) > > Erreur dans as.fpc(fpc, strata, ids) : > FPC implies >100% sampling in some strata. > > > -------------------------------------------------- > From: "Thomas Lumley" <tlumley at u.washington.edu> > Sent:...
2005 May 26
1
Survey and Stratification
...(3,5), rep(4,3), rep(5,5), rep(3,3), rep(15,5), rep(12,3), 23,25,27,21,22, 33,27,29), ncol=6, byrow=F) colnames(age)<-c("stratum", "id", "weight", "nh", "Nh", "y") age<-as.data.frame(age) ## create survey design object age.des1<-svydesign(ids=~id, strata=~stratum, weight=~Nh, data=age) svymean(~y, age.des1) ## gives mean 25.568, SE 0.9257 age.des2<-svydesign(ids=~id, strata=~stratum, weight=~I(nh/Nh), data=age) svymean(~y, age.des2) ## gives mean 25.483, SE 0.9227 age.des3<-svydesign(ids=~id, strata=~stratum, weight=~weight,...
2007 Sep 06
3
Survey package
Good afternoon! I'm trying to use the Survey package for a stratified sample which has 4 criteria on which the stratification is based. I would like to get the corrected weights and for every element i get a weight of 1 E.g: tipping design <- svydesign (id=~1, strata= ~regiune + size_loc + age_rec_hhh + size_hh, data= tabel) and then weights(design) gives me: 1,1,1,1,1,1,1,1,1,1,1,........... for each element Why is that? What do i do wrong? Thank you! --------------------------------- [[alternative HTML versio...
2010 May 09
1
Dimensions on svychisq on svydesign
...onsson > QHISQ2 <- svychisq(~S73 + S36 , design = HL7design , statistic = "Chisq") Error in design$variables[, as.character(rows)] : incorrect number of dimensions HL07 <- read.spss("C:/Users/Stefan/Desktop/export1.por", use.value.labels = FALSE) HL7design <-svydesign(id=~ID2,strata=~STRATA, weights=~VIGT2, data=HL07 ) summary(HL7design) > summary(HL7design) Stratified Independent Sampling design (with replacement) svydesign(id = ~ID2, strata = ~STRATA, weights = ~VIGT2, data = HL07) Probabilities: Min. 1st Qu. Median Mean 3rd Qu. Max. 0.3779...
2008 Sep 11
1
Complex sampling survey _ Use of survey package
Hello everybody I don't understand how I'm supposed to use svydesign caracteristics to explain to R that my sampling design is the following one Data base = tab1 here are the five first rows of the database (nrow = 11792) num esp Quarters Totcat Totshp Totgt Tbtpos fpc1 Totanim Id_An 10...
2005 Jun 16
1
Survey - Cluster Sampling
...the population and n the number sampled. y are the values sampled. This is my example data: clus1 <- data.frame(cluster=c(1,1,1,2,2,2,3,3,3), id=seq(1:3,3), weight=rep(72/9,9), nl=rep(3,9), Nl=rep(3,9), N=rep(72,9), y=c(23,33,77, 25,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, dclus...
2011 Sep 30
1
Advice on approach to weighting survey
I'm about to add weights to a bus on-board survey dataset with ~150 variables and ~28,000 records. My intention is to weight (for each bus "run") by boarding stop and alighting stop. I've seen the Rake function of the Survey package, but it seems that converting to a "svydesign" might be excessive for my purpose. My dataset has a huge number of unique "Run-Boarding" and "Run-Alighting" groups each with a small number of records to expand. Would it be easier to manually implement Iterative-Proportional-Fitting/Raking/Fratar/Furness on the data?...
2016 Apr 04
2
Using final sample weight in survey package
...weight (expansion factor) from a socieconomic survey. I don't know the exact design used in the study ( (probably is a stratified two-stage design). To illustrate my problem I will use the next dataset which have a sample weight (but the design is not specified) and incorporate the design with svydesign and create some bootstrap replicates in order to be able to produce estimations. Is that correct?: load(url("http://knutur.at/wsmt/R/RData/small.RData")) library(survey) small.w <- svydesign(ids = ~1, data = small, weights = small$weight) design<-as.svrepdesign(small.w,type=&quot...
2009 Nov 02
2
"object not found" within function
Hi, I am trying to write a function to compute many cross-tabulations with the -svytable- command. Here is a simplified example of the structure of my code (adapted from the -svytable- help file): data(api) func.example<-function(variable){ dclus1<-svydesign(id=~1, weights=~pw,data=apiclus1, fpc=~fpc) svytable(~ variable, dclus1) } When I call this function with: func.example(api99) I get the following error: Error in eval(expr, envir, enclos) : object 'variable' not found. (Everything works fine when I type svytable(~ api99, dclus...
2003 Feb 12
2
Various Errors using Survey Package
Hi, I have been experimenting with the new Survey package. Specifically, I was trying to use some of the functions on the public-use survey data from NHIS (2000 Sample Adult file). Error 1): The first error I get is when I try to specify the complex survey design. nhis.design<-svydesign(ids=~psu, probs=~probs, strata=~strata, data=nhis.df, check.strata=TRUE) Error in svydesign(ids = ~psu, probs = ~probs, strata = ~strata, data = nhis.df, : Clusters not nested in strata My data are sorted by strata, psu. Can someone tell me what the structure has to be for a stratified...
2010 Apr 07
1
Struggeling with svydesign()
...ranges from 1 to 1158. The sample size ranges from 0 in the blocks with very few polygons (<20), 1 in blocks with a low number of polygon (20 - 50) and up to 25 polygons in the largest strata. Does the syntax below represents the data structure above? Any comments are welcome. library(survey) svydesign( id = ~ 1, #no clustering weights = ~ Area, #weighted by the area of the polygon strata = ~ Status + Block + Type, nest = TRUE ) # Is Area a correct weighting factor? Or should we use the area divided by the sum of the total area (per stratum?) # The code above runs. But when we omit "Stat...
2003 Mar 22
5
Sample weights
R Users I am a new user of R. I have sample weights that I would like to apply to some of the variables in my data set. Where can I go for information on how to do that? Richard
2016 Apr 04
0
Using final sample weight in survey package
hi, probably not.. if your survey dataset has a complex design (like clusters/strata), you need to include them in the `svydesign` call. coercing an incorrect survey design into a replicate-weighted design will not fix the problem of failing to account for the sampling strategy On Mon, Apr 4, 2016 at 12:01 AM, Jos? Fernando Zea <jfzeac at gmail.com> wrote: > I have the final sample weight (expansion factor) from a...
2009 Apr 03
1
Survey Package with Binary Data (no Standard Errors reported)
...usly. For some of the other variables I have a 2 for those that responded with "Don't Know". I'm getting NA for mean and standard deviations from svymean. Am I doing something wrong of can the survey package not handle this type of data? Here's my code. > survey <- svydesign(id=~1, data=General, strata=~Grade.Level) Warning message: In svydesign.default(id = ~1, data = General, strata = ~Grade.Level) : No weights or probabilities supplied, assuming equal probability > summary(survey) Stratified Independent Sampling design (with replacement) svydesign(id = ~1, da...
2010 Jul 30
2
svydesign syntax and deviance!
Un texte encapsul? et encod? dans un jeu de caract?res inconnu a ?t? nettoy?... Nom : non disponible URL : <https://stat.ethz.ch/pipermail/r-help/attachments/20100731/ac3b9e43/attachment.pl>
2005 Oct 04
1
"Survey" package and NAMCS data... unsure of specification
...psu CPSUM They provide similar instructions for SUDAAN: as SUDAAN 1-stage WR Option The program below provides a with replacement ultimate cluster (1-stage) estimate of standard errors for a cross-tabulation. PROC CROSSTAB DATA=COMB1 DESIGN=WR FILETYPE=SAS; NEST CSTRATM CPSUM/MISSUNIT; In R, the svydesign command is used to set the sampling scheme, but as follows (example from the documentation): dstrat <- svydesign(id=~1,strata=~stype, weights=~pw, data=apistrat, fpc=~fpc) stratified on stype, with sampling weights pw. The fpc variable contains the population size for the stratum. As the scho...
2012 Dec 10
3
Warning message: In eval(expr, envir, enclos) : non-integer #successes in a binomial glm!
...: 2 2 2 1 1 2 2 2 1 1 ... $ gender: Factor w/ 2 levels "Male","Female": 1 1 2 2 2 2 1 1 2 2 ... $ weight: num 1.145 1.436 0.954 0.765 0.776 ... $ trust : Factor w/ 2 levels "no trust","trust": 2 1 1 1 1 2 1 2 1 2 ... #######Set up survey design des.1<-svydesign(~0, weights=~weight, data=mat1) #######model and response to svyglm mod1<-svyglm(trust ~ gender+edu+prov, design=des.1, family='binomial') Warning message: In eval(expr, envir, enclos) : non-integer #successes in a binomial glm! ########Model Summary summary(mod1) Call: svyglm(formul...