Re: [R] MLE for two random variables

From: Spencer Graves <>
Date: Sun 13 Mar 2005 - 06:13:18 EST

    Just to make sure, do you have any information on events when xu > u, i.e. do you know how many such events and you know u for those events? If yes, then that's called "censoring", not truncating. For that, the survival package seems pretty good. I found the information in Venables and Ripley, Modern Applied Statistics with S, helpful.

      If you don't have data when xu > u, do you know u or must that be estimated also? In either case, I would likely use "optim", though "nlm" might work also. If I knew u and didn't have to estimate it, then I might combine the data as follows:

XU <- data.frame(x=c(x,xu),

     u=c(rep(0, length(x)), rep(u, length(xu))))

      If I needed to estimate u, I'd modify this as follows:

XU. <- data.frame(x=c(x,xu),

     u=c(rep(0, length(x)), rep(1, length(xu))))

      Then I'd write a function to compute, e.g, dev = (-2)*log(likelihood) and use optim or nlm to minimize this. If I had to estimate u, I might actually try to estimate ln.up = log(u-max(xu)); I may or may not get better numerical convergence using this than trying to estimate u directly.

      hope this helps. 
      spencer graves     

Carsten Steinhoff wrote:

>I've the following setting:
>(1) Data from a source without truncation (x)
>(2) Data from an other source with left-truncation at threshold u (xu)
>I have to fit a model on these these two sources, thereby I assume that both
>are "drawn" from the same distribution (eg lognormal). In a MLE I would sum
>the densities and maximize. The R-Function could be:
>So I tried to use the function FITDISTR for the MLE. But unfortunately it
>only accepts ONE random variable.
>Then I tried to combine x and xu in a vector, but that doesn't work, too,
>because the length of x and xu differs.
>Does anybody has a solution for my problem?
>Thanks in advance.
> mailing list
>PLEASE do read the posting guide!
> mailing list PLEASE do read the posting guide! Received on Mon Mar 14 10:34:04 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:30:47 EST