Skip to content

Simulations for the understanding of the alfa-errors (error of the first kind) in a two sample t-test accounting for different sample sizes.

Notifications You must be signed in to change notification settings

femarivera/Alfa-errors-Two-Sample-t-test

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 

Repository files navigation

R Last Commit Issues

R Simulations: Understanding Alpha Errors in Two-Sample t-Tests

This project explores α-errors (Type I errors) in a two-sample t-test under different sample sizes.
The idea: simulate, test, and visualize how often we falsely reject the null hypothesis when the samples actually come from the same normal distribution.


How it works

  1. Simulation setup

    • Define a vector of sample sizes → sample_sizes
    • Set significance level → sign_level
    • Choose number of simulations → total_simulations
    • Specify tests per simulation → tests_per_simulation
  2. Within each simulation

    • Two samples of equal size are drawn from a normal distribution (rnorm() with random mean & sd).
    • A series of t-tests is performed.
    • Results are classified as significant / not significant based on sign_level.
  3. Output

    • For each sample size, the ratio of significant tests is computed.
    • Results are visualized with boxplots, showing the empirical Type I error vs. the theoretical sign_level.

About

Simulations for the understanding of the alfa-errors (error of the first kind) in a two sample t-test accounting for different sample sizes.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published