I am running a GAM model through the mgcv package with family = cox.ph()
and have my data grouped by strata (strata = id
). The data corresponds to one use location for an individual animal and 20 random locations associated with that individual that were available for use.
require(mgcv)
require(survival)
require(smoothHR)
gam1 = gam(time1~s(DWL)+strata(id),family=cox.ph(),method = "REML",data=dataset, weight = event1)
The model is running smoothly but I am unsure how to plot relationships to x-variable. DWL
is a continuous variable. I have used the following to graph predictions:
x = seq(0,120) #extent of DWL values
plot(gam1,residuals=T,trans=function(x)exp(x)/(1+exp(x)),shade=T)
I am a bit confused about the use of the trans
argument in the plot syntax. Using the cox.ph()
for your family agrument, Is the logit-link
the proper way to evaluate your predicted y-response to the x variable DWL
?
Thank you,
P Farrell