Hello I am fitting a Cox PH model using the function coxph(). Does anyone know how to obtain the estimate of the covariance matrix under the null hypothesis. The function coxph.detail() does not seem to be useful for this purpose. Thanks, KD. [[alternative HTML version deleted]]
Kindly excuse a non-statistician newbie attempting to wrestle with R.
This might be a relatively easy question, but I am trying to perform nls
regression and plot the fitted function through the data superimposed on
the raw data. from reading the R-help, Rtips et al, I am only able to do
that by extracting the parameter values manually and using it to create
the plot.
Is there an easier way to do this, (I have ~60 Plots), obtain an r^2,
and also plot the x axis in the log domain (any attempts I have tried
have screwed up).
NLS script
fit<- nls(y~-emax*x^h/(ec50^h+x^h),
data= sample, start=list(emax=4,h=2,ec50=1))
summary(fit)
Thank you all for your help
Lanre Okusanya, Pharm.D.,BCPS
UB/Pfizer Pharmacometrics Fellow
University at Buffalo School of Pharmacy and Pharmaceutical Sciences
237 Cooke Hall
Buffalo, NY 14260
Email: ooo at buffalo.edu
Tel: (716)645-2828 x 275
Fax: (716)645-2886
Prof Brian Ripley
2005-Aug-26 06:32 UTC
[R] question about coxph (was covariance matrix under null)
You will need to tell us of _what_ you want the covariance matrix and what you mean by the `null hypothesis': coxph does estimation, not testing. If you want the covariance matrix of the parameter estimates, see vcov(), which has a coxph method. On Thu, 25 Aug 2005, Devarajan, Karthik wrote:> > Hello > > I am fitting a Cox PH model using the function coxph(). Does anyone know how > to obtain the estimate of the covariance matrix under the null hypothesis. > The function coxph.detail() does not seem to be useful for this purpose. > > Thanks, > KD. > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.htmlPLEASE do (no HTML mail, useful subject, please) -- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595
On Thu, 25 Aug 2005, Devarajan, Karthik wrote:> > Hello > > I am fitting a Cox PH model using the function coxph(). Does anyone know how > to obtain the estimate of the covariance matrix under the null hypothesis. > The function coxph.detail() does not seem to be useful for this purpose. >You can evaluate the second derivative of the partial loglikelihood at any specified beta with vcov(coxph(formula, data,iter=0, start, init=beta) eg if you want to get score tests. -thomas
To get nice looking plots you can use trellis plots from the lattice
package. First you need:
library(lattice)
Then you can define a custom panel function that will overlay the
fitted curve on top of the data points in a different color (you just
need to do this once; the fit you want plotted is specified as an
argument):
pred.overlay.panel <- function(x, y, fit, ...)
{
panel.grid()
panel.xyplot(x, y, ...)
form <- as.list(sys.call(-2))[[2]]$call$formula
resp <- deparse(form[[2]])
covar <- deparse(form[[3]])
xx <- seq(min(x), max(x), len=101)
newdat <- data.frame(xx)
colnames(newdat) <- covar
panel.superpose(xx, predict(fit, newdata=newdat),
subscripts=1:length(xx), groups=factor(rep(2, length(xx)),
levels=1:2), type="l", ...)
}
Finally, you use the custom panel function in a call to xyplot:
xyplot(y ~ x, data=sample, panel=pred.overlay.panel, fit=fit,
scales=list(x=list(log=TRUE)))
Note how you specify that you want the x-axis to be in log-scale with
the scales parameter.
Hope this helps.
Ben
On 8/26/05, Lanre Okusanya <ooo at buffalo.edu>
wrote:> Kindly excuse a non-statistician newbie attempting to wrestle with R.
>
> This might be a relatively easy question, but I am trying to perform nls
> regression and plot the fitted function through the data superimposed on
> the raw data. from reading the R-help, Rtips et al, I am only able to do
> that by extracting the parameter values manually and using it to create
> the plot.
>
> Is there an easier way to do this, (I have ~60 Plots), obtain an r^2,
> and also plot the x axis in the log domain (any attempts I have tried
> have screwed up).
>
> NLS script
>
> fit<- nls(y~-emax*x^h/(ec50^h+x^h),
> data= sample, start=list(emax=4,h=2,ec50=1))
>
> summary(fit)
>
> Thank you all for your help
>
> Lanre Okusanya, Pharm.D.,BCPS
> UB/Pfizer Pharmacometrics Fellow
> University at Buffalo School of Pharmacy and Pharmaceutical Sciences
> 237 Cooke Hall
> Buffalo, NY 14260
> Email: ooo at buffalo.edu
> Tel: (716)645-2828 x 275
> Fax: (716)645-2886
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html
>