Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions exercises/solved_notebooks/P4_probmod/probmod_2-basics.jl
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ md"### 2: Dirtprism"
# ╔═╡ 6b009ba3-83a8-4176-86d4-dd9f70ed29ec
@model function dirtprism()
rolls = zeros(20) # also possible to write out all 20 rolls by hand
for i in eachindex(rolls)
for i in 1:length(rolls)
rolls[i] ~ DiscreteUniform(1, 4)
end
dicesum = sum(rolls)
Expand Down Expand Up @@ -292,7 +292,7 @@ count_occurences([5, 107, 364, 5, 5, 364]) # three 5's, one 107 and two 364's
# number of students used as an input to the function so you can solve the question for any number of students - this was not asked but it's nice

bdays = zeros(n_students)
for bday_idx in eachindex(bdays)
for bday_idx in 1:length(bdays)
bdays[bday_idx] ~ DiscreteUniform(1, 365)
end
occurences = count_occurences(bdays)
Expand Down
4 changes: 2 additions & 2 deletions exercises/solved_notebooks/P5_mcmc/MCMC_1-intro.jl
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ As prior knowledge we can use the fact that it must have evolved _after_ the ray
α ~ prior_alpha # prior distribution of parameter

N = zeros(length(ts)) # output variable: in this model we have multiple values, so we need to preallocate a vector
for i in eachindex(ts)
for i in 1:length(ts)
N_average = α * ts[i]
N[i] ~ Poisson(N_average)
end
Expand Down Expand Up @@ -369,7 +369,7 @@ let
α ~ Exponential(2) # prior distribution of parameter

N = zeros(length(ts)) # output variable: in this model we have multiple values, so we need to preallocate a vector
for i in eachindex(ts)
for i in 1:length(ts)
N_average = α * ts[i]
N[i] ~ Poisson(N_average)
end
Expand Down
2 changes: 1 addition & 1 deletion exercises/solved_notebooks/P5_mcmc/MCMC_4-review.jl
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ md"""
y_nest ~ Uniform(0, 1000)
v_wasp ~ Gamma(8) # or something similar

for i in eachindex(ts)
for i in 1:length(ts)
dist = sqrt((xs[i] - x_nest)^2 + (ys[i] - y_nest)^2)
ts[i] ~ Normal(2*dist / v_wasp, 10)
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ function posterior(AICs) # AICs vector of AIC values
AICmin = minimum(AICs)
posterior = zeros(length(AICs))

for i in eachindex(1:length(AICs))
for i in 1:length(AICs)
posterior[i] = exp((AICmin-AICs[i])/2)
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ function posterior(AICs) # AICs vector of AIC values
AICmin = minimum(AICs)
posterior = zeros(length(AICs))

for i in eachindex(1:length(AICs))
for i in 1:length(AICs)
posterior[i] = exp((AICmin-AICs[i])/2)
end

Expand Down
4 changes: 2 additions & 2 deletions exercises/student_notebooks/P5_mcmc/MCMC_1-intro.jl
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ As prior knowledge we can use the fact that it must have evolved _after_ the ray
α ~ prior_alpha # prior distribution of parameter

N = zeros(length(ts)) # output variable: in this model we have multiple values, so we need to preallocate a vector
for i in eachindex(ts)
for i in 1:length(ts)
N_average = α * ts[i]
N[i] ~ Poisson(N_average)
end
Expand Down Expand Up @@ -369,7 +369,7 @@ let
α ~ Exponential(2) # prior distribution of parameter

N = zeros(length(ts)) # output variable: in this model we have multiple values, so we need to preallocate a vector
for i in eachindex(ts)
for i in 1:length(ts)
N_average = α * ts[i]
N[i] ~ Poisson(N_average)
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ function posterior(AICs) # AICs vector of AIC values
AICmin = minimum(AICs)
posterior = zeros(length(AICs))

for i in eachindex(1:length(AICs))
for i in 1:length(AICs)
posterior[i] = exp((AICmin-AICs[i])/2)
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ function posterior(AICs) # AICs vector of AIC values
AICmin = minimum(AICs)
posterior = zeros(length(AICs))

for i in eachindex(1:length(AICs))
for i in 1:length(AICs)
posterior[i] = exp((AICmin-AICs[i])/2)
end

Expand Down
Loading