Displaying 10 results from an estimated 10 matches for "api99".
Did you mean:
api
2010 Mar 10
1
Strange result in survey package: svyvar
...), 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)
varianc...
2012 Oct 18
3
svyplot and svysmooth with hexbin
...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
US Age...
2009 Mar 11
1
CI from svyquantile in survey package
...he survey package. I am using R version 2.8.1 (2008-12-22) and survey
package (3.11-2) on FC7 linux. To simplify my question I use an example from
that package:
R> data(api)
R> dclus1<-svydesign(id=~dnum, weights=~pw, data=apiclus1, fpc=~fpc)
R> (tst <- svyby(~api99, ~stype, dclus1, svyquantile,
quantiles=0.5,ci=TRUE))
stype api99 se
E E 615 37.89
H H 593 69.52
M M 611 37.67
R> str(tst)
Classes ???svyby??? and 'data.frame': 3 obs. of 3 variables:
$ stype: Factor w/ 3 levels "E",&q...
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
2009 Nov 02
2
"object not found" within function
.... 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, dclus1).)
I guess that the problem has something to do with function environments, but since I am new to R, I can't seem to figure out...
2010 Mar 26
1
return.replicates in survey pkg
How do I retrieve the replicates estimates from a crosstab done using
svyby?
Here is an example from the help page for svyby in the package:
> data(api)
> dclus1<-svydesign(id=~dnum, weights=~pw, data=apiclus1, fpc=~fpc)
> rclus1<-as.svrepdesign(dclus1)
>
> a <- svyby(~api99, ~stype, rclus1, svymean, return.replicates=TRUE)
> a$replicates
NULL
But, compare to
> b <- svymean(~api99, design=rclus1, return.replicates=TRUE)
> b$replicates
[1] 606.8488 611.5866 609.1989 605.5765 608.1381 606.6927 609.8101
599.4371 602.4368 601.8792 606.7531 630.6575 600.1882 6...
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()
...mula, 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$rotation[, "PC1"] / pc$scale
dclus2$variables$pc3 <- with(apiclus2, api99 * mycoef["api99&q...
2010 Aug 18
1
svyquantile w/ svyby is returning an error
svymean w/ svyby is working for me...
> svyby(~visitcnt, ~agegrp3.f, svymean, design=svydes)
agegrp3.f visitcnt se.visitcnt
18-44 18-44 8.755552 0.4953235
45-64 45-64 10.131555 0.5347806
65+ 65+ 9.588802 0.4323629
svyquantile is working for me...
> svyquantile(~visitcnt, quantiles=c(.25, .5, .75), ties="rounded", design=svydes)
0.25
2006 Apr 22
1
svyby example returns error
I get error trying to run examples from 'svyby' help page (?svyby in
package "Survey"):
# code
data(api)
dclus1<-svydesign(id=~dnum, weights=~pw, data=apiclus1, fpc=~fpc)
svyby(~api99, ~stype, dclus1, svymean)
# error message
> Error in match.arg(vartype, several.ok = TRUE) :
unused argument(s) (several.ok ...)
Is this a version problem? I'm running R Version 2.1.0 (2005-04-18,
i386-pc-linux-gnu) and have installed survey_3.4-4.tar.gz using
install.package(&qu...