# [R] Problems when computing the 1rst derivative of mixtures of densities

Spencer Graves spencer.graves at pdf.com
Sat Jul 8 03:35:57 CEST 2006

What problem are you trying to solve?  The mixture proportion you are
trying to estimate violates the assumptions that provide a normal
approximation to the distribution of maximum likelihood estimators.
These situations even violate the assumptions for 2*log(likelihood
ratio) being approximately chi-square.

If you want hypothesis tests or confidence intervals, Pinheiro and
Bates (2000) recommended using 2*log(likelihood ratio) modified as
suggested by Monte Carlo results.  More recently, Bates has incorporated
an 'mcmcsamp' function in the 'lme4' and 'Matrix' libraries.

The best references I know on testing a parameter at a boundary are
the following:

Pinheiro and Bates (2000) Mixed-Effects Models in S and S-PLUS
(Springer, sec. 2.4)

Crainiceanu, Ruppert and Vogelsang (2003) “Some properties of Likelihood
Ratio tests in linear mixed models”

Crainiceanu, Ruppert, Claeskens, and Wand (2005) “Exact Likelihood Ratio
Tests for Penalized Splines”, Biometrika, 92(1)

Hope this helps.
Spencer Graves

Clément Viel wrote:
> Hi everybody,
>
> I am currently working on mixtures of two densities ( f(xi,teta)=
> (1-teta)*f1(xi) + teta*f2(xi) ),
> particularly on the behavior of the variance for teta=0 (so sample only
> comes from the first distribution).
> To determine the maximum likelihood estimator I use the Newton-Rapdon
> Iteration. But when
> computing the first derivative I get a none linear function (with several
> asymptotes) which is completely
> absurd.

Why do you think this is absurd?  Nonlinear estimation can be very
difficult.

Also, have you reviewed the capabilities in R for working with
mixtures of distributions?  I just got 167 hits for
RSiteSearch("mixtures") and 49 for RSiteSearch("mixture distributions",
"functions").
>
> This is my function to compute the first derivative:
>
> phy=function(teta,vect1,vect2){
>     return( sum(( vect2 - vect1) / (( 1 - teta) * vect1 + teta * vect2)))
> }
>
> note: vect1 and vect2 contains  values of the  two distributions computed
> from sample previously extracted.
>
> Beside, vect2 - vect1 is constant and ( 1 - teta) * vect1 + teta * vect2) is
> linear and always defined so I am expecting
> a linear function for the first derivative. To my mind, it's likely comes
> from the operation of division but I don't understand
> why results are skewed.
>
> Have you got any suggestions, please?
>
>
>
> ------------------------------------------------------------------------
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help