Standardized residuals of a Tobit model in R

Does anybody know why it is not possible to compute standardized residuals when estimating a Tobit model?

Here is a short example of what I am talking about:

> require(AER)   # for tobit estimation commands
> require(MASS)  # for computing standardized residuals
> numberofdrugs <- rpois(84, 5)+1
> healthvalue <- rpois(84,5)
> tob <- tobit(healthvalue ~ numberofdrugs)
> residuals(tob) # works fine
> stdres(tob)    # doesn't work fine


Where is the problem?

-

The problem is in assuming that stdres() will work for a tobit regression. The reason resid() works for tob is that the type of object returned by tobit() inherits from class "survreg":

R> class(tob)
[1] "tobit"   "survreg"


and there is a special residuals() method for objects of that class:

R> methods(residuals)
[1] residuals.breakpointsfull* residuals.coxph*
[3] residuals.coxph.null*      residuals.coxph.penal*
[5] residuals.default          residuals.glm
[7] residuals.HoltWinters*     residuals.isoreg*
[9] residuals.lm               residuals.loglm*
[11] residuals.nls*             residuals.smooth.spline*
[13] residuals.survreg*         residuals.survreg.penal*
[15] residuals.tukeyline*

Non-visible functions are asterisked


("survreg" is there as number 13.)

stdres() is (or at least appears to me to be) limited to the linear model case, and one could argue that a tobit model is not a linear regression. From ?stdres we have:

Arguments:

object: any object representing a linear model.


That this is the case is seen more clearly when one looks at lmwork(), the function that does the work in stdres(), which on the second line of the code for that function, lm.influence() is called, and that is where stdres() is failing (output from debugging lmwork() and calling stdres(tob):

Browse[2]> n
debug: resid <- object$residuals Browse[2]> debug: hat <- lm.influence(object, do.coef = FALSE)$hat
Browse[2]>
Error in if (model\$rank == 0) { : argument is of length zero


I'm not familiar with survival models nor tobit regression. Read ?residuals.survreg and see if that is doing the right thing regarding standardising the residuals (there is something in there about using sigma). otherwise you might have to cook this yourself or contact the author of the survival package for suggestions as to how to compute the standardised residuals that you want.

-