search for: mle2

Displaying 20 results from an estimated 65 matches for "mle2".

Did you mean: mle
2009 Feb 01
2
Extracting Coefficients and Such from mle2 Output
The mle2 function (bbmle library) gives an example something like the following in its help page. How do I access the coefficients, standard errors, etc in the summary of "a"? > x <- 0:10 > y <- c(26, 17, 13, 12, 20, 5, 9, 8, 5, 4, 8) > LL <- function(ymax=15, xhalf=6) + -sum...
2010 Mar 24
0
optimize a joint lieklihood with mle2
Hi I'm trying to maximize a joint likelihood of 2 likelihoods (Likelihood 1 and Likelihood 2) in mle2, where the parameters I estimate in Likelihood 2 go into the likelihood 1. In Likelihood 1 I estimate the vector logN with length 37, and for the Likelihood 2 I measure a vector s of length 8. The values of s in Lieklihood 2 are used in the Likelihood 1. I have 2 questions: ##1 I manage to writ...
2012 Jan 12
2
Function accepted by optim but not mle2 (?)
Dear Sir/ Madam, I'm having trouble de-bugging the following - which works perfectly well with optim or optimx - but not with mle2. I'd be really grateful if someone could show me what is wrong. Many thanks in advance. JSC: gompertz<- function (x,t=data) { a3<-x[1] b3<-x[2] shift<-data[1] h.t<-a3*exp(b3*(t-shift)) S.t<-exp(a3/b3*(1-exp(b3*(t-shift)))) PF<-1-(ex...
2011 Aug 29
1
Bayesian functions for mle2 object
Hi everybody, I'm interested in evaluating the effect of a continuous variable on the mean and/or the variance of my response variable. I have built functions expliciting these and used the 'mle2' function to estimate the coefficients, as follows: func.1 <- function(m=62.9, c0=8.84, c1=-1.6) { s <- c0+c1*(x) -sum(dnorm(y, mean=m, sd=s,log=T)) } m1 <- mle2(func.1, method="SANN") However, the estimation of the effect of x on the variance of y usually has dealt s...
2011 Oct 17
1
simultaneously maximizing two independent log likelihood functions using mle2
Hello, I have a log likelihood function that I was able to optimize using mle2. I have two years of the data used to fit the function and I would like to fit both years simultaneously to test if the model parameter estimates differ between years, using likelihood ratio tests and AIC. Can anyone give advice on how to do this? My likelihood functions are long so I'll...
2010 Feb 12
1
using mle2 for multinomial model optimization
...ot;x",l-1),"N") #names for the initial vector nrs<-c(1:(l-1),1) #nrs for the initial vector svec = log(c) #transformation of the data to avoid constraints (x>0) names(svec) <- paste(nvec,nrs,sep="") parnames(mfun) <- names(svec) m1 = mle2(mfun,start=svec, vecpar=TRUE,fixed=svec[1:(l-1)]) #only estimate "N-x1-x2-x3",everything else is fixed coef(m1) ############################################################################ The function "mfun" is working, however the mle2 won't work. How can I fi...
2010 Feb 01
1
Help with multiple poisson regression with MLE2
Hi, I'm trying to make multiple poisson regressions with the MLE2 command. I have used the following expression, but I receive an error message: poisfit <- mle2(y ~ dpois(exp(b0 + b1*x1 + b2*x2)), start=list(b0=1, b1=1, b2=1), data=data1) Error in optim(par = c(1, 1, 1), fn = function (p) : non-finite initial value 'vmmin' I have changed initial v...
2008 Nov 19
1
mle2 simple question - sigma?
...dels and Data in R, p302). With this code: #Basic example regression library(bbmle) RegData<-data.frame(c(0.3,0.9,0.6),c(1.7,1.1,1.5)) names(RegData)<-c("x", "y") linregfun = function(a,b,sigma) { Y.pred = a+b*x -sum(dnorm(y,mean=Y.pred,sd=sigma,log=TRUE)) } SigA<-mle2(linregfun, start=list(a=0.5, b=2), data=RegData) #Or SigB<-mle2(y~dnorm(mean=a+b*x,sd=sigma),start=list(a=0.5, b=2), data=RegData) I get: #Messages #SigA>>Error in dnorm(y, mean = Y.pred, sd = sigma, log = TRUE) : # element 3 is empty; # the part of the args list of '.Internal'...
2012 Apr 18
1
error estimating parameters with mle2
Hi all, When I try to estimate the functional response of the Rogers type I equation (for the mle2 you need the package bbmle): > RogersIbinom <- function(N0,attackR2_B,u_B) {attackR2_B+u_B*N0} > RogersI_B <- mle2(FR~dbinom(size=N0,prob=RogersIbinom(N0,attackR2_B,u_B)/N0),start=list(attackR2_B=4.5,u_B=0.16),method="Nelder-Mead",data=data5) I get following error message...
2008 Sep 19
0
panel data analysis possible with mle2 (bbmle)?
Dear R community, I want to estimate coefficients in a (non-linear) system of equations using 'mle2' from the "bbmle" package. Right now the whole data is read in as just one long time series, when it's actually 9 cross sections with 30 observations each. I would like to be able to test and correct for autocorrelation but haven't found a way to do this in this package. On t...
2012 Apr 19
1
non-numeric argument in mle2
Hi all, I have some problems with the mle2 function > RogersIIbinom <- function(N0,attackR3_B,Th3_B) {N0-lambertW(attackR3_B*Th3_B*N0*exp(-attackR3_B*(24-Th3_B*N0)))/(attackR3_B*Th3_B)} > RogersII_B <- mle2(FR~dbinom(size=N0,prob=RogersIIbinom(N0,attackR3_B,Th3_B)/N0),start=list(attackR3_B=1.5,Th3_B=0.04),method="Nelder...
2012 Sep 27
0
problems with mle2 convergence and with writing gradient function
Dear R help, I am trying solve an MLE convergence problem: I would like to estimate four parameters, p1, p2, mu1, mu2, which relate to the probabilities, P1, P2, P3, of a multinomial (trinomial) distribution. I am using the mle2() function and feeding it a time series dataset composed of four columns: time point, number of successes in category 1, number of successes in category 2, and number of success in category 3. The column headers are: t, n1, n2, and n3. The mle2() function converges occasionally, and I need to...
2008 Jul 21
1
Control parameter of the optim( ): parscale
Hi everybody, I am using the L-BFGS-B method of the mle2() function to estimate the values of 6 parameters. mle2 uses the methods implemented in optim. As I got it from the descriptions available online, one can use the parscale parameter to tell R somehow what the values of the estimated parameters should be . . . Could somebody please help me understa...
2008 Jul 23
1
mle2(): logarithm of negative pdfs
Hi, In order to use the mle2-function, one has to define the likelihood function itself. As we know, the likelihood function is a sum of the logarithm of probability density functions (pdf). I have implemented myself the pdfs that I am using. My problem is, that the pdfs values are negative and I cann't take the logarithm...
2012 Oct 05
2
problem with convergence in mle2/optim function
Hello R Help, I am trying solve an MLE convergence problem: I would like to estimate four parameters, p1, p2, mu1, mu2, which relate to the probabilities, P1, P2, P3, of a multinomial (trinomial) distribution. I am using the mle2() function and feeding it a time series dataset composed of four columns: time point, number of successes in category 1, number of successes in category 2, and number of success in category 3. The column headers are: t, n1, n2, and n3. The mle2() function converges occasionally, and I need to...
2012 Feb 01
3
Probit regression with limited parameter space
Dear R helpers, I need to estimate a probit model with box constraints placed on several of the model parameters. I have the following two questions: 1) How are the standard errors calclulated in glm (family=binomial(link="probit")? I ran a typical probit model using the glm probit link and the nlminb function with my own coding of the loglikehood, separately. As nlminb does not
2008 Sep 10
1
using function instead of formula in plm
Hi all, I am trying to use plm to estimate coefficients in a model consisting of a system of equations. So far I used mle2 from the package "bbmle", but now I need to test for autocorrelation and mle2 does not provide for the necessary tests. mle2 needs a function as input that might as well consist of many different equations. plm however requires an object of class formula that needs to be included in the p...
2012 Jul 30
1
confusion over S3/S4 importing
...method: stats4:::profile standardGeneric for "profile" defined from package "stats" function (fitted, ...) standardGeneric("profile") <environment: 0xa59a364> In the bbmle package I want to define it as an S4 method: setMethod("profile", "mle2", function (...) {...}) In the NAMESPACE file for bbmle I have importFrom(stats4,profile) However, in R 2.14.2 (which is I am currently trying to fix: I would like to try to allow for backward compatibility), I get library(bbmle) example(mle2) ## to create some fitted objects profile(...
2009 Aug 31
2
interactions and stall or memory shortage
...ode that worked for a single pair of interactions, when I try to evaluate two pairs of interactions( flowers*gopher, flowers*rockiness) my computer runs out of memory, and the larger desktop I use just doesn't go anywhere after about 20 minutes. Is it really that big a calculation? to start: mle2(minuslogl = Lily_sum$seedlings ~ dnbinom(mu = a, size = k), start = list(a = 10, k = 1)) then: i2<-interaction(Lily_sum$flowers, Lily_sum$gopher) i3<-interaction(Lily_sum$flowers, Lily_sum$rockiness) mle2(Lily_sum$seedlings ~ dnbinom(mu = a, size = k), start=list(a=10,k=1) ,parameters=list...
2012 Jul 11
0
declaring negative log likelihood of a distribution
...n 0:imax) { term=term+(((-1)**i)*(choose(b-1,i))*(beta(x+a+a*i,n-x+1))) } dens=a*b*choose(n,x)*term KBLL2<-sum(fre*log(dens)) return(-KBLL2) } * #Now to estimate the parameters, I used http://rgm2.lab.nig.ac.jp/RGM2/func.php?rd_id=bbmle:mle2 mle2(from the package bbmle) , which is a wrapper around the optim function *>estimates1=mle2(Loglik.newdis1, start=list(a=1,b=1), data=list(x=values,fre=frequency, n=7, imax=2000)) * Error in optim(par = c(1, 1), fn = function (p) : non-finite finite-difference value [1] In addition: The...