Skip to contents

Plots an F-distribution

Usage

plot_f(
  df1,
  df2,
  from = NULL,
  to = NULL,
  n = 1000,
  add = FALSE,
  type = "l",
  xlab = expression(F),
  ylab = "Probability Density",
  xlim = NULL,
  ...
)

Arguments

df1

degrees of freedom for the numerator (non-negative, but can be non-integer).

df2

degrees of freedom for the denominator (non-negative, but can be non-integer).

from

the starting x-value for the plot. If NULL, it will be set to 0 or -5 sd from the mean.

to

the ending x-value for the plot. If NULL, it will be set to the mean plus 5 sd.

n

the number of points to use in the plot. Default is 1000.

add

whether to add the curve to an existing plot (TRUE) or create a new plot (FALSE). Default is FALSE.

type

the type of plot to create. Default is "l" for a line plot.

xlab

the label for the x-axis. Default is expression(chi^2).

ylab

the label for the y-axis. Default is "Probability Density".

xlim

the limits for the x-axis. If NULL, it will be set to c(from, to).

...

additional arguments to be passed to the curve function.

Examples

plot_f(5, 10)


set.seed(200)
hist(rf(200, 5, 10), prob = TRUE)
plot_f(5, 10, add = TRUE, col = "blue", lwd = 2)