Skip to content

Commit

Permalink
fix bug in parameter estimate table
Browse files Browse the repository at this point in the history
  • Loading branch information
timjmiller committed Feb 9, 2023
1 parent 9d802c3 commit 31ea94b
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
14 changes: 7 additions & 7 deletions R/par_tables_fn.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ par_tables_fn = function(mod, do.tex=FALSE, do.html=FALSE, od)
}
if(type == "expit") { #Delta-method: V(lo + (hi-lo)/(1 + exp(-x))) ~ ((hi-lo) * p * (1-p))^2 * V(x)
p = 1/(1 + exp(- k * par))
dm.se = k * abs(hi-lo)*p*(1-p)*se
return(c(dm.se, lo + (hi-lo)/(1+ exp(-ci))))
dm.se = abs(k) * abs(hi-lo)*p*(1-p)*se
return(c(dm.se, lo + (hi-lo)/(1+ exp(-k * ci))))
}
}
data = mod$env$data
Expand Down Expand Up @@ -161,7 +161,7 @@ par_tables_fn = function(mod, do.tex=FALSE, do.html=FALSE, od)
fe.vals = c(fe.vals, exp(pars$log_NAA_sigma[1]))
fe.cis = rbind(fe.cis, ci(pars$log_NAA_sigma[1], sd$log_NAA_sigma[1], type = "exp"))
fe.names = c(fe.names, paste("NAA residual AR1 $\\rho$", "year"))
fe.vals = c(fe.vals, -1 + 2/(1 + exp(-pars$trans_NAA_rho[2])))
fe.vals = c(fe.vals, -1 + 2/(1 + exp(- 2 * pars$trans_NAA_rho[2])))
fe.cis = rbind(fe.cis,
ci(pars$trans_NAA_rho[2], sd$trans_NAA_rho[2], lo = -1, hi = 1, type = "expit", k = 2))
}
Expand Down Expand Up @@ -216,12 +216,12 @@ par_tables_fn = function(mod, do.tex=FALSE, do.html=FALSE, od)
if(data$selblock_models[i] %in% c(2,4)) modify = " $\\rho$ for $a_{50}$ and 1/slope"
if(data$selblock_models[i] == 3) modify = " AR1 $\\rho$ for double-logistic pars"
fe.names = c(fe.names, paste0("Block ", i , ": Selectivity RE", modify))
fe.vals = c(fe.vals, -1 + 2/(1 + exp(-pars$sel_repars[i,2])))
fe.vals = c(fe.vals, -1 + 2/(1 + exp(- 2 * pars$sel_repars[i,2])))
fe.cis = rbind(fe.cis, ci(pars$sel_repars[i,2], sd$sel_repars[i,2], lo = -1, hi = 1, type = "expit", k = 2))
}
if(data$selblock_models_re[i] %in% c(4,5)) {
fe.names = c(fe.names, paste0("Block ", i , ": Selectivity RE AR1 $\\rho$ (year)"))
fe.vals = c(fe.vals, -1 + 2/(1 + exp(-pars$sel_repars[i,3])))
fe.vals = c(fe.vals, -1 + 2/(1 + exp(- 2 * pars$sel_repars[i,3])))
fe.cis = rbind(fe.cis, ci(pars$sel_repars[i,3], sd$sel_repars[i,3], lo = -1, hi = 1, type = "expit", k = 2))
}
}
Expand Down Expand Up @@ -346,12 +346,12 @@ par_tables_fn = function(mod, do.tex=FALSE, do.html=FALSE, od)
fe.cis = rbind(fe.cis, ci(pars$M_repars[1], sd$M_repars[1], type = "exp"))
if(data$M_re_model %in% c(3,5)){
fe.names = c(fe.names, "M RE AR1 $\\rho$ (age)")
fe.vals = c(fe.vals, exp(pars$M_repars[2]))
fe.vals = c(fe.vals, -1 + 2/(1 + exp(- 2 * pars$M_repars[2])))
fe.cis = rbind(fe.cis, ci(pars$M_repars[2], sd$M_repars[2], lo = -1, hi = 1, type = "expit", k = 2))
}
if(data$M_re_model %in% c(4,5)) {
fe.names = c(fe.names, "M RE AR1 $\\rho$ (year)")
fe.vals = c(fe.vals, exp(pars$M_repars[3]))
fe.vals = c(fe.vals, -1 + 2/(1 + exp(- 2 * pars$M_repars[3])))
fe.cis = rbind(fe.cis, ci(pars$M_repars[3], sd$M_repars[3], lo = -1, hi = 1, type = "expit", k = 2))
}
}
Expand Down
6 changes: 3 additions & 3 deletions man/prepare_projection.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions man/project_wham.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 31ea94b

Please sign in to comment.