Skip to content

Commit fe4a948

Browse files
authored
Merge pull request #3855 from omkarrr2533/fix/remove-duplicate-lines-IGF-diagnostics
fix: remove duplicate code blocks in InventoryGrowthFusionDiagnostics
2 parents 716e281 + d7ef2cb commit fe4a948

1 file changed

Lines changed: 0 additions & 28 deletions

File tree

modules/data.land/R/InventoryGrowthFusionDiagnostics.R

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -77,21 +77,6 @@ InventoryGrowthFusionDiagnostics <- function(jags.out, combined=NULL) {
7777
vars <- c(vars,which(colnames(out)=="deviance"))
7878
}
7979

80-
81-
## rebuild coda for just vars
82-
var.out <- coda::as.mcmc.list(lapply(jags.out,function(x){ x[,vars]}))
83-
84-
## convergence
85-
coda::gelman.diag(var.out)
86-
87-
#### Diagnostic plots
88-
plot(var.out)
89-
90-
if("deviance" %in% colnames(out)){
91-
graphics::hist(out[,"deviance"])
92-
vars <- c(vars,which(colnames(out)=="deviance"))
93-
}
94-
9580
## rebuild coda for just vars
9681
var.out <- coda::as.mcmc.list(lapply(jags.out,function(x){ x[,vars]}))
9782

@@ -124,19 +109,6 @@ InventoryGrowthFusionDiagnostics <- function(jags.out, combined=NULL) {
124109
graphics::abline(h = 0, lty = 2)
125110
}
126111

127-
graphics::par(mfrow = c(1, 1))
128-
### alpha
129-
alpha.cols <- grep("alpha", colnames(out))
130-
if (length(alpha.cols) > 0) {
131-
alpha.ord <- 1:length(alpha.cols)
132-
ci.alpha <- apply(out[, alpha.cols], 2, stats::quantile, c(0.025, 0.5, 0.975))
133-
plot(alpha.ord, ci.alpha[2, ], type = "n",
134-
ylim = range(ci.alpha, na.rm = TRUE), ylab = "Random Effects")
135-
PEcAn.visualization::ciEnvelope(alpha.ord, ci.alpha[1, ], ci.alpha[3, ], col = "lightBlue")
136-
graphics::lines(alpha.ord, ci.alpha[2, ], lty = 1, lwd = 2)
137-
graphics::abline(h = 0, lty = 2)
138-
}
139-
140112
### YEAR
141113
year.cols <- grep("year", colnames(out))
142114
if (length(year.cols > 0)) {

0 commit comments

Comments
 (0)