0
$\begingroup$

I'm working with environmental data which are left-censored and I found the R package NADA which seems to do the job.
After fitting a complete model, using the cenreg function,I'd like to do a stepwise procedure to minimize the AIC using the stepAIC function. Unfortunately, after fitting the model, the stepAIC does not work with either the cenreg object or the S3 survreg object within.

Here it is an example of the commands used:

library(NADA)
MLEtot=with(df, cenreg(Cen(Y,Cen)~x1+x2+x3+x4,dist="lognormal"))
stepAIC(MLEtot)
"Error: $ operator not defined for this S4 class"
stepAIC(MLEtot@survreg)
"Start:  AIC=6.16
asSurv(Cen(Y, Cen)) ~ x1 + x2 + x3 + x4
Error in (function (classes, fdef, mtable)  :
  unable to find an inherited method for function ‘asSurv’ for signature ‘"Surv"’"

How can I do manage to make it work? Thanks

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.