R/plotchisq.R

Defines functions plotchisq

Documented in plotchisq

#' Plot of Chi-squared distribution
#'
#' The plot of Chi-squared distribution with \code{k} degrees of freedom
#'
#' @param df degrees of freedom
#' @importFrom graphics plot
#' @importFrom stats rchisq dchisq
#'
#' @return The figure of Chi-squared distribution with \code{k} degrees of freedom
#' @export
#'
#' @examples
#' plotchisq(df=15)
#'
plotchisq  <- function(df=8){
  v <- df
  x<- rchisq(n=101,df=v,ncp=0)
  xs = sort(x)
  fxs=dchisq(xs,df=v)
  graphics::plot(xs,fxs,type="l",xlab="x",
       main = "Plot of Chi-square dist",ylab="f(x)")
}

Try the Mychisq package in your browser

Any scripts or data that you put into this service are public.

Mychisq documentation built on June 22, 2026, 9:08 a.m.