Displaying 20 results from an estimated 10000 matches similar to: "Adjusted survival curves"
2017 Oct 07
2
Adjusted survival curves
For adjusted survival curves I took the sample code from here:
https://rpubs.com/daspringate/survival
and adapted for my date, but got error.
I would like to understand what is my mistake. Thanks!
#ADAPTATION FOR MY DATA
library(survival)
library(survminer)
df<-read.csv("F:/R/data/base.csv", header = TRUE, sep = ";")
head(df)
ID start stop censor sex age stage treatment
1
2017 Oct 09
0
Adjusted survival curves
Adjusted survival curves (Thanks to sample code: https://rpubs.com/daspringate/survival )
Thanks to Moderator/Admin's Great Work! For a successful solution I used advice that could be understood:
1. Peter Dalgaard: The code does not work, because the covariates are not factors.
2. Jeff Newmiller: "Change the columns into factors before you give them to the coxph function, e.g.
2017 Oct 09
0
Adjusted survival curves
Adjusted survival curves. (Sample code here: https://rpubs.com/daspringate/survival )
Deep gratitude?to Moderator/Admin!
At?David Winsemius prompt, more elegant working code:Thanks, Ted :)
library(survival)
library(survminer)
df<-read.csv("F:/R/data/edgr-orig.csv", header = TRUE, sep = ";")
df2 <- df
df2[,c('treatment', 'age', 'sex',
2017 Oct 11
3
dput(treat)
I got advice here that I didn't understand! Can I ask to explain me the meaning of this procedure: first get the structure, and then assign it back. For what? Thanks!? (Great thanks to Moderator/Admin!)
You should learn to post in plain text and use dput to present your data structures. At your console do this
dput(treat)
# and this will appear. Copy it to your plain-text message:
2007 May 07
1
Predicted Cox survival curves - factor coding problems..
The combination of survfit, coxph, and factors is getting confused. It is
not smart enough to match a new data frame that contains a numeric for sitenew
to a fit that contained that variable as a factor. (Perhaps it should be smart
enough to at least die gracefully -- but it's not).
The simple solution is to not use factors.
site1 <- 1*(coxsnps$sitenew==1)
site2 <-
2024 May 15
2
Extracting values from Surv function in survival package
OS X
R 4.3.3
Colleagues
I have created objects using the Surv function in the survival package:
> FIT.1
Call: survfit(formula = FORMULA1)
n events median 0.95LCL 0.95UCL
SUBDATA$ARM=1, SUBDATA[, EXP.STRAT]=0 18 13 345 156 NA
SUBDATA$ARM=2, SUBDATA[, EXP.STRAT]=1 13 5 NA 186 NA
SUBDATA$ARM=2, SUBDATA[, EXP.STRAT]=2 5
2010 Feb 09
1
Missing interaction effect in binomial GLMM with lmer
Dear all,
I was wondering if anyone could help solve a problem of a missing interaction effect!!
I carried out a 2 x 2 factorial experiment to see if eggs from 2 different locations (Origin = 1 or 2) had different hatching success under 2 different incubation schedules (Treat = 1 or 2). Six eggs were taken from 10 females (random = Female) at each location and split between the treatments,
2018 Jul 10
4
Construcción de archivo de texto
Hola a todos,
A partir de los siguientes datos:
d <- list(`1` = structure(list(ped = c(1L, 1L, 1L, 1L, 1L, 1L, 1L),
id = 1:7, father = c(2L, 0L, 0L, 2L, 2L, 2L, 2L), mother = c(3L,
0L, 0L, 3L, 3L, 3L, 3L), sex = c(2L, 1L, 2L, 2L, 2L, 1L,
2L), affected = c(1L, 2L, 1L, 1L, 2L, 2L, 2L)), row.names = c("1",
"2", "3", "4", "5",
2012 Mar 14
1
Questing on fitting Baseline category Logit model
Dear all,
I am facing some problem with how to fit a "Baseline category Logit
model" with R. Basically I am considering famous "Alligator" data as
discussed by Agresti. This data can also be found here:
https://onlinecourses.science.psu.edu/stat504/node/174
(there is also an accompanying R file, however the underlying R code
could not load the data properly!!!)
Below are
2011 Nov 19
3
Data analysis: normal approximation for binomial
Dear R experts,
I am trying to analyze data from an article, the data looks like this
Patient Age Sex Aura preCSM preFreq preIntensity postFreq postIntensity
postOutcome
1 47 F A 4 6 9 2 8 SD
2 40 F A/N 5 8 9 0 0 E
3 49 M N 5 8 9 2 6 SD
4 40 F A 5 3 10 0 0 E
5 42 F N 5 4 9 0 0 E
6 35 F N 5 8 9 12 7 NR
7 38 F A 5 NA 10 2 9 SD
8 44 M A 4 4 10 0 0 E
9 47 M A 4 5 8 2 7 SD
10 53 F A 5 3 10 0 0 E
11
2010 Jul 02
2
Problem with aggregating data across time points
Hello-
I have a dataset which basically looks like this:
Location Sex Date Time Verbal Self harm
Violence_objects Violence
A 1 1-4-2007 1800 3 0
1 3
A 1 1-4-2007 1230 2 1
2 4
D 2 2-4-2007 1100 0
2012 Oct 05
5
Missing data (Na) and chi-square tests
Dear everyone
I am a bit of a computer imbecile and are having problems with R.
I am using R in my research project to do chi-square tests on data imported
from excel .
However I have som missing data in one of my variables (columns) and I need
R to "exclude" these and make chi-square test on the data that I have.
I use a formula to make 2x2 tables which is:
data <-
2013 Jan 17
3
coxph with smooth survival
Hello users,
I would like to obtain a survival curve from a Cox model that is smooth and does not have zero differences due to no events for those particular days.
I have:
> sum((diff(surv))==0)
[1] 18
So you can see 18 days where the survival curve did not drop due to no events.
Is there a way to ask survfit to fit a nice spline for the survival??
Note: I tried survreg and it did not
2013 Apr 07
3
mlogit error
Dear List
I am trying to fit a multinomial model using the mlogit package. Attempting to load
the data into mlogit presents the following error.
MLOG<-mlogit.data(Mult3,shape="long",choice="CHOICE",alt.var="mode.ids",indivs = "set3",chid.var = "obs")
Error in `row.names<-.data.frame`(`*tmp*`, value = c("1.1", "1.2",
2012 Dec 28
3
help with reshaping wide to long format
Hi, Sorry, but how did you bring it out?
Thanks
On Fri, Dec 28, 2012 at 8:48 AM, arun kirshna [via R] <
ml-node+s789695n4654093h10@n4.nabble.com> wrote:
> Hi,
> bp.sub<- structure(list(CODEA = c(1L, 3L, 4L, 7L, 8L, 9L, 10L, 11L, 12L,
> 13L, 14L, 16L, 17L), C45 = c(NA, 2L, 2L, 2L, 2L, 1L, NA, 1L,
> 1L, 2L, 1L, 2L, 1L), ragek = c(3L, 3L, 3L, 4L, 4L, 3L, 3L, 3L,
> 3L, 3L,
2012 Apr 16
2
Survival Curves
Hello
I'm trying to make survival curves for some longevity data -
100 males and 100 females, some of which are still living (not dead at the
end of survey)
I would like to make sex specific survival curves as time on the X axis,
proportion alive on the Y, and a line for each sex (two lines)
Data looks like this:
Focal DOB DOD Longevity Sex
1 89-04-20 na
2024 May 16
1
Extracting values from Surv function in survival package
Hi Dennis,
look at the help page for summary.survfit, the Value n.event.
G?ran
On 2024-05-15 22:41, Dennis Fisher wrote:
> OS X
> R 4.3.3
>
> Colleagues
>
> I have created objects using the Surv function in the survival package:
>> FIT.1
> Call: survfit(formula = FORMULA1)
>
> n events median 0.95LCL 0.95UCL
>
2010 Sep 21
2
Survival curve mean adjusted for covariate: NEED TO DO IN NEXT 2 HOURS, PLEASE HELP
Hi
I am trying to determine the mean of a Weibull function that has been fit to
a data set, adjusted for a categorical covariate , gender (0=male,1=female).
Here is my code:
library(survival)
survdata<-read.csv("data.csv")
##Fit Weibull model to data
WeiModel<-survreg(Surv(survdata$Time,survdata$Status)~survdata$gender)
summary(WeiModel)
P<-pweibull(n,
2010 Mar 26
4
Creating a vector of categories
Hi,
I have a column in a data frame looking something like:
$sex $language $count
male english 0
male english 0
female english 32
male spanish 154
female english 11
female norweigan 7
and so on.
What I want to do is to order these in to categories, for instance one
category where count>=0 & count<10 and so on..
I want my data to turn out looking something like:
male
2010 Sep 23
2
extending survival curves past the last event using plot.survfit
Hello,
I'm using plot.survfit to plot cumulative incidence of an event.
Essentially, my code boils down to:
cox <-coxph(Surv(EVINF,STATUS) ~ strata(TREAT) + covariates, data=dat)
surv <- survfit(cox)
plot(surv,mark.time=F,fun="event")
Follow-up time extends to 54 weeks, but the last event occurs at week
30, and no more people are censored in between. Is there a