[R] Running the optimization on the subset of parameters

Roger D. Peng rpeng at jhsph.edu
Sat Jul 17 19:59:30 CEST 2004


If you use the mle() function in the `stats4' package, you don't
have to do anything special.  For example,

 > negloglik <- function(a, b) { a^2 + b^2 }
 > mle(negloglik, start = list(a = 2), fixed = list(b = 4))

Call:
mle(minuslogl = negloglik, start = list(a = 2), fixed = list(b = 4))

Coefficients:
            a            b
2.202682e-13 4.000000e+00
 > mle(negloglik, start = list(b = 2), fixed = list(a = 4))

Call:
mle(minuslogl = negloglik, start = list(b = 2), fixed = list(a = 4))

Coefficients:
            a            b
4.000000e+00 2.202682e-13
 >

-roger

Victoria Landsman wrote:

> Dear all, I'd like to find a minimum of (-loglik) function
> which is a function of k parameters. I'd like to run the
> minimization algorithm for the different subsets of the
> parameters and assign the fixed values to the complementary
> subset. How should I define my (-loglik) function such that it
> can be passed to the optim or other optimization function?
> 
> Much thanks for any suggestions. Vicky Landsman. [[alternative
> HTML version deleted]]
> 
> ______________________________________________ 
> R-help at stat.math.ethz.ch mailing list 
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE
> do read the posting guide!
> http://www.R-project.org/posting-guide.html
>




More information about the R-help mailing list