Computes the likelihood for a range of values using a linear coin model

profile_linear_model(
  nheads,
  nflips,
  param_range = c(0, 1),
  slope = 0.1,
  number_of_steps = 1000,
  log = FALSE,
  outside_bounds_is_NA = FALSE
)

Arguments

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

Value

vector of likelihoods

Examples

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)]
#> Error in which.max(linear_results$likelihood, na.rm = TRUE): unused argument (na.rm = TRUE)
print(best_param)
#> Error in print(best_param): object 'best_param' not found