[R] Plot of Fine and Gray model

2013-01-02 Thread Laura Bonnett
Dear all, Happy New year! I have used the 'crr' function to fit the 'proportional subdistribution hazards' regression model described in Fine and Gray (1999). dat1 is a three column dataset where: - ccr is the time to event variable - Crcens is an indicator variable equal to 0 if the event was

[R] Multiple forest plots with the same x-axis and colour coded estimates and lines

2011-08-22 Thread Laura Bonnett
Dear all, I would like to draw three forest plots to represent results at years 1, 2 and 3. I have the data as point estimates and 95% confidence intervals. Using the following code I can get three basic forest plots - the first which has the table of results. I have to plot each separately as

[R] Confidence interval for difference in Harrell's c statistics (or equivalently Somers' D statistics)

2011-05-05 Thread Laura Bonnett
Dear All, I am trying to calculate a 95% confidence interval for the difference in two c statistics (or equivalently D statistics). In Stata I gather that this can be done using the lincom command. Is there anything similar in R? As you can see below I have two datasets (that are actually two

Re: [R] Confidence interval for difference in Harrell's c statistics (or equivalently Somers' D statistics)

2011-05-05 Thread Laura Bonnett
On 5 May 2011 16:09, David Winsemius dwinsem...@comcast.net wrote: On May 5, 2011, at 8:20 AM, Laura Bonnett wrote: Dear All, I am trying to calculate a 95% confidence interval for the difference in two c statistics (or equivalently D statistics). In Stata I gather that this can be done

[R] repeat write.table with the same code many times

2010-11-30 Thread Laura Bonnett
Dear all, I am using R version 2.9.2 in Windows. I would like to output the results of a function I have written to a .txt file. I know that I can do this by using the code write.table(boothd(10),boothd10.txt,sep=\t,append=TRUE) etc. However, I would like to bootstrap my function 'boothd'

[R] Fractional Polynomials - Hazard Ratios and Relative Hazard Plots

2010-07-21 Thread Laura Bonnett
Dear All, I am using Windows and R version 2.9.2 with libraries cmprsk, mfp and Design. I have a dataset with approximately 1700 patients (1 row per patient) and I have 12 outcomes, three of which are continuous. I have performed univariate analyses to see if any factors are associated with a

[R] Relative Risk/Hazard Ratio plots for continuous variables

2010-05-25 Thread Laura Bonnett
Dear all, I am using Windows and R 2.9.2 for my analyses. I have a large dataset and I am particularly interested in looking at time to an event for a continuous variable. I would like to produce a plot of log(relative risk) or relative risk (also known as hazard ratio) against the continuous

[R] Baseline survival estimate

2009-12-16 Thread Laura Bonnett
Dear R-help, I am trying to obtain the baseline survival estimate of a fitted Cox model (S_0 (t)). I know that previous posts have said use 'basehaz' but this gives the baseline hazard function and not the baseline survival estimate. Is there a way to obtain the baseline survival estimate or do

[R] Using stepAIC to produce a p-value for when a particular variable was taken out of the model

2009-11-30 Thread Laura Bonnett
Dear all, I have decided after much deliberation to use backward elimination and forward selection to produce a multivariate model. Having read about the problems with choosing selection values I have chosen to base my decisions of inclusion and exclusion on the AIC and am consequently using the

Re: [R] Using stepAIC to produce a p-value for when a particular variable was taken out of the model

2009-11-30 Thread Laura Bonnett
I've just realised that this is a very silly post as I can't read!!! The output in the anova is the excluded variables - very sorry! Laura 2009/11/30 Laura Bonnett l.j.bonn...@googlemail.com Dear all, I have decided after much deliberation to use backward elimination and forward selection

[R] Unusual error while using coxph

2009-10-05 Thread Laura Bonnett
Hi all, I'm very confused! I've been using the same code for many weeks without any bother for various covariates. I'm now looking at another covaraite and whenever I run the code you can see below I get an error message: Error in rep(0, nrow(data)) : invalid 'times' argument This code works:

Re: [R] crr - computationally singular

2009-07-06 Thread Laura Bonnett
-Original Message- From: Laura Bonnett [mailto:l.j.bonn...@googlemail.com] Sent: Friday, June 26, 2009 6:22 AM To: Ravi Varadhan Cc: r-help@r-project.org Subject: Re: [R] crr - computationally singular Dear Sir, Thank you for your response.  You were correct, I

Re: [R] crr - computationally singular

2009-06-26 Thread Laura Bonnett
...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Laura Bonnett Sent: Thursday, June 25, 2009 11:39 AM To: r-help@r-project.org Subject: [R] crr - computationally singular Dear R-help, I'm very sorry to ask 2 questions in a week.  I am using the package 'crr' and it does

Re: [R] crr - computationally singular

