https://github.com/cran/bbmle
Raw File
Tip revision: 95d37841ff40f3df3329e27a70493aca020ae8bc authored by Ben Bolker on 21 November 2013, 06:48:23 UTC
version 1.0.15
Tip revision: 95d3784
order.Rout.save

R Under development (unstable) (2012-07-27 r60013) -- "Unsuffered Consequences"
Copyright (C) 2012 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: i686-pc-linux-gnu (32-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> set.seed(1001)
> x <- runif(10)
> y <- 1000+x+rnorm(10,sd=0.1)
> d <- data.frame(x,y)
> 
> library(bbmle)
> ## warning
> m1 = mle2(y~dnorm(a+b*x,sd=exp(s)),start=list(a=900,b=1,s=log(0.1)),
+   control=list(parscale=c(1000,1,0.1)),data=d)
Warning message:
In fix_order(call$control$parscale, "parscale") :
  parscale not named: rearranging to match 'start'
> 
> m2 = mle2(y~dnorm(a+b*x,sd=exp(s)),start=list(a=900,b=1,s=log(0.1)),
+   control=list(parscale=c(b=1,a=1000,s=0.1)),data=d)
> 
> m3 = mle2(y~dnorm(a+b*x,sd=exp(s)),start=list(a=1,b=1,s=log(0.1)),
+   method="L-BFGS-B",lower=c(a=1100,b=2,s=-Inf),data=d)
Warning message:
In mle2(y ~ dnorm(a + b * x, sd = exp(s)), start = list(a = 1, b = 1,  :
  some parameters are on the boundary: variance-covariance calculations based on Hessian may be unreliable
> 
> ## warning
> m4 = mle2(y~dnorm(a+b*x,sd=exp(s)),start=list(b=1,a=1200,s=log(0.1)),
+   method="L-BFGS-B",lower=c(2,1100,0.1),data=d)
Warning messages:
1: In fix_order(call$lower, "lower bounds", -Inf) :
  lower bounds not named: rearranging to match 'start'
2: In mle2(y ~ dnorm(a + b * x, sd = exp(s)), start = list(b = 1, a = 1200,  :
  some parameters are on the boundary: variance-covariance calculations based on Hessian may be unreliable
> 
> c1 = coef(m3)[c("a","b","s")]
> c2 = coef(m4)[c("a","b","s")]
> if (!all(abs(c1-c2)<1e-7)) stop("mismatch")
> 
> proc.time()
   user  system elapsed 
  1.012   1.024   1.896 
back to top