search for: dstrat

Displaying 12 results from an estimated 12 matches for "dstrat".

Did you mean: dstat
2008 Aug 06
1
Warning when using survey:::svyglm
Howdy, Referencing the below exchange: https://stat.ethz.ch/pipermail/r-help/2006-April/103862.html I am still getting the same warning ("non-integer #successes in a binomial glm!") when using svyglm:::survey. Using the API data: library(survey) data(api) #stratified sample dstrat<-svydesign(id=~1,strata=~stype, weights=~pw, data=apistrat, fpc=~fpc) svyglm(sch.wide~meals+acs.core+hsg,dstrat,family="binomial") I get: Stratified Independent Sampling design ... Warning message: In eval(expr, envir, enclos) : non-integer #successes in a binomial glm! Is this stil...
2012 Feb 13
1
survey package svystat objects from predict()
Hello, I'm running R 2.14.1 on OS X (x86_64-apple-darwin9.8.0/x86_64 (64-bit)), with version 3.28 of Thomas Lumley's survey package. I was using predict() from svyglm(). E.g.: data(api) dstrat<-svydesign(id=~1,strata=~stype, weights=~pw, data=apistrat, fpc=~fpc) out <- svyglm(sch.wide~ell+mobility, design=dstrat, family=quasibinomial()) pred.df <- expand.grid(ell=c(20,50,80), mobility=20) out.pred <- predict(out, pred.df) From the console out.pred looks like this: &...
2018 Mar 22
1
exporting data to stata
On Thu, Mar 22, 2018 at 4:52 AM, Raja, Dr. Edwin Amalraj <amalraj.raja at abdn.ac.uk> wrote: > Hi , > > library(foreign) > write.dta(data1, "data1.dta") > > should work. I don't think so: > library(foreign) > example(svydesign) > write.dta(dstrat, "~/Downloads/foo.dta") Error in write.dta(dstrat, "~/Downloads/foo.dta") : The object "dataframe" must have class data.frame The file will be saved in the working directory. > Use > getwd() > to know the working directory. > > Best wishes > Amalr...
2012 Jun 21
4
crosstable and regression for survey data (weighted)
I have survey data that I am working on. I need to make some multi-way tables and regression analyses on the data. After attaching the data, this is the code I use for tables for four variables (sweight is the weight variable): > a <- xtabs(sweight~research.area + gender + a2n2 + age) > tmp <- ftable(a) Is this correct? I don't think I need to use the strata and cluster
2014 Oct 15
2
Advice on package design for handling of dots in a formula
...lt;- study.design(weights=~w, observationID=~ID, strata=~site, data=mydata) myresults <- doanalysis(formula=y~X1+X2+X3, design=mystudy) But it seems that the survey package is also not designed to handle the dot. data(api) dstrat<-svydesign(id=~1,strata=~stype, weights=~pw, data=apistrat, fpc=~fpc) svyglm(api00~., design=dstrat) Error in svyglm.survey.design(api00 ~ ., design = dstrat) : all variables must be in design= argument Does anyone have advice on how best to handle this? 1. Tell my tester "Tough, you c...
2010 Mar 23
0
multi-stage sampling and hierarchical models: which packages?
...t. I have calculated the weights. So I have a weighting problem and a mixed levels problem at the same time. Even if I just use the survey package I am not sure how to specify the model, because I have clusters within strata rather than strata within clusters. I guess it would look something like dstrat<-svydesign(id=~schoolC,strata=~region+urbanrural, weights=~newweight, data=mydataset,nest=T), but this gives the same results as dstrat<-svydesign(id=~schoolC,strata=~region, weights=~newweight, data=mydataset,nest=T) And I can't see any way to look at the mixed levels effects using that...
2012 Jun 28
1
SVY: variance inflation factor VIF with complex survey
...n factor VIF for a model of regression in complex survey, I have understood that without this package (SURVEY) RGui VIF obtained as follows: fit <- lm(mpg~disp+hp+wt+drat, data=mtcars) vif(fit) But I want to know if survey, Vif is obtained so vif( svyglm(api00~ell+meals+mobility, design=dstrat)) Thank you, happy day [[alternative HTML version deleted]]
2012 Oct 18
3
svyplot and svysmooth with hexbin
Hi all- So sorry to bother you all with something pretty basic. I am trying to add the lines method output from svysmooth to a svyplot with style="grayhex". However, the line either appears in the wrong place or if I am running in R Studio it causes 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
2005 Oct 04
1
"Survey" package and NAMCS data... unsure of specification
...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 schools are sampled independently, each record in the data frame is a separate PSU. This is indicated by...
2018 Mar 22
0
exporting data to stata
Hi , library(foreign) write.dta(data1, "data1.dta") should work. The file will be saved in the working directory. Use getwd() to know the working directory. Best wishes Amalraj Raja -----Original Message----- From: R-help [mailto:r-help-bounces at r-project.org] On Behalf Of rosario scandurra Sent: 22 March 2018 07:47 To: r-help at r-project.org Subject: [R] exporting data to stata
2018 Mar 22
3
exporting data to stata
Hi, I am new to R and I want to export data into Stata. Could somebody help with that? Thanks a lot. This is the code I am using: > setwd("D:/datasets/Seg-bcn/ESBD") > data1 <- readRDS("r17045_ESDB_Habitatges_BDD_V_1_0.rds") > library(foreign) > write.dta(data="data1", file = "D:/datasets/data1.dta") Error in write.dta(data =
2010 Mar 24
0
R-help ordinal regression
...a weighting problem and a mixed levels problem at > the same time. > Even if I just use the survey package I am not sure how to > specify the > model, because I have clusters within strata rather than > strata within > clusters. > > I guess it would look something like > dstrat<-svydesign(id=~schoolC,strata=~region+urbanrural, > weights=~newweight, > data=mydataset,nest=T), > but this gives the same results as > dstrat<-svydesign(id=~schoolC,strata=~region, > weights=~newweight, > data=mydataset,nest=T) > > And I can't see any way to loo...