Displaying 20 results from an estimated 7000 matches similar to: "Question about avoid the for loop"
2003 Jan 22
1
something wrong when using pspline in clogit?
Dear R users:
I am not entirely convinced that clogit gives me the correct result when I
use pspline() and maybe you could help correct me here.
When I add a constant to my covariate I expect only the intercept to change,
but not the coefficients. This is true (in clogit) when I assume a linear in
the logit model, but the same does not happen when I use pspline().
If I did something similar
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),
2012 Oct 05
1
svyhist
Hello,
I was trying to draw histograms of age at death and got the following 2 error messages:
1) Error in tapply(1:NROW(x), list(factor(strata)), function(index) { :
arguments must have same length
2) Error in findInterval(mm[, i], gx) : 'vec' contains NAs
In addition: Warning messages:
1: In min(x) : no non-missing arguments to min; returning Inf
2: In max(x) :
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(
2010 Apr 07
1
Struggeling with svydesign()
Dear all,
We are analysing some survey data and we are not sure if we are using
the correct syntax for our design.
The population of interest is a set of 4416 polygons with different
sizes ranging from 0.003 to 45.6 ha, 7460 ha in total. Each polygon has
a binary attribute (presence/absence) and we want to estimate the
probability of presence in the population.
We used sampling with replacement
2006 Mar 23
2
clogit question
Hi,
I am playing with
clogit(case~spontaneous+induced+strata(stratum),data=infert)
from clogit help file.
This line works.
1. But, why strata(stratum) doesn't have a coefficient like spontaneous
and induced?
2. When I remove strata(stratum) from the command, this function seems
to keep running forever. Why?
3. I think the equation for clogit looks like
P=1/(1+
2001 Nov 01
1
Stratified study.
Hello,
I am analyzing the results of a survey of the student body on the use of
certain technologies. The student body was divided in strata according to
two criteria, college and user class. The resulting 24 strata were sampled.
Subjects filled out a survey with a number of questions, most of them of
the yes-no variety. I created a data.frame with the results for the survey.
One row for
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
2010 Aug 11
4
Arbitrary number of covariates in a formula
Hello!
I have something like this:
test1 <- data.frame(intx=c(4,3,1,1,2,2,3),
status=c(1,1,1,0,1,1,0),
x1=c(0,2,1,1,1,0,0),
x2=c(1,1,0,0,2,2,0),
sex=c(0,0,0,0,1,1,1))
and I can easily fit a cox model:
library(survival)
coxph(Surv(intx,status) ~ x1 + x2 + strata(sex),test1)
However, I want to
2003 Dec 11
1
nested aov: plot available?
Hi all,
I wonder whether, for an anova with multiple error strata, it is possible to
produce the same diagnostoc plots than with a single-stratum anova.
I can extract the residuals for each stratum with e.g.
> resid(split1.aov[["block:plot"]])
> resid(split1.aov[["Within"]])
and then produce qqnorm plots etc manually, but is it possible to get all the
plots
2008 Feb 01
1
package could not be loaded
Hi,
I am an R newbie. I am running R2.5.1 on WinXP. I am trying to run a pacakge
(BNArray1.0) that depends on deal 1.2-26 and dynamicGraph 0.2.0.1 . These
are available on http://www.cls.zju.edu.cn/binfo/BNArray/#OLE9 .
I have installed the 3 packages (using local files). When I try to run
BNArray, I reveicd this error message
> local({pkg <- select.list(sort(.packages(all.available =
2017 Dec 29
0
Why aov() with Error() gives three strata?
At any rate:
Error(SUBJECT/IV)
specifies two random effects: SUBJECT and SUBJECT:IV. This is most easily understood if you conceptually arrange your data in a SUBJECT x IV table: One effect is a set of random errors added to each row, the other is a set of effects added to each cell.
If you have more than one observation within each cell, then you need a third set of errors to account for
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 Mar 04
1
Basic stratification calculations
Hi. I'm a student at SFU in Canada. The basic thing I want to do is
calculate means of different strata. I have 2 vectors. One has the values I
want to take the means from, the other is the four strata I am interested
in. So I essentially want to break up the information vector into the four
strata and calculate four means, one for each stratum. How can I do this in
a reasonable way?
Thanks
2006 Mar 07
1
breslow estimator for cumulative hazard function
Dear R-users,
I am checking the proportional hazard assumption of a cox model for a
given covariate, let say Z1, after adjusting for other relavent covariates
in the model. To this end, I fitted cox model stratified on the discrete
values of Z1 and try to get beslow estimator for the baseline cumulative
hazard function (H(t)) in each stratum. As far as i know, if the
proportionality assumption
2010 May 09
1
Dimensions on svychisq on svydesign
Dear Forum
I a running svychisq from the survey package and get errors with the number
of dimensions,
errors that I do not understand and do not know how to fix.
I ask you kindly to help me out.
The eror message follows with some information below. I hope there are
enough information to help me to fix the problem if not please let me know
what is needed
Best
Stefan Hrafn Jonsson
> QHISQ2
2009 Jul 14
1
ordering dataframe for strata() (PR#13830)
I've been using strata(sampling) and found that if the dataframe to be
sampled ("data") consists of repeated measures that are not sorted in
order the run will fail on a given stratum. Ordering the dataframe
prior to using strata() eliminates this problem.
Thanks,
Eric
--
Eric Vander Wal
Ph.D. Candidate
University of Saskatchewan, Department of Biology,
112 Science Place,
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 =
2009 Apr 03
1
Survey Package with Binary Data (no Standard Errors reported)
Hi,
I'm trying to get standard errors for some of the variables in my data
frame. One of the questions on my survey is whether faculty coordinate
across curriculum to include Arts Education as subject matter. All the
responses are coded in zeros and ones obviously. For some of the other
variables I have a 2 for those that responded with "Don't Know".
I'm getting NA for
2011 Jan 25
1
NA replacing
Hello R user,
I have following data frame:
df=data.frame(id=c(1:10),strata=rep(c(1,2),c(5,5)),y=c(
10,12,10,NA,15,70,NA,NA,55,100),x=c(3,4,5,7,4,10,12,8,3,15))
and I would like to replace NA's with:
instead of first NA tapply(na.exclude(df)$y,na.exclude(df)$strata,sum)[1]*
*7 */tapply(na.exclude(df)$x,na.exclude(df)$strata,sum)[1]
where 7 is the value of x (id=4) in strata 1 where y=NA