Skip to content

Commit

Permalink
fixed some global variables
Browse files Browse the repository at this point in the history
  • Loading branch information
nanu1605 committed Jul 17, 2022
1 parent 95880de commit 49905f5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
6 changes: 3 additions & 3 deletions modules/meta.analysis/R/approx.posterior.R
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ approx.posterior <- function(trait.mcmc, priors, trait.data = NULL, outdir = NUL
if (!is.null(trait.data)) {
graphics::rug(trait.data[[trait]]$Y, lwd = 2, col = "purple")
}
graphics::lines(x, dbeta(x, fit$estimate[1], fit$estimate[2]), lwd = 2, type = "l")
graphics::lines(x, dbeta(x, pparm[1], pparm[2]), lwd = 3, type = "l", col = 3)
graphics::lines(x, stats::dbeta(x, fit$estimate[1], fit$estimate[2]), lwd = 2, type = "l")
graphics::lines(x, stats::dbeta(x, pparm[1], pparm[2]), lwd = 3, type = "l", col = 3)
graphics::legend("topleft",
legend = c("data", "prior", "post", "approx"),
col = c("purple", 3, 2, 1), lwd = 2)
Expand All @@ -93,7 +93,7 @@ approx.posterior <- function(trait.mcmc, priors, trait.data = NULL, outdir = NUL
dist.names <- dist.names[!failfit.bool]

fparm <- lapply(fit, function(x) { as.numeric(x$estimate) })
fAIC <- lapply(fit, AIC)
fAIC <- lapply(fit, stats::AIC)

bestfit <- which.min(fAIC)
posteriors[ptrait, "distn"] <- dist.names[bestfit]
Expand Down
16 changes: 8 additions & 8 deletions modules/meta.analysis/R/jagify.R
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@ jagify <- function(result, use_ghs = TRUE) {
r <- PEcAn.DB::assign.treatments(r)
r <- PEcAn.utils::summarize.result(r)
r <- subset(transform(r,
stat = as.numeric(stat),
n = as.numeric(n),
site_id = as.integer(factor(site_id, unique(site_id))),
greenhouse = as.integer(factor(greenhouse, unique(greenhouse))),
r$stat <- as.numeric(r$stat),
r$n <- as.numeric(r$n),
r$site_id <- as.integer(factor(r$site_id, unique(r$site_id))),
r$greenhouse <- as.integer(factor(r$greenhouse, unique(r$greenhouse))),
mean = mean,
citation_id = citation_id,
ghs = greenhouse,
site = site_id,
trt_name = name),
r$citation_id <- r$citation_id,
ghs = r$greenhouse,
site = r$site_id,
trt_name = r$name),
select = c("stat", "n", "site_id", "trt_id", "mean", "citation_id", "greenhouse",
"ghs", "treatment_id", "site", "trt_name")) # original versions of greenhouse, treatment_id, site_id, and name

Expand Down

0 comments on commit 49905f5

Please sign in to comment.