Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
sethharju authored Sep 12, 2023
1 parent 9247121 commit 09d3e70
Show file tree
Hide file tree
Showing 27 changed files with 216 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
## on the coefficients for each covariate.
for(m in 1:length(X[1, ])) {
Beta[m] ~ dnorm(0, VAGUE_COEF_PRIOR_SLOPE)
}
7 changes: 7 additions & 0 deletions model-api/src/model-builder/code-blocks/prior/beta
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
## on sigma for each site and/or stratum.
for(k in 1:y.n.strata) {
for(j in 1:y.n.site[k]) {
VARIANCES_SPEC_SWITCH
}
VARIANCES_SPEC_HYPERS_SWITCH
}
7 changes: 7 additions & 0 deletions model-api/src/model-builder/code-blocks/prior/beta-binomial
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
## on sigma for each site and/or stratum.
for(k in 1:y.n.strata) {
for(j in 1:y.n.site[k]) {
VARIANCES_SPEC_SWITCH
}
VARIANCES_SPEC_HYPERS_SWITCH
}
Empty file.
12 changes: 12 additions & 0 deletions model-api/src/model-builder/code-blocks/prior/gamma
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
### on sigma.y for each stratum.
#for(k in 1:y.n.strata) {
# sigma.y[k] ~ dunif(0, 500)
#}

