On Mon, Nov 22, 1999 at 08:50:31PM +0100, Agustin Lobo
wrote:>
> I would like to fit a model of the type
>
> Y = Xf + e
>
> where f are cover fractions (or percent cover). Therefore,
> I must constrain the fit to
> 1. sum(f) = 1
> 2. 0<= f <=1
>
>
> How can I introduce these 2 constraints in a ML fit?
Since R doesn't have 'constrained optimization' (yet) what I have
tipically
done with similar problems is 'proper' re-parametrization, e.g.,
f1 = exp(g1)/s f2=exp(g2)/s f3=1/s with s=1+exp(g1)+exp(g2) then
likelihood is maximized in (g1,g2). Of course, if you want
asymptotic standard errors, you have to transform the Fisher matrix
for (g1,g2) to the one of (f1,f2) using the jacobian of the transformation.
Anyway, if possible, I will try to use a profile likelihood approach.
>
> Currently, I'm using nlregb and I'm using the "upper and
> low" keywords to set the bounds and
> use the following to ensure that sum(f) = 1:
>
> let's say I have 3 fractions, then f3=1-f1-f2 and
>
> Y = f1*X1 + f2*X2 +(1-f1-f2)*X3
> Y - X3 = f1(X1-X3) + f2*(x2-X3)
>
> so I minimize (considering Z <- X[,1:2] - X[,3])
>
> Y- X3 - Z%*%F
In R, no constrained..., this is an improper re-parametrization
since you don't have any assurances that the f[i]>0 restriction
is satisfied.
>
> The problem is that I get very odd f, which
> are very dependent on what f I choose to be
> the one to be calculated by difference (the f3 above).
>
This can be a problem of the algorithm but also of the data,
or better, of your model with your data.
Hence, if you really have only three f's, I suppose that a
graphical study of the likelihood can be usefull.
guido
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at
stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._