sampdistC: Plots probability and cumulative density functions (PDFs and...

View source: R/sampdistC.r

sampdistCR Documentation

Plots probability and cumulative density functions (PDFs and CDFs) of sample statistics

Description

Visualize expected sampling distributions for sample statistics. You can plot the probability and cumulative density functions for statistics based on either the normal distribution or a t-distribution. The sampdistC function also generates the confidence interval (default 95%) for a sample statistic which is useful for obtaining the CI of a summary statistic (when you're not estimating it from the dataset yourself).

Usage

sampdistC(stat, se, t.df, plot.cdf = FALSE, ci = 95, digits = 3,
  printC = FALSE)

Arguments

stat

A numeric statistic, the point estimate of a parameter based on a sample of observations, like a sample mean or a sample proportion.

se

The standard error of the statistic, must be a positive number.

t.df

(Optional) If critical values for sampling distribution should be based on t-distribution (generally true when statistic is a mean), set t.df to the number of degrees of freedom (typically n-1).

plot.cdf

(Optional) Do you want to plot the cumulative density function? Default = FALSE (for probability density function).

ci

(Optional) Specify desired confidence level for confidence interval as a percentage. Set ci=FALSE to suppress CI table (default: 95)

digits

(Optional) Number of digits after decimal to display in CI table (default: 3)

printC

(Optional) Do you want to sampling distribution plot to .html file in working directory? (default: FALSE)

Value

None (makes a plot)

RCPA3 Package Tutorial Videos

Textbook References

  • Philip H. Pollock and Barry C. Edwards, An R Companion to Political Analysis, 3rd Edition (Thousand Oaks, CA: Sage Publications, Forthcoming 2022), Chapter 8.

  • Philip H. Pollock and Barry C. Edwards, The Essentials of Political Analysis, 6th Edition (Thousand Oaks, CA: Sage Publications, 2020), Chapter 6. ISBN-13: 978-1506379616; ISBN-10: 150637961.

Online Resources

Examples

 
  library(RCPA3)

  
  # based on normal distributions
  sampdistC(stat=10, se=1)
  sampdistC(stat=10, se=1, plot.cdf=TRUE)
  
  # based on t-distribution with 15 degrees of freedom
  sampdistC(stat=8, se=2, t.df=15)
  sampdistC(stat=8, se=2, t.df=15, plot.cdf=TRUE)
  

RCPA3 documentation built on May 29, 2024, 12:19 p.m.

Related to sampdistC in RCPA3...