https://github.com/cran/bbmle
Raw File
Tip revision: 0877514d5b6d663f593fdd6d43310db0c48a650e authored by Ben Bolker on 14 September 2011, 15:14:32 UTC
version 1.0.3
Tip revision: 0877514
order.Rout.save

R version 2.13.1 (2011-07-08)
Copyright (C) 2011 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: i486-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)
Loading required package: stats4
Loading required package: numDeriv
Loading required package: lattice
Loading required package: MASS
> ## 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 
  0.808   0.336   1.150 
back to top