[R] Variance-covariance matrix

Peter Dalgaard P.Dalgaard at biostat.ku.dk
Tue Aug 26 12:05:46 CEST 2008


Laura Bonnett wrote:
> 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 non-standard
> treatments.
> >From a statistical point of view, this can be achieved by dividing the
> exponentiated coefficients of 2 comparisions. E.g. to compared new treatment
> 1 (nt1) to new treatment 2 (nt2) we can fit 2 models:
> fit1 = standard treatment vs nt1
> fit2 = standard treatment vs nt2.
> The required hazard ratio is therefore exp(coef(fit1))/exp(coef(fit2))
>
> In order to obtain an associated confidence interval for this I require the
> covariance of this comparison.  I know that R gives the variance-covariance
> matrix by the command 'fit$var'.  However, this only gives the covariance
> matrix for non standard drugs and not the full covariance matrix.
>
> Can anyone tell me how to obtain the full covariance matrix?
>
>   
What kind of data do you have? Is the "standard treatment group" the
same in both comparisons?  If so, why not just have a three-level
treatment factor and compare nt1 to nt2 directly. If the control groups
are completely separate, then the covariance between fits made on
independent data is of course zero.

> Thank you,
>
> Laura
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at 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.
>   


-- 
   O__  ---- Peter Dalgaard             Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark      Ph:  (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)              FAX: (+45) 35327907



More information about the R-help mailing list