[R] weighted 2 or 3 parameter weibull estimation?
ripley@stats.ox.ac.uk
ripley at stats.ox.ac.uk
Sat Apr 6 14:02:40 CEST 2002
On Fri, 5 Apr 2002, Jeff D. Hamann wrote:
> Subject: Re: [R] weighted 2 or 3 parameter weibull estimation?
>
> Without knowing your cost function (i.e., that passed to optim) its hard
> to help.
>
> T.
>
>
> Here's what I used to obtain my estimates:
>
>
> # estimate the two parameter weibull
> loglike <- function(p) -2*sum(dweibull(expf,p[1],p[2],log=T))
> est <- optim( c(1,5), loglike )
>
> as I mentioned, I'm very much a newbie at using optim (and maybe less so
> with R), but I hope this help answer your question.
fitdistr in package MASS would be even easier.
I'm afraid I don't understand your weights here. I can understand integer
weights (where weight 3 means `I have three cases like this one'), where
one just uses
loglike <- function(p, wt) -2*sum(wt * dweibull(expf,p[1],p[2],log=T))
est <- optim( c(1,5), loglike, wt=wt )
But your example looks much more like a bivariate problem.
>
> Thanks,
> Jeff.
>
>
>
> > I've figured out how to use optim (barely) to estimate 2 parameter =
> > weibull distributions. I can't get over how easy this is. What I need to
> =
> > do is use a weight in the observations.....
> >
> > For example,=20
> >
> > the tree diameters and weights are are=20
> >
> > 4.70 , 100
> > 6.00, 98
> > 7.10, 75.0
> > 8.10, 86.3
> > 8.60, 80.456
> > 8.90, 20.5
> > 9.50, 16.6
> > 11.40, 12.657
> > 11.80, 12.47
> > 14.50, 8.98
> > 16.00,4.5
> > 16.90,2.36
> > 18.90, 0.256
> >
> > which yield
> >
> > LOCATION =3D 0.0000 MEAN =3D 10.9921
> > SCALE =3D 12.3436 VARIANCE =3D 18.0027
> > SHAPE =3D 2.8050 SKEWNESS =3D 0.2354
> >
> > which are the values without the weights. I can't find any reference to
> =
> > weights in the optim function and I'm afraid I'm a little stuck here. =
> > After I figure out how to include the weights, I'll then need to =
> > estimate the 3-parameter estimates. Any help would be greatful.=20
> >
> > Thanks,
> > Jeff.
>
>
>
> Jeff D. Hamann
> Hamann, Donald & Associates, Inc.
> PO Box 1421
> Corvallis, Oregon USA 97339-1421
> Bus. 541-753-7333
> Cell. 541-740-5988
> jeff_hamann at hamanndonald.com
> www.hamanndonald.com
>
>
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> 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
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
>
--
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272860 (secr)
Oxford OX1 3TG, UK Fax: +44 1865 272595
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list