Description Usage Arguments Value Examples
Computes the likelihood for a range of values using a linear coin model
1 2 3 4 5 6 7 8 9 | profile_linear_model(
nheads,
nflips,
param_range = c(0, 1),
slope = 0.1,
number_of_steps = 1000,
log = FALSE,
outside_bounds_is_NA = FALSE
)
|
nflips |
Total number of flips (heads and tails) |
param_range |
Range of parameters to try |
slope |
How much the probability changes each time the coin is flipped |
number_of_steps |
How many values of the parameter to try |
vector of likelihoods
1 2 3 4 5 6 7 8 | nheads <- 8
nflips <- 10
linear_results <- profile_linear_model(nheads, nflips)
plot(x=linear_results$preflip_prob, y=linear_results$likelihood, type="l")
dbinom_proportions <- seq(from=0, to=1, length.out=1000)
lines(dbinom_proportions, dbinom(nheads, nflips, dbinom_proportions), col="red")
best_param <- linear_results$preflip_prob[which.max(linear_results$likelihood, na.rm=TRUE)]
print(best_param)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.