2009-06-26 Thread Laura Bonnett
) , xx=sample(1:1000, 5) ,yy=sample(1:1000, 5) ) xyz$z - xyz$x + xyz$y + xyz$xx solve(xyz) Error in solve.default(xyz) :  system is computationally singular: reciprocal condition number = 6.39164e-20 On Jun 26, 2009, at 6:22 AM, Laura Bonnett wrote: Dear Sir, Thank you for your response.  You

[R] crr - computationally singular

2009-06-25 Thread Laura Bonnett
Dear R-help, I'm very sorry to ask 2 questions in a week. I am using the package 'crr' and it does exactly what I need it to when I use the dataset a. However, when I use dataset b I get the following error message: Error in drop(.Call(La_dgesv, a, as.matrix(b), tol, PACKAGE = base)) : system

[R] Fractional Polynomials in Competing Risks setting

2009-06-23 Thread Laura Bonnett
Dear All, I have analysed time to event data for continuous variables by considering the multivariable fractional polynomial (MFP) model and comparing this to the untransformed and log transformed model to determine which transformation, if any, is best. This was possible as the Cox model was

[R] Isolating a single plot from plots produced simultaneously

2009-06-09 Thread Laura Bonnett
Dear R-Help, I am using the 'mfp' package. It produces three plots (as I am using the Cox model) simultaneously which can be viewed together using the following code: fit - mfp(Surv(rem.Remtime,rem.Rcens)~fp(age)+strata(rpa),family=cox,data=nearma,select=0.05,verbose=TRUE) par(mfrow=c(2,2))

[R] Forcing a variableinto a model using stepAIC

2009-05-22 Thread Laura Bonnett
Dear All, I am attempting to use forward and/or backward selection to determine the best model for the variables I have. Unfortunately, because I am dealing with patients and every patient is receiving treatment I need to force the variable for treatment into the model. Is there a way to do

[R] Survreg/psm output

2009-04-16 Thread Laura Bonnett
Dear R-listers, I know that there have been many, many posts on the output from Survreg. To summarise what I have read, Scale is 1/shape of the Weibull which is also the standard deviation of the normal distribution which is also the standard deviation of the log survival time and Intercept is

Re: [R] Schoenfeld residuals

