search for: strata

Displaying 20 results from an estimated 554 matches for "strata".

2015 Feb 04
2
Interpretación de coeficientes en un cox proportional hazards con variable strata
...por ejemplo para el Reino unido sería 0.78592 y para Bélgica 0.65489, pero no estoy seguro y no he encontrado por ahí como se interpreta cuando tengo interacción entre la variable de estrato y una covariable. Gracias.. summary(mod.cph.strat3) Call: coxph(formula = S1.nuevo ~ mobilityPDurG2 * strata(Countryb) + strata(Q6), data = datos[filtro, ], method = "breslow") n= 5885, number of events= 4397 coef exp(coef) se(coef) z Pr(>|z|) mobilityPDurG2 -0.24090 0.78592 0.06930 -3.476 0.000509 *** mobilityPDurG2:strata(Countryb)Countryb=belgium -0.42328 0.65489 0.21...
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) i...
2013 Jan 31
1
obtainl survival curves for single strata
Dear useRs, What is the syntax to obtain survival curves for single strata on many subjects? I have a model based on Surv(time,response) object, so there is a single row per subject and no start,stop and no switching of strata. The newdata has many subjects and each subject has a strata and the survival based on the subject risk and the subject strata is needed. If I d...
2008 Dec 04
1
Comparing survival curves with "survdiff" "strata" help
ExpeRts, I'm trying to compare three survival curves using the function "survdiff" in the survival package. Following is my code and corresponding error message. > survdiff(Surv(st_months, status) ~ strata(BOR), data=mydata) Error in survdiff(Surv(st_months, status) ~ strata(BOR), data = mydata) : No groups to test When I check the "strata" of the variable. I get . . . > strata(BOR) Levels: BOR=PD BOR=PR BOR=SD So I know there are levels associated with the BOR variable, but I can...
2011 Feb 12
4
From SPSS Syntax to R code
There is a code from SPSS Syntax do if sub(ATVK,2,2)="01". comp strata=1. else if sub(ATVK,2,2)>="05" and sub(ATVK,2,2)<="27". comp strata=3. else if sub(ATVK,4,2)>"20" or sub(ATVK,6,2)>"20". comp strata=4. else if sub(ATVK,4,2)>"00". comp strata=2. end if. value labels strata 1 "R 2 "Li"...
2011 May 06
2
coxph and survfit issue - strata
...estimates of survival (obtained through a Cox model) by rank of recurrence and by treatment group. With the following code (corresponding to a model with a global effect of the treatment=rx), I get no error and manage to obtain what I want : data<-(bladder) model1<-coxph(Surv(stop,event)~rx+strata(enum)+cluster(id),data=bladder) data1<-data.frame(rx=1) survfit(model1,newdata=data1) But with the model with strata by treatment interaction (corresponding to a model with an effect of the treatment by rank), I get the following error: model2<-coxph(Surv(stop,event)~rx*strata(enum)+cluster(...
2018 May 08
0
Fitting problem for Cox model with Strata as interaction term
...37 1 1643 1468 > xtabs(~status+tgroup+SEX, data) , , SEX = 1 tgroup status 1 2 3 0 3035 2403 1326 1 759 458 426 , , SEX = 2 tgroup status 1 2 3 0 2596 1940 1001 1 701 476 291 > fit1 <- coxph(Surv(tstart, time, status) ~ *SEX:strata(tgroup)*, data=data) Warning message: In coxph(Surv(tstart, time, status) ~ SEX:strata(tgroup), data = data) : X matrix deemed to be singular; variable 2 4 6 > fit1 Call: coxph(formula = Surv(tstart, time, status) ~ SEX:strata(tgroup), data = data) coef exp(...
2013 Dec 07
1
combine glmnet and coxph (and survfit) with strata()
Dear All, I want to generate survival curve with cox model but I want to estimate the coefficients using glmnet. However, I also want to include a strata() term in the model. Could anyone please tell me how to have this strata() effect in the model in glmnet? I tried converting a formula with strata() to a design matrix and feeding to glmnet, but glmnet just treats the strata() term with one independent variable... I know that if there is no such s...
2003 Feb 12
2
Various Errors using Survey Package
...imenting 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 = ~psu, probs = ~probs, strata = ~strata, data = nhis.df, : Clusters not nested in strata My data are sorted by strata, psu. Can someone tell me what the structure has to be for a stratified sample with clustering? Lookin...
2006 Feb 07
2
getting strata/cluster level values with survey package?
...the rooky question, but... I'm trying to obtain standard errors, confidence intervals, etc. from a sample design and have been trouble getting the results for anything other than the basic total or mean for the overall survey from the survey package. For example, using the following dataset, strata,cluster,vol A,1,18.58556192 A,1,12.55175443 A,1,21.65882438 A,1,17.11172946 A,1,15.41713348 A,2,13.9344623 A,2,17.13104821 A,2,14.6806479 A,2,14.68357291 A,2,18.86017714 A,2,20.67642515 A,2,15.15295351 A,2,13.82121102 A,2,12.9110477 A,2,14.83153677 A,2,21.90772687 A,3,18.69795427 A,3,18.45636428 A,...
2008 Jul 16
2
Stratified random sample
An embedded and charset-unspecified text was scrubbed... Name: n?o dispon?vel URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20080716/4aec957e/attachment.pl>
2012 Feb 01
1
package sampling, function strata
Dear all, I have to select 122 stratified random samples from a population of >3900 cells. I have 41 strata and I have to draw a different number of samples from them(between 2 and 8). I have tried to apply the funtion strata following the instruction in the manual: strata(dataframe, stratanames=NULL, size, method=c("srswor"), pik,description=TRUE) but I get the error message Error in d...
2007 May 17
2
controling the size of vectors in a matrix
hie R users l have the following matrix n=20 m<-matrix(nrow=n,ncol=4) colnames(m)=c("treatmentgrp","strata","survivalTime") for(i in 1:n) m[i,]<-c(sample(c(1,2),1,replace=TRUE),sample(c(1:2),1,replace=TRUE),rexp(1,0.07),rexp(1,0.02)) print(m) 1.l would like to control the size of...
2013 Feb 12
3
improving/speeding up a very large, slow simulation
...} } out.unpaired.test <- data.frame(success.fail, success.fail.num) } out.unpaired.test<-unpaired.test(verification.plots=verification.plots, project.n=30, project.mean=100, project.sd=10, allowed.deviation=.05, project.acres=99) out.unpaired.test # sequential.unpaired<- function(number.strata, project.n, project.mean, project.sd, verification.plots,allowed.deviation, project.acres, min.plots="default", alpha=.05){ if(min.plots=="default"){ min.plots<-NULL # minimum passing if(number.strata == 1 & project.acres <= 100){ min.plots = 8 } else if(number.s...
2010 Jun 26
1
boot with strata: strata argument ignored?
Hello All. I must be missing the really obvious here: mm <- function(d, i) median(d[i]) b1 <- boot(gravity$g, mm, R = 1000) b1 b2 <- boot(gravity$g, mm, R = 1000, strata = gravity$series) b2 Both b1 and b2 seem to have done (almost) the same thing, but it looks like the strata argument in b2 has been ignored. However, str(b1) vs str(b2) does show that the strata have been noted correctly. But b2$t is a 1000 x 1 array, not a 1000 x 8 array (gravity$series is a fa...
2010 Jul 20
1
Random Forest - Strata
Hi all, Had struggled in getting "Strata" in randomForest to work on this. Can I get randomForest for each of its TREE, to get ALL sample from some strata to build tree, while leaving some strata TOTALLY untouched as oob? e.g. in below, how I can tell RF to, - for tree 1 in the forest, to use only Site A and B to build the tree,...
2017 Dec 28
2
Why aov() with Error() gives three strata?
Dear list users, I am trying to learn Repeated measures ANOVA using the aov() interface, but I'm struggling to understand its output. According to tutorials on the web, formula for a repeated measures design is: aov(Y ~ IV+ Error(SUBJECT/IV) ) This formula does work but it returns three strata (Error:SUBJECT, Error: SUBJECT:IV, Error: Within), when I would expect two strata (Within and Between subjects). I've seems some tutorials show the exactly same setup, but returning only the two first strata. Is it possible to have two or three strata depending on the data? If there is always...
2010 Jun 03
1
Question about avoid the for loop
Dear R-helpers, I would like to generate a binary random variable within a stratum's stratum. Here is a simple example. ## x is the first level strata index, here I have 3 strata. x=c(rep(1,5), rep(2,5), rep(3,5)) ## within x, there is a second strata indexed by t=0 and t=1 t=rep(c(0,0,1,1,1),3) ## and within strata i and t=0 and t=1, I generate the random binomial variable respectively, and save in y y=rep(NA, length(x)) for (i in 1:3) { y[(x...
2007 Sep 06
3
Survey package
Good afternoon! I'm trying to use the Survey package for a stratified sample which has 4 criteria on which the stratification is based. I would like to get the corrected weights and for every element i get a weight of 1 E.g: tipping design <- svydesign (id=~1, strata= ~regiune + size_loc + age_rec_hhh + size_hh, data= tabel) and then weights(design) gives me: 1,1,1,1,1,1,1,1,1,1,1,........... for each element Why is that? What do i do wrong? Thank you! --------------------------------- [[alternative HTML version deleted]]
2024 Sep 15
1
Possible update to survival
I got good feedback from the list about a scope issue, so I am coming back for more. Prior issue: users who type survival::coxph(survival::Surv(time, status) ~ x1 + x2 + surv ival::strata(group), data=mydata) This messes up the character string matching for strata, done via tt <- terms(formula, specials= ?strata?). The code runs, and gives the wrong answer (group is treated as an ordinary covariate). The solution 1. Add code very early that rewrites the formula without th...