Displaying 20 results from an estimated 8000 matches similar to: "Surv object in data.frame and Design package"
2006 Mar 15
5
Surv object in data.frame
Dear All,
a Surv object I put in a data frame behaves somehow unexpected (see example).
If I do a Cox regression on the original Surv object it works. If I put it
in a data.frame and do the regression on the data frame it does not work.
Seemingly it has to do with the class attribute, because if I change the
class attribute to let "Surv" appeare first, again it works.
Is this known?
2006 Dec 05
0
How to join data.frames containing Surv objects?
Dear All,
Trying to combine two data frames with identical structure by rbind() or
merge() I cannot find a way to preserve the class of a Surv object (see
example).
Reading the help page for rbind, I an uncertain if I could expect that a
Surf oject retains it's class, but I would wish it did.
Thanks
Heinz T?chler
R version 2.4.0 Patched (2006-11-03 r39792)
Windows XP
library(survival)
##
2013 Feb 13
2
NA/NaN/Inf in foreign function call (arg 6) error from coxph function
Dear R-helpers:
I am trying to fit a multivariate Cox proportional hazards model,
modelling survival outcome as a function of treatment and receptor
status. The data look like below:
# structure of the data
str(sample.data)
List of 4
$ survobj : Surv [1:129, 1:2] 0.8925+ 1.8836+ 2.1191+ 5.3744+
1.6099+ 5.2567 0.2081+ 0.2108+ 0.2683+ 0.4873+ ...
..- attr(*, "dimnames")=List of 2
2009 Jul 13
1
survSplit with data.frame containing a Surv object
Dear All,
since years I am struggling with Surv objects in data.frames. The
following seems to have to do with it.
See below the modified example from the help page of survSplit. The
original works, as expected. If, however, a Surv object is added to
the data.frame, each record gets doubled.
Is there some solution other than avoiding Surv objects in data.frames?
Thanks,
Heinz
2012 Apr 13
3
Kaplan Meier analysis: 95% CI wider in R than in SAS
Hello All,
?
Am replicating in R an analysis I did earlier using SAS. See this as a test of whether I'm ready to start using R in my day-to-day work.
?
Just finished replicating a Kaplan Meier analysis. Everything seems to work out fine except for one thing. The 95% CI around my estimate for the median is substantially larger in R than in SAS. For example, in SAS I have a median of 3.29 with a
2013 Jan 14
1
Does psm::Surv handle interval2 data?
Does Surv in psm handle interval2 data? The argument list seems to indicate it does but I get an error.
Thanks,
Chris
# code
library('survival')
left <- c(1, 3, 5, NA)
right <-c(2, 3, NA, 4)
Surv(left, right, type='interval2')
survreg(Surv(left, right, type='interval2') ~ 1)
library('rms')
Surv(left, right, type='interval2') # error
args(Surv)
2013 Feb 12
0
NA/NaN/Inf in foreign function call (arg 6) error from coxph
Dear R-helpers:
I am trying to fit a multivariate Cox proportional hazards model,
modelling survival outcome as a function of treatment and receptor
status. The data look like below:
# structure of the data
str(sample.data)
List of 4
$ survobj : Surv [1:129, 1:2] 0.8925+ 1.8836+ 2.1191+ 5.3744+
1.6099+ 5.2567 0.2081+ 0.2108+ 0.2683+ 0.4873+ ...
..- attr(*, "dimnames")=List of 2
2012 Nov 27
4
Fitting and plotting a coxph with survfit, package(surv)
Hi Dear R-users
I have a database with 18000 observations and 20 variables. I am running
cox regression on five variables and trying to use survfit to plot the
survival based on a specific variable without success.
Lets say I have the following coxph:
>library(survival)
>fit <- coxph(Surv(futime, fustat) ~ age + rx, data = ovarian)
>fit
what I am trying to do is plot a survival
2005 Oct 11
1
summary of Surv object crashes R 2.2.0 (PR#8203)
Full_Name: Victor Moreno
Version: 2.2.0
OS: windows
Submission from: (NULL) (213.151.99.160)
summary of an object class Surv (package survival) hangs and closes R 2.2.0
I would like to have Surv objects in a data frame to build models easier:
t<-rexp(100)
s<-rbinom(100,1,.3)
surv<-Surv(t,s)
x1<-rnorm(100,10,2)
x2<-rnorm(100,10,2)
dat<-data.frame(surv,x1,x2)
2011 Jun 03
1
Surv(): Stop time must be > start time, NA created
I am writing to get a better handle on a warning I am getting from a coxph analysis I am doing.
I am analysing age of onset of dementia *after* the onset of parkinson disease. My data looks like:
age.park age.dem age.death censor x1 x2 x3 x4
1 76 87 88 0 16 33 E3 E3
2 75 84 84 0 33 36 E3 E3
3 77 81 81 1 NA NA
2011 Jul 08
1
survConcordance with 'counting' type Surv()
Dear Prof. Therneau
I was impressed to discover that the 'survConcordance' now handles Surv() objects in counting format (example below to clarify what I mean). This is not documented in the help page for the function. I am very curious to see how a c-index is estimated in this case, using just the linear predictors. It was my impression that with left truncation the ordering of
2008 Dec 19
1
How to write a Surv object to a csv-file?
Dear All,
trying to write a data.frame, containing Surv objects to a csv-file I get
"Error in dimnames(X) <- list(dn[[1L]], unlist(collabs, use.names = FALSE)) :
length of 'dimnames' [2] not equal to array extent".
See example below.
May be, I overlooked something, but I expected
that also data.frames containing Surv objects may be written to csv files.
Is there a
2013 Jul 23
0
Coxme Package Error Message Help
Hello: I am new to R Help so hopefully I will have included enough
information to allow for valuable feedback on an error message I am
receiving. I am trying to a fit a mixed effects cox model to binary elk
telemetry data to look at movement decisions relative to other
possibilities (specifically selection or avoidance of risk <- kauf_avg ) in
a matched-case-control framework.
>
2007 Nov 09
2
wrapper for coxph with a subset argument
Dear R-help -
Thanks to those who replied yesterday (Christos H. and Thomas L.)
regarding my question on coxph and model formula, the answers worked
perfectly.
My new question involves the following.
I want to run several coxph models (package survival) with the same
dataset, but different subsets of that dataset.
I have found a way to do this, described below in functions subwrap1 and
2004 Aug 11
2
str and Surv objects
Dear R People:
I used the "Surv" function to produce the following object:
>a <- Surv(1:4,2:5,c(0,1,1,0)) a
[1] (1,2+] (2,3 ] (3,4 ] (4,5+]
>str(a)
Error in "[.Surv"(object, 1:ile) : subscript out of bounds
>
Why does str(a) give an error, please? Or did I do something wrong?
Thanks in advance.
R Version 1.9.1 Windows
Sincerely,
Laura Holt
mailto: lauraholt_983
2007 May 02
3
the Surv function
Hi,
I'm trying to do a simple survival analysis on some data, and I'm having the
following problem (here's my code and the error message):
out <- Surv(fup,event=status)
Error in Surv(fup, event = status) : argument "time2" is missing, with no
default
>From reading the documentation, it seems that I should be able to simply
write: Surv(time1, event) if my data is
2012 Dec 06
1
as.matrix.Surv -- R core question/opinions
1. A Surv object is a matrix with some extra attributes. The as.matrix.Surv function
removes the extras but otherwise leaves it as is.
2. The last several versions of the survival library were accidentally missing the
S3method('as.matrix', 'Surv') line from their NAMESPACE file. (Instead it's position is
held by a duplicate of the line just above it in the NAMESPACE file,
2009 Sep 29
3
creating Surv object from character vector
Hello,
I have
srv <- Surv(sample(1:10), sample(0:1, 10, replace = TRUE))
srv
[1] 1 10 2+ 8 6+ 7+ 3 5+ 4+ 9+
srv.char <- as.character(srv)
srv.char
[1] " 1 " "10 " " 2+" " 8 " " 6+" " 7+" " 3 " " 5+" " 4+" " 9+"
Is there an inverse to as.character(srv). That is, I would
2011 May 08
1
question about val.surv in R
Dear R users:
I tried to use val.surv to give an internal validation of survival
prediction model.
I used the sample sources.
# Generate failure times from an exponential distribution
set.seed(123) # so can reproduce results
n <- 1000
age <- 50 + 12*rnorm(n)
sex <- factor(sample(c('Male','Female'), n, rep=TRUE, prob=c(.6, .4)))
cens <- 15*runif(n)
h
2011 Aug 20
1
val.surv
Dear R-users,
I have two questions regarding validation and calibration of Survival regression models.
1. I am trying to calibrate and validate a cox model using val.surv.
here is my code:
f.1<-cph(Surv(time,event)~age, x=T, y=T, data=train)
test1<-test[,"age"]
val.surv(f.1, newdata=data.frame(test1), u=10)
but I get an error message:
Error in val.surv(f.1, newdata