[R] MLE for two random variables

Spencer Graves spencer.graves at pdf.com
Sat Mar 12 20:13:18 CET 2005

    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.
>R-help at stat.math.ethz.ch mailing list
>PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

More information about the R-help mailing list