On Oct 15, 2010, at 9:21 AM, ?hagen Patrik wrote:
Dear List,
I each iteration of a simulation study, I would like to save the p-
value generated by coxph. I fail to see how to adress the p-value.
Do I have to calculate it myself from the Wald Test statistic?
No. Look at
.
Terry Therneau
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
. Your models assume that marker1, marker2, ... each have
the same effect across tissue types. Adding a random effect gave per
subject or per subject/tissue intercepts. Do you instead want to do
shrinkage of the marker1, .. coefficients?
Terry Therneau
regression on the observed times is
wrong. Censored data is more complex than that.
Terry Therneau
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
1. The weibull is the only distribution that can be written in both a
proportional hazazrds for and an accelerated failure time form. Survreg
uses the latter.
In an ACF model, we model the time to failure. Positive coefficients
are good (longer time to death).
In a PH model, we model the
If you are looking at radioactive decay maybe but how often do
you actually see exponential KM curves in real life?
Exponential curves are rare. But proportional hazards does not imply
exponential.
A trial design
could in fact try to get all the control sample to event at the same
time if
The pspline function uses P-splines (Eilers and Marx, Statistical
Science, 1981), which are a spline basis using a regular set of knots.
Looking at the code for pspline, which isn't so hard, let
dx = (max(x) - min(x))/ ntermwhere nterm is round(2.5 * desired
degrees of freedom)
Note that there is NOT an intercept term in my pspline basis. One of
the features of psplines is that \sum beta_i f_i(x) (where f_i are the
spline basis functions) is linear if and only if the coefficients beta
are a linear sequence. This makes it easy to decompose the fit into
linear and
This feature has been added in survival 2.36-1, which is now on CRAN.
(2.36-2 should appear in another day or so)
Terry T.
-begin included message
I was trying to use predict.coxph to calculate martingale residuals on
a test
data, however, as pointed out before
For tobit regression, also see the last example of help(survreg) in the
survival package.
Terry Therneau
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting
for accelerated failure time models, or even
better Escobar and Meeker which comes from the industrial reliability
view. For predicted survival from a Cox model see Chapter 10 of
Therneau and Grambsch. The answers to your specific questions would be
a document rather than an email.
Terry Therneau
that
significant changes in a log-likihood are on the order of 3.94/2 =2
units, I do not get very excited by a .08 difference in convergence.
Terry Therneau
-- begin included message --
I add an example , all the variables are mutually excluding dummy
variables,
notice
Just like a Poisson regression model, is there a package in R to do
Extreme Value Regression model? Thanks.
The survreg routine includes the extreme value distribution. It allows
for cenored data, but the data can be uncensored.
fit - survreg(Surv(y) ~ x1 + x2 + x3, dist='extreme')
Terry
. You need to decide how to define
goodness.
Terry Therneau
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self
series argument to
compute the se of the survival.
(The are several reasons for this choice, including that se(survival) is
not well defined by the standard formulas when S=0).
Terry Therneau
__
R-help@r-project.org mailing list
https://stat.ethz.ch
since the start of the experiment
cumulative CO2 dose
days over a threshold
etc
You can examine each of these one by one or in combinations. It would
be very difficult, however, to ask your program to find the pattern.
Terry Therneau
be the easiest code for multiple strata, at least
that I can think of offhand.
plot(surv, mark.time=F, fun='event', xlim=c(0, 54))
for (i in 1:length(surv$strata)) { #number of curves
temp - surv[i]
lines(c(max(temp$time), 54), 1- rep(min(temp$surv),2))
}
Terry Therneau
), or logit (good)
scales. I expect that Minitab and S default to different choices. See
the conf.type argument in help(survfit.formula).
Terry Therneau
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting
of the families. I looked it up in the help pdf and on the
internet, but I couldn't find anything.
Would it be possible to do such a thing ?
--- end inclusion --
Yes it is possible -- but clearly I need to add one more example to the help
page; use a strata() term.
Terry Therneau
survreg(Surv(time
. For one thing I made the maximizer much more intelligent: I
now use optim :-).
Terry Therneau
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org
this to include more examples
over the next few months.
Terry Therneau
Mayo Clinic
___
R-packages mailing list
r-packa...@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-packages
__
R-help@r
-begin included message ---
With rpart we can get several terminals and draw it in the TREE plot.
Now I am trying to draw a plot like this: x-axis is each terminal's
value, and y-axis is those observe values. Does anyone has idea what
gramma should I use? Thanks in advance.
-- begin included
Greetings!
I want to follow the evolution of a Nelder-Mead function
minimisation (a function of 2 variables). Hence each simplex
will have 3 vertices.
Therefore I would like to have a function which can output
the coordinates of the 3 vertices after each new
(
summary(fit, times=c(0,10,20,30,...
Terry Therneau
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self
,standard errors, residuals, etc. The
other covariates are optional of course. If n=1 for all observations
the offset can be omitted.
Terry Therneau
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting
-- begin included message ---
(basehazzft.ln$stra[285])
[1] stra=2
134 Levels: stra=1 stra=10 stra=100 stra=101 stra=102 ... stra=99
c(basehazzft.ln$stra[285])
[1] 47
while the desired value is 2, I get a 47. What am I doing wrong? I tried
the as.numeric function but I have the same problem..
To extract various portions of the coxph standard printout, look at
summary.coxph
help('summary.coxph')
fit - coxph(...
sfit - summary(fit)
Terry Therneau
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do
The best answer to your question is
help(coxph.object)
This is a manual page describing the contents of a coxph fit.
Terry Therneau
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
this without issue. I'd have to
see the data; perchance you have found a never-before-seen infinite
loop.
Terry Therneau
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R
degree of freedom. The frailty terms
don't usually have 1 df, so one can't use the special case.
Terry Therneau
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org
Your problem appears to be with coxphw, not coxph. I have never before
heard of the coxphw function; you should identify what package it is
from in your request, and perhaps also contact the author. If you have
found a similar issue in survfit I would be glad to see an example.
Terry Therneau
a relapse early when all 5 are still at risk, dropping the
curve by .2 units. Their death is late when only 2 are at risk,
dropping the curve by 1/2.
This crossing anomaly usually only happens near the end of a
Kaplan-Meier, when the confidence intervals are as wide as a river.
Terry Therneau
The Mantel-Byar test is a simple modification to the logrank test. Can
R perform this test or any other similar test?
The logrank test = score test from coxph
The Mantel-Byar is the score test from a Cox model with a time dependent
covariate.
Terry Therneau
a
penalty mulitplier.
To get a clearer answer you would need to give the explicit
definition of tension factor from the literature you are quoting.
It's not just that different disciplines rediscover the same ideas, they
also relabel them.
Terry Therneau
to use cox.zph() to investigate which
variables need time interaction...
The cox.zph function is primarily graphical; I would respond to your
question with is it good to look at scatterplots before fitting a
linear model? My answer to this is emphatically yes.
Terry Therneau
plot(data1$cts, predict(coxfit1))
or if you want confidence intervals, this gives the data to plot
pr1 - predict(coxfit1, type='terms', se=T)
Terry Therneau
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do
to program and thus
was the first one implimented. However, for simulated data there will
not be any ties in time so the two are identical.
Terry Therneau
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read
option. There is certainly room for
disagreement. Opinions welcome.
Terry Therneau
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide
pass
the F-to-enter threshold.
The plot and text routines won't plot anything for a null tree, because
there is nothing interesting to plot.
Terry Therneau
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do
help('rpart.object') will give you information on the return value from
rpart. I think you want the 'where' portion.
For new data help('predict.rpart') gives the predicted results.
Terry T
--
Hi,
I am building a regression tree (method=anova) by using
to interpret rescaled coefficients, I
don't know how to interpret them either.
3. The residual for a censored observation is not a well defined
quantity. Hence both the computation and meaning of R^2 are unclear to
me.
Terry Therneau
Terry Therneau
__
R-help
In the nodes of the tree, the values of the covariates are represented
with a, b or c (tree attached).
Try help('text.rpart'), and note the 'pretty' argument therein.
There is often not enough room for long labels, and so the default is to
do the severe truncation you speak of.
Terry Therneau
The query was why survreg() with a cluster() statement fails.
The answer: a bug. A call to resid() preceded setting the class of the
result to 'survreg'.
I am currently adding another case to the test suite so that this does
not happen again, and to formally validate that the numeric
When two variables have exactly the same figure of merit, they will be
listed in the output in the same order in which they appeared in your
model statement.
Terry Therneau
-- begin inclusion ---
I had a question regarding the rpart command in R. I used seven
continuous
predictor variables
*season, data=...
One day I should update it so that if there is no censoring then the
Surv() wrapper is not required. Also, see the examples in the ?survreg
documentation for comments on shape and scale. This routine uses a
location-scale parameterization which is different than rweibull.
Terry
of a single variable driving each split, what you are asking for would
require an entirely different program.
Terry Therneau
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R
Is there a way to tell it to make a tree with only one node?
- see the maxdepth parameter in ?rpart.control
Is it safe to assume that the cut-off value on the primary node is the
ideal cut-off?
- trees are built sequentially; the first split will be the same for a
tree with only one split or
to know
the answer too, both how to compute and what the result is worth.)
Terry Therneau
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
that most of the data fits an additive
model and how well it does so. It is much better than what you
requested -- which isn't hard as a 3-d barplot is one of the worst tools
ever made for information conveyance.
Terry Therneau
__
R-help@r
) ~ Treatment, data=survdata)
lines(kmfit, mark.time=F, col=1:2)
Terry Therneau
--- begin included message --
I'm trying to fit a curve to some 1 year failure-time data, so that I
can
extrapolate and predict failure rates up to 3 years. The data is in the
general form:
Treatment Time
of the day.
Terry Therneau (author of the package)
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self
explanations,
examples, and discussion see
T. Therneau and P Grambsch, Modeling Survival Data: Extending
the Cox Model, Springer-Verlag, 2000.
The book and software evolved together.
Terry Therneau
__
R-help@r-project.org mailing list
https
The table component is a matrix.
Terry Therneau
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained
distributions.
For a multivariate model the call above would use mean =
sum(x* fit$coef), where x was the vector of values for a hypothetical
subject.
An alternative is to use predict(fit2, type='quantile'), there is an
example in help(predict.survreg).
Terry Therneau
PS Your title was wrong, the quesion
increments, the same for each subject.
b. the form of the non-ph is actally a linear change in beta over
time. Use cox.zph on the original model to look at this. When I see
non-ph (the plot from cox.zph is not horizontal) life is rarely so
simple.
Terry Therneau
.
Terry Therneau
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
, but the note
below talks about how to do so approximately with survreg. It's a note
to myself of something to add to the survival package documentation, not
yet done, and to my embarassment the file has a time stamp in 1996. Ah
well.
Terry Therneau
My document A Package for Survival
Could you save the original graphics as a pdf, and include the pdf in
Powerpoint?
-- begin included message --
Unfortunately, after placed in the PowerPoint and the PowerPoint is
converted to PDF via MS Office's built in conversion utility, the
resulting image have diagonal
, Regression techniques for the detection
of analytical bias, Analyst 112:377-383, 1987.
K Linnet, Estimation of the linear relationship between the
measurements of two methods with proportional errors.
Statistics in Medicine 9:1463-1473, 1990.
}
\author{Terry Therneau}
\examples{
# Data from
it anew. Hindsight is always 20/20.
BUT -- I would be quite happy to have someone write a better ridge()
plugin. Interested?
Terry Therneau
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
you had to cut and paste your block of setup code
onto the front of each program's instructions. Cut and paste with a
keypunch machine is not quite as simple as with a mouse, if you needed a
listing, some frequencies, 2-3 regressions, ... it got rather tedious.
Terry Therneau
?
That is almost correct. If there are prior probabilities, it will be the
expected proportion of each class, accounting for priors. If there are no
priors, then the expected proportion = observed proportion.
Terry Therneau
__
R-help@r-project.org
matrix to dense form. The vector of frequencies for group might also
be useful.
Terry Therneau
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting
,
you find that the former group has a much higher death rate.
Terry Therneau
Kevin E. Thorpe wrote:
Dear List:
I have a data frame prepared in the couting process style for including
a binary time-dependent covariate. The first few rows look like this.
PtNo StartEnd
I thought about this some more, and I'm not sure that possibility is
to blame. In my time-dependent model, I don't think I'm doing
anything different than is done for transplant in the Stanford
Heart Study (the often used example for this kind of time-dependent
covariate). As in my case,
For numerical accuracy, the coxph routine centers each covariate before doing
the computation. All of the downstream results (predict, survfit, etc) use
this
centered data.
Terry Therneau
__
R-help@r-project.org mailing list
https
/
In particular, #53 contains information on the parametric models that is not
found elsewhere.
Terry Therneau
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org
the
current covariate values AT THAT TIME. Since the value of your t is always a
constant within the set, the variable contains no information for
discriminating
the events from the non-events. Zero information -- a coefficient of NA.
Terry Therneau
Mayo Clinic
You have (unimportant lines omitted)
c2= survdiff(Surv(act.surv.time,censoring)~treatgrp ,data=b)
plot(c2)
The problem is that you are using the wrong function. It is survfit that
creates plottable survival curves, survdiff only does the log-rank test.
Terry Therneau
of SAS infallability).
Terry Therneau
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained
method (1961) brought forward to a
Cox model. The ideas are not hard, but it does take a whole chapter.
Terry Therneau
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http
retires, whichever comes first. L.L.
Terry Therneau
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal
that improves readability is a good thing.
Agreements: 98% of what they say.
Terry Therneau
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting
printing out the R internal code, which has been stripped of
all comments.
Terry Therneau
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
you should research before going forward.
Terry Therneau
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal
this behavior.
I happen to slightly prefer option 1, which of course means that it became
the default behavior in rpart. (For a categorical y with many levels, however,
rpart orders on the percent of observations in category 1, which may not be
particularly useful.)
Terry
cipoisson(observed, expected)
Terry Therneau
Mayo Clinic
cipoisson -
function(k, time = 1, p = 0.95, method = c(exact, anscombe) ) {
nn - max(length(k), length(time), length(p))
if(nn 1) {
k - rep(k, length = nn)
time - rep(time
is
the
sum of the variances.
Terry Therneau
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained
as
the random effect. A Cox model with one random effect per subject is not
stable
-- actually an one where df(random effect) approaches the number of events is
not --- and you will likely get a variance estimate whose confidence interval
is
(0, huge number).
Terry Therneau
the se.fit=T argument to get confidence bounds
for the curves. (A couple more lines for your matplot call of course).
Terry Therneau
Mayo Clinic
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read
.
Terry Therneau
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
)
Terry Therneau
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
censored at 2. The gambling analogy would be kicking
someone out of the casino just before they win -- it does odd things to the
odds.
Terry Therneau
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read
defined for right-censored data. That is why you
get an error when you include left and interval censored observations.
Terry Therneau
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read
A point of history:
Both the commercial CART program and the rpart() function are based on the
book Classification and Regression Trees (Breiman, Friedman, Olshen, Stone,
1984). As a reader/commentator on one of the early drafts I got to know the
material well. CART started as a large
' in coxph. Why
substitute an inferior approximation for the better one? Of course with
simulated data there are no ties, in which case all the methods are identical.
Terry Therneau
__
R-help@r-project.org mailing list
https://stat.ethz.ch
to be just right you can get your data to split.
You need to make them such that 85/5 is predicted as 'no cancel' and 5/5 as
'yes
cancel'; 1:2 losses would suffice. In the example where you set losses to
1:1 both nodes are scored as a 'yes'.
Terry Therneau
one.
Not surprisingly, the second ends up with a coefficient of 0 (within machine
precision of zero). The warning message you got about NaN is likely related
to
this, that there are redundant terms in the model.
Terry Therneau
__
R-help@r
=na.exclude)
o.minus.e - tapply(resid(fit0), mydata$group, sum)
obs - tapply(mydata$status, mdata$group, sum)
cbind(observed=obs, expected= obs- o.minus.e, o-e=o.minus.e)
Terry Therneau
__
R-help@r-project.org mailing list
https
)
Call: survfit(formula = data)
It is best to use a formula with the survfit program; the preferred way to
call
it would be
km - survfit(Surv(t, c) ~1)
print(km)
plot(km)
etc.
Terry Therneau
__
R-help@r-project.org mailing list
https
: the cluster() directive confuses the survfit function. This is a
bug. I will address it.
Terry Therneau
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org
I have a problem whose solution requires non-negative least squares. That is
minimize sum(y - Xbeta)^2 subject to beta =0
Splus has the nnls.fit command. Is there an R alternative?
Terry Therneau
__
R-help@r-project.org
. Spline fits based on the truncated power basis (which Frank
Harrell uses) are one way to generate such spurious messages.
Frank has argued with me that these messages may be shedding more confusion
than illumination. He has a point.
Terry Therneau
? It causes the case to have a relative weight of approx 0 in a
particular weighted mean; exp(-100) is small enough and doesn't cause trouble
for the exp function.
Terry Therneau
__
R-help@r-project.org mailing list
https://stat.ethz.ch
coefficients as the cch example, along with the
infinitesimal jackknife or robust variance estimate.
Terry Therneau
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R
. So what?
Terry Therneau
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained
could be ignored. However, I am very interested in the
error message; it is one I have not seen before. If you could recreate the
data
set that produces it and send it to be that would be useful.
Terry Therneau
(author of coxph
for a
multi-line dataset =1 if THIS interval ends with an event. Look at the
survival
analysis chapter of Venables Ripley, Modern Applied Statistics with S, for
further insight. (or many other books)
Terry Therneau
__
R-help@r-project.org mailing
# remember who was chosen
chosen[cases] - i # link them to the right case
}
fit - coxph(Surv(time, status) ~ x1 + x2 + strata(chosen),
subset= (chosen 0))
Terry Therneau
so omitted
Terry Therneau
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained
1 - 100 of 430 matches
Mail list logo