### on sigma for each site and/or stratum.
for(k in 1:y.n.strata) {
for(j in 1:y.n.site[k]) {
VARIANCES_SPEC_SWITCH
}
VARIANCES_SPEC_HYPERS_SWITCH
}
5 changes: 5 additions & 0 deletions model-api/src/model-builder/code-blocks/prior/gen-pois
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Prior for delta parameter of GP distribution.
for(k in 1:y.n.strata) {
delta[k] ~ dunif(-1, 1)
}
C <- 10000
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
## on the coefficients for the likelihood associated with the hurdle.
for(k in 1:y.n.strata) {
mu.G0[k] ~ dnorm(0, pow(1.5, -2)) # flat prior on proportion
sigma.G0[k] ~ dgamma(0.01, 0.01)
tau.G0[k] <- 1 / max(1E-12, sigma.G0[k]^2)
G1[k] ~ dnorm(0, pow(1.5, -2))
VARIANCES_SPEC_HYPERS_SWITCH
for(j in 1:y.n.site[k]) {
G0[j, k] ~ dnorm(mu.G0[k], tau.G0[k])
G[j, 1, k] <- G0[j, k]
G[j, 2, k] <- G1[k]
VARIANCES_SPEC_SWITCH
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
## on the coefficients for the likelihood associated with the hurdle.
for(k in 1:y.n.strata) {
mu.G0[k] ~ dnorm(0, pow(1.5, -2)) # flat prior on proportion
sigma.G0[k] ~ dgamma(0.01, 0.01)
tau.G0[k] <- 1 / max(1E-12, sigma.G0[k]^2)
G1[k] ~ dnorm(0, pow(1.5, -2))
VARIANCES_SPEC_HYPERS_SWITCH
for(j in 1:y.n.site[k]) {
G0[j, k] ~ dnorm(mu.G0[k], tau.G0[k])
G[j, 1, k] <- G0[j, k]
G[j, 2, k] <- G1[k]
VARIANCES_SPEC_SWITCH
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
## on the coefficients for the likelihood associated with the hurdle.
for(k in 1:y.n.strata) {
mu.G0[k] ~ dnorm(0, pow(1.5, -2)) # flat prior on proportion
sigma.G0[k] ~ dgamma(0.01, 0.01)
tau.G0[k] <- 1 / max(1E-12, sigma.G0[k]^2)
VARIANCES_SPEC_HYPERS_SWITCH
for(j in 1:y.n.site[k]) {
G0[j, k] ~ dnorm(mu.G0[k], tau.G0[k])
G[j, 1, k] <- G0[j, k]
VARIANCES_SPEC_SWITCH
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
## on the coefficients for the likelihood associated with the hurdle.
for(k in 1:y.n.strata) {
mu.G0[k] ~ dnorm(0, 1 / 1.5^2)
VARIANCES_SPEC_HYPERS_SWITCH
for(j in 1:y.n.site[k]) {
G0[j, k] <- mu.G0[k]
G[j, 1, k] <- G0[j, k]
VARIANCES_SPEC_SWITCH
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
## on the coefficients for the likelihood associated with the hurdle.
for(k in 1:y.n.strata) {
mu.G0[k] ~ dnorm(0, pow(1.5, -2)) # flat prior on proportion
sigma.G0[k] ~ dgamma(0.01, 0.01)
tau.G0[k] <- 1 / max(1E-12, sigma.G0[k]^2)
VARIANCES_SPEC_HYPERS_SWITCH
for(j in 1:y.n.site[k]) {
G0[j, k] ~ dnorm(mu.G0[k], tau.G0[k])
G[j, 1, k] <- G0[j, k]
VARIANCES_SPEC_SWITCH
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
## on the coefficients for the likelihood associated with the hurdle.
for(k in 1:y.n.strata) {
mu.G0[k] ~ dnorm(0, 1 / 1.5^2)
VARIANCES_SPEC_HYPERS_SWITCH
for(j in 1:y.n.site[k]) {
G0[j, k] <- mu.G0[k]
G[j, 1, k] <- G0[j, k]
VARIANCES_SPEC_SWITCH
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
## on slope and intercept parameters and their covariance matrix for each
## site within each stratum.
for(k in 1:y.n.strata) {
VARIANCES_SPEC_HYPERS_SWITCH
for(j in 1:y.n.site[k]) {
G[j, 1:2, k] ~ dmnorm(G.hat[j, 1:2, k], Tau.G[, 1:2, k])
G.hat[j, 1, k] <- mu.G0[k]
G.hat[j, 2, k] <- mu.G1[k]
VARIANCES_SPEC_SWITCH
}
mu.G0[k] ~ dnorm(0, pow(1.5, -2))
mu.G1[k] ~ dnorm(0, pow(1.5, -2))
Tau.G[1:2, 1:2, k] <- inverse(Sigma.G[1:2, 1:2, k])
Sigma.G[1, 1, k] <- sigma.G0[k]^2
sigma.G0[k] ~ dgamma(0.01, 0.01)
Sigma.G[2, 2, k] <- sigma.G1[k]^2
sigma.G1[k] ~ dgamma(0.01, 0.01)
Sigma.G[1, 2, k] <- rho.G[k] * sigma.G0[k] * sigma.G1[k]
Sigma.G[2, 1, k] <- Sigma.G[1, 2, k]
rho.G[k] ~ dunif(-1, 1)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
## on slope and intercept parameters and their covariance matrix for each
## site within each stratum.
for(k in 1:y.n.strata) {
VARIANCES_SPEC_HYPERS_SWITCH
for(j in 1:y.n.site[k]) {
G[j, 1:2, k] ~ dmnorm(G.hat[j, 1:2, k], Tau.G[, 1:2, k])
G.hat[j, 1, k] <- mu.G0[k]
G.hat[j, 2, k] <- mu.G1[k]
VARIANCES_SPEC_SWITCH
}
mu.G0[k] ~ dnorm(0, pow(1.5, -2))
mu.G1[k] ~ dnorm(0, pow(1.5, -2))
Tau.G[1:2, 1:2, k] <- inverse(Sigma.G[1:2, 1:2, k])
Sigma.G[1, 1, k] <- sigma.G0[k]^2
sigma.G0[k] ~ dgamma(0.01, 0.01)
Sigma.G[2, 2, k] <- sigma.G1[k]^2
sigma.G1[k] ~ dgamma(0.01, 0.01)
Sigma.G[1, 2, k] <- rho.G[k] * sigma.G0[k] * sigma.G1[k]
Sigma.G[2, 1, k] <- Sigma.G[1, 2, k]
rho.G[k] ~ dunif(-1, 1)
}
7 changes: 7 additions & 0 deletions model-api/src/model-builder/code-blocks/prior/lognormal
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
### on sigma for each site and/or stratum.
for(k in 1:y.n.strata) {
for(j in 1:y.n.site[k]) {
VARIANCES_SPEC_SWITCH
}
VARIANCES_SPEC_HYPERS_SWITCH
}
2 changes: 2 additions & 0 deletions model-api/src/model-builder/code-blocks/prior/max-r
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
## max `response` for asymptotic functions.
maxR ~ dunif(0, 100)
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
## on the variance of observations.
for(k in 1:y.n.strata) {
for(j in 1:y.n.site[k]) {
VARIANCES_SPEC_SWITCH
}
VARIANCES_SPEC_HYPERS_SWITCH
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
## on kappa for each stratum.
for(k in 1:y.n.strata) {
kappa[k] ~ dunif(0, 10000)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
for(k in 1:y.n.strata) {
VARIANCES_SPEC_HYPERS_SWITCH
# This code allows for site- or strata-level variances: .01 is rate and
# shape parameter in flat gamma.
for(j in 1:y.n.site[k]) {
VARIANCES_SPEC_SWITCH
}
}
# Priors on cutpoints, 1 and nYlevels-1 are fixed (Kruschke 2nd ed., pg. 688)
for(k in 2:(nYlevels - 2)) {
theta[k] ~ dnorm(k + .05, 1/2^2)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## on the coefficients for each covariate.
for(q in 1:length(X[1, ])) {
Beta[q] ~ dnorm(0, VAGUE_COEF_PRIOR_SLOPE)
Gamma[q] ~ dnorm(0, VAGUE_COEF_PRIOR_SLOPE)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
## on the coefficients for each covariate.
for(q in 1:length(X[1, ])) {
Gamma[q] ~ dnorm(0, pow(1.5, -2))
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
## on the coefficients for each covariate.
for(q in 1:length(X[1, ])) {
Beta[q] ~ dnorm(0, VAGUE_COEF_PRIOR_SLOPE)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
## on `p.zero` for each stratum and sigma for each site and/or stratum.
for(k in 1:y.n.strata) {
p.zero[k] ~ dunif(0, 1)
for(j in 1:y.n.site[k]) {
VARIANCES_SPEC_SWITCH
}
VARIANCES_SPEC_HYPERS_SWITCH
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
## on `p.zero` for each stratum.
for(k in 1:y.n.strata) {
p.zero[k] ~ dunif(0, 1)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
## on `kappa`, `p.zero`, and `tau.epsilon` for each stratum.
for(k in 1:y.n.strata) {
kappa[k] ~ dunif(0, 10000)
p.zero[k] ~ dunif(0, 1)
}
tau.epsilon <- 1
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
## on `p.zero` for each stratum.
for(k in 1:y.n.strata) {
p.zero[k] ~ dunif(0, 1)
}

0 comments on commit 09d3e70

Please sign in to comment.