Skip to content

Commit

Permalink
Delete prop and kernel function defs after using factory methods
Browse files Browse the repository at this point in the history
  • Loading branch information
apulsipher committed Oct 23, 2024
1 parent 055a464 commit eacdc22
Showing 1 changed file with 0 additions and 44 deletions.
44 changes: 0 additions & 44 deletions vignettes/likelihood-free-mcmc.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -88,50 +88,6 @@ sumfun <- function(res, dat, m) {
return()
}
# Define Proposal Function
propfun <- function(params_now, params_prev, m) {
# Make proposal norm reflective
scale <- as.double(0.5)
lb <- as.double(0)
ub <- as.double(1)
# Making the proposal
params_now <- params_prev + rnorm(length(params_prev)) * scale
# Checking boundaries
d <- ub - lb
for (i in seq_along(params_now)) {
# Correcting if parameter goes above the upper bound
if (params_now[i] > ub) {
d_above <- params_now[i] - ub
odd <- floor(d_above / d) %% 2
d_above <- d_above - floor(d_above / d) * d
params_now[i] <- (lb + d_above) * odd + (ub - d_above) * (1 - odd)
# Correcting if parameter goes below lower bound
} else if (params_now[i] < lb) {
d_below <- lb - params_now[i]
odd <- floor(d_below / d) %% 2
d_below <- d_below - floor(d_below / d) * d
params_now[i] <- (ub - d_below) * odd + (lb + d_below) * (1 - odd)
}
}
return()
}
# Define Kernel Function
kernfun <- function(
stats_now,
stats_obs,
epsilon,
m
) {
return(1.0)
}
# Set initial parameters
par0 <- as.double(c(0.5, 0.5))
```
Expand Down

0 comments on commit eacdc22

Please sign in to comment.