How to retrive dynamic list parameters in R from par of optim function

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

How to retrive dynamic list parameters in R from par of optim function

Niharika
This post was updated on .
Hello,
I am having some problem in retrieving the list elements

Code
Mean_of_mc is a list as described below

                mean_mc_1  mean_mc_2  mean_mc_3
mean_mc  0.9577246    2.000516      2.962521
mean_mc  7.957725     9.000516      9.962521

optim(par=c(L=2, mu=Mean_of_mc),
                 fn=xnorm,
      method = "BFGS", control=list(fnscale=-1))


xnorm= function(par)
{
  print(par)
   l=par['L']
  val=par['mu']
  print(val)
  #some logic
}
 getting NA for val,
 how can i get all the values of Mean_of_mc

PS it is dynamic list the rows and column  can grow tilll n
Thanks
Niharika

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.
Loading...