Displaying 20 results from an estimated 20000 matches similar to: "as.matrix.Surv -- R core question/opinions"
2012 Nov 30
1
Baffled with as.matrix
I'm puzzled by as.matrix. It appears to work differently for Surv objects.
Here is a session from my computer:
tmt% R --vanilla
> library(survival)
Loading required package: splines
> ytest <- Surv(1:3, c(1,0,1))
> is.matrix(ytest)
>[1] TRUE
> attr(ytest, 'type')
[1] "right"
> attr(as.matrix(ytest), 'type')
[1] "right"
>
2013 Apr 19
2
NAMESPACE and imports
I am cleaning up the rms package to not export functions not to be called
directly by users. rms uses generic functions defined in other packages.
For example there is a latex method in the Hmisc package, and rms has a
latex method for objects of class "anova.rms" so there are anova.rms and
latex.anova.rms functions in rms. I use:
2009 May 15
1
Function Surv and interpretation
Dear everyone,
My question involves the use of the survival object.
We can have
Surv(time,time2,event, type=, origin = 0) (1)
As detailed on p.65 of:
http://cran.r-project.org/web/packages/survival/survival.pdf
My data (used in my study) is 'right censored' i.e. my variable corresponding to 'event' indicates whether a person is alive (0) or dead (1) at date last seen
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
2008 Apr 25
3
Use of survreg.distributions
Dear R-user:
I am using survreg(Surv()) for fitting a Tobit model of left-censored longitudinal data. For logarithmic transformation of y data, I am trying use survreg.distributions in the following way:
tfit=survreg(Surv(y, y>=-5, type="left")~x + cluster(id), dist="gaussian", data=y.data, scale=0, weights=w)
my.gaussian<-survreg.distributions$gaussian
2007 Nov 29
1
Survreg(), Surv() and interval-censored data
Can anybody give me a neat example of interval censored data analysis codes in R?
Given that suvreg(Surv(c(1,1,NA,3),c(2,NA,2,3),type="interval2")~1)
works why does
survreg(Surv(data[,1],data[,2],type="interval2")~1)
not work where
data is :
T.1 T.2 Status
1 0.0000000 0.62873036 1
2 0.0000000 2.07039068 1
3 0.0000000
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
2012 Nov 17
4
survfit & number of variables != number of variable names
This works ok:
> cox = coxph(surv ~ bucket*(today + accor + both) + activity, data = data)
> fit = survfit(cox, newdata=data[1:100,])
but using strata leads to problems:
> cox.s = coxph(surv ~ bucket*(today + accor + both) + strata(activity),
> data = data)
> fit.s = survfit(cox.s, newdata=data[1:100,])
Error in model.frame.default(data = data[1:100, ], formula = ~bucket + :
2009 Aug 01
2
Cox ridge regression
Hello,
I have questions regarding penalized Cox regression using survival
package (functions coxph() and ridge()). I am using R 2.8.0 on Ubuntu
Linux and survival package version 2.35-4.
Question 1. Consider the following example from help(ridge):
> fit1 <- coxph(Surv(futime, fustat) ~ rx + ridge(age, ecog.ps, theta=1), ovarian)
As I understand, this builds a model in which `rx' is
2010 May 26
3
Problem with plotting survival predictions from cph model
Dear R-helpers,
I am working with 'cph' models from 'rms' library. When I build simple
survival models, based on 'Surv(time, event)', everything is fine and I
can make nice plots using plot(Predict(f, time=3)).
However, recently I tried to be more specific and used 'Surv(start,
stop, event)' type model. Using this model 'plot(Predict(f))' works OK,
but
2018 Jun 26
3
list of methods
I recently got a request to add head() and tail() methods for Surv objects, which is quite
reasonable, but not unlike other requests for logLik,? vcov, extractAIC, ...?? What they
all have in common is that are methods added since creation of the survival package, and
that I didn't know they existed.
To try and get ahead of the curve, is there a way to list names of all of the default
2012 Nov 26
1
Plotting an adjusted survival curve
First a statistical issue: The survfit routine will produce predicted survival curves for
any requested combination of the covariates in the original model. This is not the same
thing as an "adjusted" survival curve. Confusion on this is prevalent, however. True
adjustment requires a population average over the confounding factors and is closely
related to the standardized
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)
2024 Aug 26
9
specials and ::
The survival package makes significant use of the "specials" argument of terms(), before
calling model.frame; it is part of nearly every modeling function. The reason is that
strata argments simply have to be handled differently than other things on the right hand
side. Likewise for tt() and cluster(), though those are much less frequent.
I now get "bug reports" from the
2020 Sep 25
1
Extra "Note" in CRAN submission
When I run R CMD check on the survival package I invariably get a note:
...
* checking for file ?survival/DESCRIPTION? ... OK
* this is package ?survival? version ?3.2-6?
* checking CRAN incoming feasibility ... NOTE
Maintainer: ?Terry M Therneau <therneau.terry at mayo.edu>?
...
This is sufficient for the auto-check process to return the following failure message:
Dear maintainer,
2011 Apr 13
3
Problem with dyn.load in R 2.13.0
I have a test directory for the survival suite, and dyn.load has ceased
to work in it. Below shows the log:
tmt1075% R --vanilla
R version 2.12.2 (2011-02-25)
Copyright (C) 2011 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: x86_64-unknown-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain
2018 Jan 18
1
Time-dependent coefficients in a Cox model with categorical variants
First, as others have said please obey the mailing list rules and turn of
First, as others have said please obey the mailing list rules and turn off html, not everyone uses an html email client.
Here is your code, formatted and with line numbers added. I also fixed one error: "y" should be "status".
1. fit0 <- coxph(Surv(futime, status) ~ x1 + x2 + x3, data = data0)
2. p
2020 Feb 24
6
specials issue, a heads up
I recently had a long argument wrt the survival package, namely that the following code
didn't do what they expected, and so they reported it as a bug
? survival::coxph( survival::Surv(time, status) ~ age + sex + survival::strata(inst),
data=lung)
a. The Google R style guide? recommends that one put :: everywhere
b. This breaks the recognition of cluster as a "special" in the
2008 Jun 12
1
cch function and time dependent covariates
----- begin included message
In case cohort study, we can fit proportional hazard regression model to
case-cohort data. In R, the function is cch() in Survival package
Now I am working on case cohort analysis with time dependent covariates
using cch() of "Survival" R package. I wonder if cch() provide this utility
or not?
The cch() manual does not say if time dependent covariate is
2012 Oct 08
1
Survival prediction
> Dear All,
>
> I have built a survival cox-model, which includes a covariate * time interaction. (non-proportionality detected)
> I am now wondering how could I most easily get survival predictions from my model.
>
> My model was specified:
> coxph(formula = Surv(event_time_mod, event_indicator_mod) ~ Sex +
> ageC + HHcat_alt + Main_Branch + Acute_seizure +