profile_linear_model: Computes the likelihood for a range of values using a linear...

Description Usage Arguments Value Examples

View source: R/flipped.R

Description

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

Usage

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
)

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

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)

bomeara/flipped documentation built on Dec. 19, 2021, 10:47 a.m.