parnames                package:bbmle                R Documentation

_g_e_t _a_n_d _s_e_t _p_a_r_a_m_e_t_e_r _n_a_m_e_s

_D_e_s_c_r_i_p_t_i_o_n:

     Gets and sets the "parnames" attribute on a negative
     log-likelihood function

_U_s_a_g_e:

     parnames(obj)
     parnames(obj) <- value

_A_r_g_u_m_e_n_t_s:

     obj: a negative log-likelihood function

   value: a character vector of parameter names

_D_e_t_a_i_l_s:

     The 'parnames' attribute is used by 'mle2()' when the negative
     log-likelihood function takes a parameter vector, rather than a
     list of parameters; this allows users to use the same objective
     function for 'optim()' and 'mle2()'

_V_a_l_u_e:

     Returns the 'parnames' attribute (a character vector of parameter
     names) or sets it.

_A_u_t_h_o_r(_s):

     Ben Bolker

_E_x_a_m_p_l_e_s:

     x <- 1:5
     set.seed(1001)
     y <- rbinom(5,prob=x/(1+x),size=10)
     mfun <- function(p) {
       a <- p[1]
       b <- p[2]
       -sum(dbinom(y,prob=a*x/(b+x),size=10,log=TRUE))
     }
     optim(fn=mfun,par=c(1,1))
     parnames(mfun) <- c("a","b")
     mle2(minuslogl=mfun,start=c(a=1,b=1),method="Nelder-Mead")

