search for: api00

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

2010 Mar 10
1
Strange result in survey package: svyvar
...ey for Honduras, 2006), and when I try to calculate the variances for several variables, I get negative numbers. I thought it may be my data, so I ran the example on the help page: data(api) ## one-stage cluster sample dclus1<-svydesign(id=~dnum, weights=~pw, data=apiclus1, fpc=~fpc) svyvar(~api00+enroll+api.stu+api99, dclus1) variance SE api00 11182.8 1386.4 api00 11516.3 1412.9 api.stu -4547.1 3164.9 api99 12735.2 1450.1 If I look at the full matrix for the variances (and covariances): test<-svyvar(~api00+enroll+api.stu+api99, dclus1) print(test, covariance=T)...
2012 Oct 16
1
Package survey: Compute standard deviations from complex survey designs
Hello, svyvar from the survey package computes variances (with standard errors) from survey design objects. Is there any way to compute standard deviations and their standard errors in a similar manner? Thanks a lot, Sebastian
2012 Oct 18
3
svyplot and svysmooth with hexbin
...hics, 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 Health Scientist...
2011 Jul 22
1
Recoding Multiple Variables in a Data Frame in One Step
...se R, but I'd be surprised if it's not possible. I'm just trying to replace multiple columns at once in a data frame. #load example data data(api) #this displays the three columns and eight rows i'd like to replace apiclus1[ apiclus1$meals > 98 , c( "pcttest" , "api00" , "sch.wide" ) ] #the goal is to replace pcttest with 100, api100 with NA, and sch.wide with "Maybe" #this doesn't work-- apiclus1[ apiclus1$meals > 98 , c( "pcttest" , "api00" , "sch.wide" ) ] <- c( 100 , NA , "Maybe" )...
2010 Feb 18
1
survey package question
Should the svyby function be able to work with svyquantile? I get the error below ... data(api) dclus1<-svydesign(id=~dnum, weights=~pw, data=apiclus1, fpc=~fpc) svyby(~api00, design=dclus1, by = ~stype, quantiles=c(.25,.5,.75), FUN=svyquantile, na.rm=T ) > Error in object$coefficients : $ operator is invalid for atomic vectors A more general question is: can quantiles and their SEs be computed for subgroups? The same syn...
2011 Oct 24
4
Problem with svyvar in survey package
I am facing a problem with a function in survey package. The function svyvar gives the estimated population variance from a given sampling scheme. I am working with a data having more than four continuous variables. In order to have have population total for all those cont. variables I have written in the following format svyvar(~var1+var2+var3+var4+var5+var6,data) ; var1,var2,...,var6 are 6
2016 Apr 30
0
Unexpected scores from weighted PCA with svyprcomp()
...sign) 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, api99 * mycoef["api99"] +...
2012 Jun 28
1
SVY: variance inflation factor VIF with complex survey
...way to get the variance inflation 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]]
2014 Oct 15
2
Advice on package design for handling of dots in a formula
...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 can't use dots in a formula in my package".essentially what the survey package...
2009 Dec 07
0
zelig logit survey
...this is because the model is not using "quasibinomial" (see R-News 2003, Analyzing Survey Data in R, by Thomas Lumley). Is there a way to change the model to use "quasibinomial"? Reproducible example: library(Zelig) library(survey) data(api) z.out <- zelig(form = yr.rnd ~ api00, data = apistrat, model = 'logit.survey', id = ~1, strata = ~ stype, weight = ~pw, fpc = ~fpc) summary(z.out) Respectfully, Frank Lawrence
2006 Apr 11
4
Bootstrap and Jackknife Bias using Survey Package
Dear R users, I?m student of Master in Statistic and Data analysis, in New University of Lisbon. And now i?m writting my dissertation in variance estimation.So i?m using Survey Package to compute the principal estimators and theirs variances. My data is from Incoming and Expendire Survey. This is stratified Multi-stage Survey care out by National Statistic Institute of Mozambique. My domain of
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