[R] [UNCLASSIFIED] predict.survreg() with frailty term and newdata
joe.crombie at affa.gov.au
joe.crombie at affa.gov.au
Mon Jan 22 01:03:40 CET 2007
Dear All,
I am attempting to make predictions based on a survreg() model with some censoring and a frailty term, as below: predict works fine on the original data, but not if I specify newdata.
# a model with groups as fixed effect
model1 <- survreg(Surv(y,cens)~ x1 + x2 + groups,
dist = "gaussian")
# and with groups as a random effect
fr <- frailty(groups, dist = "gaussian", sparse = F)
model2 <- survreg(Surv(y,cens)~ x1 + x2 + fr,
dist = "gaussian")
# predict() works fine for groups as fixed effect
predict(model1, newdata = list(x1 = 1, x2 = 1, groups = groups[1]))
# [,1]
# 1 10.51833 # no problem!
# but not so well with frailty(groups)
predict(model2, newdata = list(x1 = 1, x2 = 1, fr = factor(1, levels = 1:10)))
#> Error in x %*% coef : non-conformable arguments
I have found references on the R and S-Plus lists which suggest that others have had this problem (in both packages), but I can't find any solution or further explanation. Can anyone suggest a way of getting the predictions I'm after? Any help is greatly appreciated.
Kind regards Joe
Joe Crombie
Information and Risk Sciences
Bureau of Rural Science
Canberra Australia
p: +61 2 6272 5906
e: joe.crombie at brs.gov.au <blocked::mailto:joe.crombie at brs.gov.au>
----------------------------------------------------------------------
IMPORTANT - This message has been issued by The Department of Agriculture, Fisheries and Forestry (DAFF). The information transmitted is for the use of the intended recipient only and may contain confidential and/or legally privileged material. It is your responsibility to check any attachments for viruses and defects before opening or sending them on.
Any reproduction, publication, communication, re-transmission, disclosure, dissemination or other use of the information contained in this e-mail by persons or entities other than the intended recipient is prohibited. The taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. If you have received this e-mail in error please notify the sender and delete all copies of this transmission together with any attachments. If you have received this e-mail as part of a valid mailing list and no longer want to receive a message such as this one advise the sender by return e-mail accordingly. Only e-mail correspondence which includes this footer, has been authorised by DAFF
More information about the R-help
mailing list