[R] Creating NA equivalent

Viechtbauer, Wolfgang (SP) wo||g@ng@v|echtb@uer @end|ng |rom m@@@tr|chtun|ver@|ty@n|
Tue Dec 21 13:26:40 CET 2021


Say 'yi' is left censored. Then:

# naive regression model
res1 <- lm(yi ~ xi, data=dat)

# tobit model via survreg()
res2a <- survreg(Surv(yi, yi > censval, type="left") ~ xi, dist="gaussian", data=dat)

# tobit model via tobit() from AER package
res2b <- tobit(yi ~ xi, left=censval, data=dat)

# tobit model via censReg() from censReg package
res2c <- censReg(yi ~ xi, left=censval, data=dat)

(forgot to mention the AER package; and I assume there are even other packages that can fit Tobit models).

One can also have censoring on both sides in Tobit models. Just explore these packages to see what they can do.

Best,
Wolfgang

>-----Original Message-----
>From: Chris Evans [mailto:chrishold using psyctc.org]
>Sent: Tuesday, 21 December, 2021 12:56
>To: Viechtbauer, Wolfgang (SP)
>Cc: r-help using r-project.org
>Subject: Re: Creating NA equivalent
>
>Many thanks Wolfgang,
>
>I guess I can see that survival analyses don't have to be time based but
>clearly I need to read up on that.  I can't see an example in the survival
>package.  And it proves to be hard to search for one. Can anyone point me
>to useful resources on that, in {survival} or not?
>
>I am probably straying way off topic and  off list guide here but isn't a
>Tobit only handling censoring at one edge, i.e. the LDL scenario, or the UDL,
>but not both?  I think this may be getting back to Marc's original question
>and certainly, again, I would love to be pointed to either Tobit handling
>LDL _and_ UDL or to any other existing methods.
>
>TIA,
>
>Chris
>
>----- Original Message -----
>> From: "Wolfgang Viechtbauer" <wolfgang.viechtbauer using maastrichtuniversity.nl>
>> To: "Chris Evans" <chrishold using psyctc.org>
>> Cc: r-help using r-project.org
>> Sent: Tuesday, 21 December, 2021 11:31:55
>> Subject: RE: Creating NA equivalent
>
>> Hi Chris,
>>
>> The survival package provides machinery for handling censored observations.
>> Whether time is censored or some other type of variable (e.g., viral load due
>> to some lower detection limit) does not make a fundamental difference. In fact,
>> the type of model you are thinking of with 2) is a Tobit model, which can be
>> fitted using the survival package (or censReg).
>>
>> Best,
>> Wolfgang
>>
>>>-----Original Message-----
>>>From: R-help [mailto:r-help-bounces using r-project.org] On Behalf Of Chris Evans
>>>Sent: Tuesday, 21 December, 2021 12:17
>>>To: Duncan Murdoch
>>>Cc: r-help using r-project.org
>>>Subject: Re: [R] Creating NA equivalent
>>>
>>> I am neither a programmer nor a professional statistician but this topic
>>> interests me because:
>>>
>>> 1) I remember from long, long ago that S had a way to create labels that could
>>>    denote multiple ways in which a value could be missing that was sometimes
>>>    useful to me as my field sometimes has such situations.  In R I handle this
>>>    with a second variable but I can see that using attributes is cleaner and
>>>    might have real benefits when doing missing value analyses.  That might
>>>    raise questions about whether some of the nice packages that help with
>>>    missing value analyses would take on board some standardised use of
>>>    attributes for this.
>>>
>>> 2) I think Marc's question LDL/UDL is about a very particular sort of value
>>>    that isn't missing and _is_ censored but not in survival analysis meaning
>>>    of censored. (At least, it's not the same to my mind, perhaps it is?  To me
>>>    the difference is that I most often hit the LDL/UDL issue in data that
>>>    don't have much, or any, time frame.) Again, this comes up a lot for me
>>>    whe people are given limited possible answers in questionnaires and I've
>>>    often wondered if I should explore simulating probability models for an the
>>>    "off the edge" value on a latent variable beneath/behind the measured
>>>    responses.  I'd be very grateful to hear of any work in R packages (to stay
>>>    only just "off the edge" of the posting    guide).  Or of any work a long
>>>    the lines that Duncan offers, that sort of pulls this toward    base R,
>>>    though that sounds to me as if it would be a huge undertaking.
>>>
>>> I'm very interested to hear any thoughts on either aspect.
>>>
>>> Seasonal (mutivalued) greetings to all!
>>>
>> > Chris


More information about the R-help mailing list