2009-04-14 Thread Laura Bonnett
help, Laura 2009/4/6 Terry Therneau thern...@mayo.edu: Laura Bonnett was kind enough to send me a copy of the data that caused the plotting error, since it was an error I had not seen before. 1. The latest version of survival gives a nicer error message: fit - coxph(Surv(rem.Remtime

[R] Schoenfeld Residuals

2009-04-03 Thread Laura Bonnett
Dear All, Sorry to bother you again. I have a model: coxfita=coxph(Surv(rem.Remtime/365,rem.Rcens)~all.sex,data=nearma) and I'm trying to do a plot of Schoenfeld residuals using the code: plot(cox.zph(coxfita)) abline(h=0,lty=3) The error message I get is: Error in plot.window(...) : need

Re: [R] Schoenfeld Residuals

2009-04-03 Thread Laura Bonnett
of ties is large, then you need to review Thernaeu Gramsch section 3.3 -- David Winsemius On Apr 3, 2009, at 7:57 AM, Laura Bonnett wrote: Dear All, Sorry to bother you again. I have a model: coxfita=coxph(Surv(rem.Remtime/365,rem.Rcens)~all.sex,data=nearma) and I'm trying to do a plot

[R] Centring variables in Cox Proportional Hazards Model

2009-03-26 Thread Laura Bonnett
Dear All, I am contemplating centering the covariates in my Cox model to reduce multicollinearity between the predictors and the interaction term and to render a more meaningful interpretation of the regression coefficient. Suppose I have two indicator variables, x1 and x2 which represent age

[R] impcat='tree'

2009-03-06 Thread Laura Bonnett
Dear All, I am going through a worked example provided by Harrell, Lee and Mark (1996, Stats in Medicine, 15, 361-387). I know that the code provided is for S-PLUS and R but the languages don't differ enough for this to be a problem. I am using the Hmisc and Design libraries and have used the

Re: [R] Dose Profile

2008-10-29 Thread Laura Bonnett
at 8:46 AM, Jim Lemon [EMAIL PROTECTED] wrote: Laura Bonnett wrote: Hi Everyone, I have data in a long format e.g. there is one row per patient but each follow-up appointment is included in the row. So, a snippet of the data looks like this: TrialNo Drug Sex Rand Adate1 Date1 Dose1

[R] Dose Profile

2008-10-28 Thread Laura Bonnett
Hi Everyone, I have data in a long format e.g. there is one row per patient but each follow-up appointment is included in the row. So, a snippet of the data looks like this: TrialNo Drug Sex Rand Adate1 Date1 Dose1 Time1 Adate2 Date2 Dose2 Time2 B1001029 LTG M 15719 30/04/2003 15825 150

[R] na.pass

2008-10-13 Thread Laura Bonnett
Hi All, I have a data frame which has columns comprised mainly of NAs. I know there are functions na.pass and na.omit etc which can be used in these situations however I can't them to work in this case. I have a function which returns the data according to some rule i.e. removal of N in this

Re: [R] na.pass

2008-10-13 Thread Laura Bonnett
TRUE TRUE FALSE [19] TRUE FALSE x[(!is.na(x)) (x != N)] [1] A A B B B B A A B A On Mon, Oct 13, 2008 at 7:15 AM, Laura Bonnett [EMAIL PROTECTED] wrote: Hi All, I have a data frame which has columns comprised mainly of NAs. I know there are functions na.pass and na.omit etc

[R] Hazard plot

2008-09-29 Thread Laura Bonnett
Hi All, This sounds a relatively simple query, and I hope it is! I am looking at a continuous variable, age. I am looking at time to 12-month remission and can calculate the HR and 95% confidence interval are follows: coxfita = coxph(Surv(rem.Remtime,rem.Rcens)~nearma$all.age,data=nearma)

Re: [R] Generalising to n-dimensions

2008-09-26 Thread Laura Bonnett
Sorry to hassle you, but I really need to get my code up and running. Please can you therefore explain what a and v are? Thank you, Laura On Wed, Sep 24, 2008 at 8:27 PM, Laura Bonnett [EMAIL PROTECTED]wrote: Can I ask what a and v are? Thanks, Laura On Sat, Aug 23, 2008 at 11:41 AM

Re: [R] Generalising to n-dimensions

2008-09-24 Thread Laura Bonnett
Can I ask what a and v are? Thanks, Laura On Sat, Aug 23, 2008 at 11:41 AM, Robin Hankin [EMAIL PROTECTED] wrote: Laura Bonnett wrote: crosstable[,,expand[d,1],expand[d,2],expand[d,3],...expand[d,n]] crosstable is just a crosstabulation of an n+2-dimensional dataset and I am trying

[R] Generalising to n-dimensions

2008-09-23 Thread Laura Bonnett
Hi R-helpers, I have two queries relating to generalising to n dimensions: What I want to do in the first one is generalise the following statement: expand-expand.grid(1:x[1],1:x[2],...1:x[n]) where x is a vector of integers and expand.grid gives every combination of the set of numbers, so for

Re: [R] Generalising to n-dimensions

2008-09-23 Thread Laura Bonnett
the order is 2,1. Could you post a small self-contained example? HTH rksh Laura Bonnett wrote: Hi R-helpers, I have two queries relating to generalising to n dimensions: What I want to do in the first one is generalise the following statement: expand-expand.grid(1:x[1],1:x[2],...1:x[n

Re: [R] Variance-covariance matrix

2008-08-27 Thread Laura Bonnett
way to produce the required covariance? Thank you, Laura On Tue, Aug 26, 2008 at 11:37 AM, Laura Bonnett [EMAIL PROTECTED]wrote: The standard treatment is the same in both comparison. How do you do a three-level treatment factor? I thought you had to have a censoring indicator which took

Re: [R] Variance-covariance matrix

2008-08-27 Thread Laura Bonnett
On Wed, Aug 27, 2008 at 10:36 AM, Peter Dalgaard [EMAIL PROTECTED]wrote: Laura Bonnett wrote: Hi all, Sorry to ask again but I'm still not sure how to get the full variance-covariance matrix. Peter suggested a three-level treatment factor. However, I thought that the censoring variable

[R] Variance-covariance matrix

2008-08-26 Thread Laura Bonnett
Dear R help forum, I am using the function 'coxph' to obtain hazard ratios for the comparison of a standard treatment to new treatments. This is easily obtained by fitting the relevant model and then calling exp(coef(fit1)) say. I now want to obtain the hazard ratio for the comparison of two

Re: [R] Variance-covariance matrix

2008-08-26 Thread Laura Bonnett
The standard treatment is the same in both comparison. How do you do a three-level treatment factor? I thought you had to have a censoring indicator which took values 0 or 1 not 1, 2 or 3? Thanks, Laura On Tue, Aug 26, 2008 at 11:05 AM, Peter Dalgaard [EMAIL PROTECTED]wrote: Laura Bonnett

[R] Variance-covariance matrix for parameter estimates

2008-08-06 Thread Laura Bonnett
Dear All, I am currently working with the coxph function within the package survival. I have the model h_ij = h_0(t) exp( b1x1 + b 2x2) where the indicator variables are as follows: x1 x2 VPS 0 0 LTG 1 0 TPM 0 1 [[alternative HTML version deleted]]

[R] Variance-covariance matrix for parameter estimates

2008-08-06 Thread Laura Bonnett
(Sorry, my last email appeared to be missing the important bits so I'll try again!) Dear All, I am currently working with the coxph function within the package survival. I have the model h_ij = h_0(t) exp( b1x1 + b 2x2) where the indicator variables are as follows: x1 x2 A00 B

[R] If statements for vectors

2008-04-09 Thread Laura Bonnett
Dear Sirs, I am using both the Bioconductor adds on (Affy, AffyPLM,...) and the 'standard' R-package. I am trying to select a list of genes which all have expression values below a certain threshold. I have done this by creating a vector which has 0s where the expression is greater than the