Skip to content
Back to formatted view

Raw Message

Message-ID: <99c1d5e7-dbd2-f223-de24-f97cdbd12765@gmail.com>
Date: 2020-03-06T10:05:05Z
From: Marco Gabrielli
Subject: Error with stepwise models selection using NADA library

Hi,
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 at 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