I think the following pdf will explain the details of how to use the
optim function.
http://www.unc.edu/~monogan/computing/r/MLE_in_R.pdf
Hope that helps,
Sam
On Fri, Sep 2, 2011 at 7:06 AM, Thiem Alrik <thiem at sipo.gess.ethz.ch>
wrote:> Dear mailing list,
>
> I would like to use the optim() command in order to maximize the logged
likelihood of the following function, where p is the parameter of interest and
should be constrained between 0 and positive infinity.
>
> y = ?1/2 * ((te - x)/(te - tc))^p
>
> x and y are given by
>
> x <- c(5.18, 6.28, 7.00, 7.08, 7.54, 7.90, 8.24, 8.64, 12.17, 12.89,
14.27, 15.38, 15.80, 16.46, 20.41, 21.27, 22.91)
> y <- c(0.63, 0.64, 0.66, 0.68, 0.69, 0.71, 0.73, 0.75, 0.76, 0.78, 0.8,
0.81, 0.83, 0.85, 0.86, 0.88, 0.9)
>
> te and tc are fixed at 5 and 25.
>
> What is a good way to achieve this? Thanks a lot.
>
> Alrik Thiem
> Department of Humanities, Social and Political Sciences
> ETH Zurich
>
> ? ? ? ?[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>