Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

model with LL diff #14

Open
eeholmes opened this issue May 9, 2023 · 0 comments
Open

model with LL diff #14

eeholmes opened this issue May 9, 2023 · 0 comments

Comments

@eeholmes
Copy link
Contributor

eeholmes commented May 9, 2023

This is lower with BFGS. Even if. Perhaps has something to do with the NAs in the data. Seems to go away wo the NAs.

library(marssTMB)
U1 <- matrix(0,2,1)
Q1 <- matrix(c("q11","q12","q12","q22"),2,2)
Z1 <- matrix(c(1,0,1,1,1,0),3,2)
A1 <- matrix(list("a1",0,0),3,1)
R1 <- matrix(list("r11",0,0,0,"r",0,0,0,"r"),3,3)
pi1 <- matrix(0,2,1); V1=diag(1,2)
model.list <- list(U=U1, Q=Q1, Z=Z1, A=A1, R=R1, x0=pi1, V0=V1, tinitx=0)
dat <- t(harborSealWA)[2:4, ] # remove the year row
fit1 <- MARSS(dat, model=model.list, method="BFGS")
fit2 <- MARSS(dat, model=model.list, method="TMB", inits=fit1)
dat <- t(harborSealWA); dat <- dat[2:4, ]
modlist = list(U="zero", A="zero", x0="zero", Q="unconstrained")
MARSS(dat[,14:22], method="TMB", silent=TRUE, model=modlist)$logLik
MARSS(dat[,14:22], silent=TRUE, model=modlist)$logLik

maxit not getting set for nlminb

a = MARSS(dat[,14:22], method="TMB", model=modlist, control=list(maxit=20000))

false convergence for nlminb but seems ok

modlist = list(U="zero", A="zero", Q="unconstrained", tinitx=1)
a = MARSS(dat[,14:22], method="TMB", model=modlist)
a = MARSS(dat[,14:22], method="BFGS_TMB", model=modlist)
a = MARSS(dat[,14:22], model=modlist)

false convergence for nlminb and no convergence at 5000+ iter for optim,

modlist = list(U="zero", A="zero", Q="unconstrained", x0="zero", tinitx=1)
a = MARSS(dat[,14:22], method="TMB", model=modlist) # reports false convergence but better LL than EM
a = MARSS(dat[,14:22], method="BFGS_TMB", model=modlist) # not remotely converged
a = MARSS(dat[,14:22], method="BFGS", model=modlist) # bad
a = MARSS(dat[,14:22], model=modlist) 
a = MARSS(dat[,14:22], method="BFGS", model=modlist, inits=a) # good same as TMB

false/no convergence but LL looks ok

modlist = list(U="zero", A="zero", Q="unconstrained")
a = MARSS(dat[,14:22], method="TMB", model=modlist)
a = MARSS(dat[,14:22], method="BFGS_TMB", model=modlist)
a = MARSS(dat[,14:22], model=modlist)

Not handling convergence messages from nlminb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant