similar to: function code

Displaying 20 results from an estimated 600 matches similar to: "function code"

2008 Aug 26
2
svymeans question
I have the following code which produces the output below it clus1 <- svydesign(ids = ~schid, data = lower_dat) items <- as.formula(paste(" ~ ", paste(lset, collapse= "+"))) rr1 <- svymean(items, clus1, deff='replace', na.rm=TRUE) > rr1 mean SE DEff W525209 0.719748 0.015606 2.4932 W525223 0.508228 0.027570 6.2802 W525035 0.827202
2008 Aug 15
2
Design-consistent variance estimate
Dear List: I am working to understand some differences between the results of the svymean() function in the survey package and from code I have written myself. The results from svymean() also agree with results I get from SAS proc surveymeans, so, this suggests I am misunderstanding something. I am never comfortable with "I did what the software" does mentality, so I am working 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(
2006 Jun 05
1
Survey - twophase
Dear WizaRds, I am struggling with the use of twophase in package survey. My goal is to compute a simple example in two phase sampling: phase 1: I sample n1=1000 circuit boards and find 80 non functional phase 2: Given the n1=1000 sample I sample n2=100 and find 15 non functional. Let's say, phase 2 shows this result together with phase 1: ...................phase1........
2006 Jul 07
2
Multistage Sampling
Dear WizaRds, dear Thomas, First of all, I want to tell you how grateful I am for all your support. I wish I will be able to help others along one day the same way you do. Thank you so much. I am struggling with a multistage sampling design: library(survey) multi3 <- data.frame(cluster=c(1,1,1,1 ,2,2,2, 3,3), id=c(1,2,3,4, 1,2,3, 1,2), nl=c(4,4,4,4, 3,3,3, 2,2), Nl=c(100,100,100,100,
2010 Jun 03
1
problem with 'svyby' function from SURVEY package
Hello, I'm using a complex survey dataset and my goal is to simply spit out a bunch of probability-weighted outcome variable means for the different levels of covariate. So I first define the structure of the study design (I'm using the CDC's NHANES data): dhanes <- svydesign(id=~PSU, strat=~STRATA, weight=~lab_weight, data=final, nest=TRUE) No problem there. Now I use the
2008 Sep 09
1
survey package
Version 3.9 of the survey package is now on CRAN. Since the last announcement (version 3.6-11, about a year ago) the main changes are - Database-backed survey objects: the data can live in a SQLite (or other DBI-compatible) database and be loaded as needed. - Ordinal logistic regression - Support for the 'mitools' package and multiply-imputed data - Conditioning plots,
2008 Sep 09
1
survey package
Version 3.9 of the survey package is now on CRAN. Since the last announcement (version 3.6-11, about a year ago) the main changes are - Database-backed survey objects: the data can live in a SQLite (or other DBI-compatible) database and be loaded as needed. - Ordinal logistic regression - Support for the 'mitools' package and multiply-imputed data - Conditioning plots,
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),
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 =
2012 Oct 02
2
svyby and make.formula
Hello, Although my R code for the svymean () and svyquantile () functions works fine, I am stuck with the svyby () and make.formula () functions. I got the following error messages. - Error: object of type 'closure' is not subsettable # svyby () - Error in xx[[1]] : subscript out of bounds # make.formula () A reproducible example is appended below. I would appreciate if
2006 Dec 05
1
Surveys ans missing values
Hello, I still apologise if the question i ask is naive. I would like to use R instead of usual softs (SAS, Stata) or at list to do things that the others do not. As a consequence I am trying to get familiar with R, and i am astonished because it does not seem to do things that are easy to do on other softs. I have got data with missing values (I am working on a questionnaire filled by students)
2010 Aug 25
1
Surprising behaviour survey-package with missing values
Dear list, I got some surprising results when using the svytotal routine from the survey package with data containing missing values. Some example code demonstrating the behaviour is included below. I have a stratified sampling design where I want to estimate the total income. In some strata some of the incomes are missing. I want to ignore these missing incomes. I would have expected that
2003 Sep 20
4
using aggregate with survey-design and survey functions
Hi R users, I am trying to use the aggregate function with a survey design object and survey functions, but get the following error. I think I am incorrectly using the syntax somehow, and it may not be possible to access variables directly by name in a survey-design object. Am I right? How do I fix this problem? I have used aggregate with "mean" and "weighted.mean", and
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
2017 Jul 09
2
Help with ftable.svyby
Hi all, When I try the following with pkg Survey it returns the error below: ftable(svyby(~INCOME, ~AGECL+RACECL, svymean, design=q50), rownames=list(AGECL=c("<35", "35-44", "45-54", "55-64", "65-74", ">=75"), RACECL=c("white non hispanic", "non white or
2007 Dec 19
2
4 questions regarding hypothesis testing, survey package, ts on samples, plotting
Good morning! I have 4 questions which trouble me: 1. I want to test the hypothesis that the 2 proportions (the mean of a binomial) which come from 2 different samples are equal. I want to use the following function z= (p1-p2)/ sqrt((p1(1-p1)/n1)+(p2(1-p2)/n2)) which is one of the standard formulas for this case. Is there such a function in R? p1=the proportion from the first sample n1=the
2005 Jun 16
1
Survey - Cluster Sampling
Dear WizaRds, I am struggling to compute correctly a cluster sampling design. I want to do one stage clustering with different parametric changes: Let M be the total number of clusters in the population, and m the number sampled. Let N be the total of elements in the population and n the number sampled. y are the values sampled. This is my example data: clus1 <-
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
2017 Jul 09
0
Help with ftable.svyby
try resetting your factor levels and re-run? q50 <- update( q50 , INCOME = factor( INCOME ) , AGECL = factor( AGECL ) , RACECL = factor( RACECL ) ) On Sun, Jul 9, 2017 at 2:59 PM, Orsola Costantini via R-help < r-help at r-project.org> wrote: > Hi all, > > When I try the following with pkg Survey it returns the error below: > > ftable(svyby(~INCOME, ~AGECL+RACECL,