Skip to content

Commit

Permalink
Return to not printing 'zero' sigmas
Browse files Browse the repository at this point in the history
Always return sigma_O
  • Loading branch information
seananderson committed Oct 23, 2023
1 parent 06b918a commit f58edd8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion R/tidy.R
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ tidy.sdmTMB <- function(x, effects = c("fixed", "ran_pars", "ran_vals"), model =
if (this == "tau_V") this <- "sigma_V"
this_se <- as.numeric(se[[this]])
this_est <- as.numeric(est[[this]])
if (length(this_est)) {
if (length(this_est) && !(all(this_se == 0) && all(this_est == 0))) {
out_re[[i]] <- data.frame(
term = i, estimate = this_est, std.error = this_se,
conf.low = exp(.e - crit * .se),
Expand Down
14 changes: 7 additions & 7 deletions src/sdmTMB.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -302,23 +302,23 @@ Type objective_function<Type>::operator()()
if (include_spatial(m)) {
sigma_O(0,m) = sdmTMB::calc_rf_sigma(ln_tau_O(m), ln_kappa(0,m));
log_sigma_O(0,m) = log(sigma_O(0,m));
REPORT(sigma_O);
ADREPORT(sigma_O);
ADREPORT(log_sigma_O);
}
if (spatial_covariate) {
for (int z = 0; z < n_z; z++) {
sigma_Z(z,m) = sdmTMB::calc_rf_sigma(ln_tau_Z(z,m), ln_kappa(0,m));
REPORT(sigma_Z);
ADREPORT(sigma_Z);
ADREPORT(log_sigma_Z);
}
for (int z = 0; z < n_z; z++)
for (int m = 0; m < n_m; m++)
log_sigma_Z(z,m) = log(sigma_Z(z,m));
ADREPORT(log_sigma_Z);
}
}
REPORT(sigma_Z);
ADREPORT(sigma_Z);
ADREPORT(log_sigma_Z);
REPORT(sigma_O);
ADREPORT(sigma_O);
ADREPORT(log_sigma_O);
ADREPORT(log_sigma_Z);

// TODO can we not always run this for speed?
//vector<Type> sigma_E(n_m);
Expand Down

0 comments on commit f58edd8

Please sign in to comment.