[R] Weighted Kaplan-Meier estimates with R (with confidence intervals)?

2013-03-25 Thread rm
As part of a research paper, I would like to draw both weighted and unweighted Kaplan-Meier estimates, the weight being the ’importance’ of the each project to the mass of projects whose survival I’m trying to estimate. I know that the function survfit in the package survival accepts weights and p

Re: [R] Weighted Kaplan-Meier estimates with R (with confidenceintervals)?

2013-03-25 Thread rm
Say, that I have two observations, one from time 0 to time 50, and a second from time 0 to time 100, both of which are known to have failed, i.e. no censoring. I would like to give double the weight to the second observation. This is what I’ve tried to implement in the both pieces of code. Both pi

Re: [R] Weighted Kaplan-Meier estimates with R

2013-03-27 Thread rm
Thanks to all of you for your very helpful comments! As Terry suggested, svykm is what I was looking for. While testing that I get the same results with the package survey as with the package survival, I encountered the issue of how to draw survival curves. Apparently the implementations in the t

[R] Problems with coxph and survfit in a stratified model with interactions

2012-10-13 Thread rm
I’m trying to set up proportional hazard model that is stratified with respect to covariate 1 and has an interaction between covariate 1 and another variable, covariate 2. Both variables are categorical. In the following, I try to illustrate the two problems that I’ve encountered, using the lung da

[R] Problems with coxph and survfit in a stratified model with interactions

2012-10-13 Thread rm
I’m trying to set up proportional hazard model that is stratified with respect to covariate 1 and has an interaction between covariate 1 and another variable, covariate 2. Both variables are categorical. In the following, I try to illustrate the two problems that I’ve encountered, using the lung da

Re: [R] Problems with coxph and survfit in a stratified model with interactions

2012-10-17 Thread rm
Hi Chris, Yes, that is exactly the model I want to fit, i.e. a separate 'baseline' hazard for each stratum (defined by cov1) and a coefficient for cov2 that is different for each stratum. Is suspect that there is a problem with the following line of your code. sCox <- coxph(Surv(time, status)

[R] coxph: how to define interaction terms?

2013-10-28 Thread rm
I’m trying to set up Cox Proptional Hazard model with interactions between time and the covariates (which are categorical). The problem that I face is that how to define the interactions, i.e. “x+cutStart:x”, properly. The code below illustrates the problem. R gives the error message ” X matrix de

Re: [R] coxph: how to define interaction terms?

2013-10-28 Thread rm
The output is as follows. My question is how to include only the interaction terms where x is equal to "Maintained". (x has two possible values "Maintained" and "Nonmaintained".) -- View this message in context: http://r.789695.n4.nabble.com/coxph-how-to-define-interaction-terms-tp4679162p46

Re: [R] coxph: how to define interaction terms?

2013-10-29 Thread rm
Any ideas would be much appreciated; I suspect that this problem of constructing the dummies applies not only to function coxph but to other regression models in R as well. Effectively, my question is how to better control for which dummies and interactions to include in the model and which not. T

[R] Standard errors in regression models with interactions terms

2013-11-09 Thread rm
In a rather simple regression, I’d like to ask the question, for high trees, whether it makes a difference (for volume) whether a three is thick. If my interpretation is correct, for low trees, i.e. for which trees$isHigh == FALSE, the answer is yes. The problem is how to "merge" the standard er