Displaying 20 results from an estimated 600 matches similar to: "Survey package"
2007 Sep 06
1
the survey package
Good afternoon!
I'm trying to use the survey package to get a better point of view for my data, but i need some piece of advice:
i have some data from a survey which has been stratified using 2 criteria: region(7 values), size of locality(5 values) Using the survey pakage how can i define in a correct way this design (taking into account all 4 strata not just one as in the Survey
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
2012 Aug 10
1
Direct Method Age-Adjustment to Complex Survey Data
Hi everyone, my apologies in advance if I'm overlooking something simple in
this question. I am trying to use R's survey package to make a direct
method age-adjustment to some complex survey data. I have played with
postStratify, calibrate, rake, and simply multiplying the base weights by
the correct proportions - nothing seems to hit the published numbers on the
nose.
I am trying to
2006 Jun 18
1
Post Stratification
Dear WizaRds,
having met some of you in person in Vienna, I think even more fondly
of this community and hope to continue on this route. It was great
talking with you and learning from you. Thank you. I am trying to work
through an artificial example in post stratification. This is my dataset:
library(survey)
age <- data.frame(id=1:8, stratum=rep(
2007 Sep 07
1
R survey package again
Hi R-users!!
I have some trouble with the survey pakage and i would be very glad if you can give me an advice.
I have a sample from a survey where household were interviewed. The sample has 4 criteria on which the stratification was based: REGION, SIZE OF HOUSEHOLD, SIZE OF LOCALITY, AGE OF HEAD OF HOUSEHOLD. Since i don't have the whole information in each cell of the cross
2011 Jan 26
1
Quantile regression (rq) and complex samples
I am new to R and am interested in using the program to fit quantile
regression models to data collected from a multi-stage probability
sample of the US population. The quantile regression package, rq, can
accommodate person weights. However, it is not clear to me that
boot.rq is appropriate for use with multi-stage samples (i.e., is
capable of sampling primary sampling units instead of survey
2008 Aug 18
1
Survey Design / Rake questions
I'm trying to learn how to calibrate/postStratify/rake survey data in
preparation for a large survey effort we're about to embark upon. As a
working example, I have results from a small survey of ~650 respondents,
~90 response fields each. I'm trying to learn how to (properly?) apply
the aforementioned functions.
My data are from a bus on board survey. The expansion in the
2011 Mar 07
1
Risk differences with survey package
I'm trying to use the survey package to calculate a risk difference with
confidence interval for binge drinking between sexes. Variables are
X_RFBING2 (Yes, No) and SEX. Both are factors. I can get the group
prevalences easily enough with
result <- svyby(~X_RFBING2, ~SEX, la04.svy, svymean, na.rm = TRUE)
and then extract components from the svyby object with SE() and coef() to
do the
2003 Nov 12
5
repeat until function
Hi,
I'm in this situation:
I what to generate N random numbers(integer) that are different from each
other.
One suggestion:
tabel <- rep(NULL, N)
for (i in 1:N){
temp <- as.integer(runif(1,1,max))
if(temp in tabel) {
repeat (?) (temp <- as.integer(runif(i,i,max)))
until (?) ((temp in tabel) ==FALSE)
}
else{ tabel[i] <- temp}
I can't use
2004 Jul 23
2
Complex Surveys...Specifying Design
I need some guidance from someone 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
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.col, clus.id, and PS.col are names of columns in the
object pop.
2001 Dec 19
2
R strings from C
Hi,
I am trying to study R internal behaviour. So long, I have not
succeeded to access the value of R strings from C.
I use:
void salvesta_tabel(
SEXP data_frame,
SEXP file
)
{
printf( "nimi %d\n", (R_CHAR)( file));
}
and from the R side:
salvesta.tabel <-
function (x, file = "") {
.Call( "salvesta_tabel", x, file)
}
When calling
2005 May 26
1
Survey and Stratification
Dear WizaRds,
Working through sampling theory, I tried to comprehend the concept of
stratification and apply it with Survey to a small example. My question
is more of theoretic nature, so I apologize if this does not fully fit
this board's intention, but I have come to a complete stop in my efforts
and need an expert to help me along. Please help:
age<-matrix(c(rep(1,5), rep(2,3),
2008 Sep 12
2
Fw: Complex sampling survey _ Use of survey package
--------------------------------------------------
From: "Ahoussou Sylvie" <sylvie.ahoussou at antilles.inra.fr>
Sent: Friday, September 12, 2008 9:48 AM
To: "Thomas Lumley" <tlumley at u.washington.edu>
Subject: Re: [R] Complex sampling survey _ Use of survey package
> Thanks for your answer
>
> I think I made a mistake when I recopied the 5 first rows of
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
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
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:
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
2045
G
2016 Apr 04
2
Using final sample weight in survey package
I have the final sample 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
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 =