# Example usage within optimization context
# Simulate some ICC interval data and weights
set.seed(123)
icc_intervals <- rgamma(50, shape = 2, scale = 3) # True mean=6, sd=sqrt(18)
weights <- runif(50, 0.1, 1)
initial_params <- c(5, 4)
likelihood_value <- wt_loglik(initial_params, icc_intervals, weights)
# Example of parameter optimization
# \donttest{
optimized <- optim(
par = initial_params,
fn = wt_loglik,
dat = icc_intervals,
tau2 = weights,
method = "BFGS"
)
cat("Optimized mean:", optimized$par[1], "\n")
cat("Optimized sd:", optimized$par[2], "\n")
# }
Run the code above in your browser using DataLab