Displaying 1 result from an estimated 1 matches for "sigmaq1".
Did you mean:
sigma1
2002 Jun 28
1
Problem in optim(method="L-BFGS-B") (PR#1717)
...e
function at the constraint seem to be returned in this case.
I've tried to reproduce the effect in a very simple example:
###############################################################################
fn <- function(par,x,y){
ind <- 1:(length(x)/2)
alpha <- par[1]
beta <- par[2]
sigmaq1 <- par[3]
sigmaq2 <- par[4]
sum((y[ind]-alpha-beta*x[ind])^2/sigmaq1+log(sigmaq1)+(y[-ind]-alpha-beta*x[-ind])^2/sigmaq2+log(sigmaq2))
}
set.seed(3)
n <- 5
x1 <- runif(n)
x2 <- runif(n)
y <- c(rnorm(x1,1+x1,1),rnorm(x2,1+x2,5))
x <- c(x1,x2)
par <- c(0,0,1,1)
z <- optim(...