Skip to content

About

This is a python app with GUI made using python and PyQT6 library that calculates the finite and infinite sample size.

Topics

Resources

Stars

2 stars

Watchers

2 watching

Forks

Latest commit

ย 

History

13 Commits

Folders and files

NameName
Last commit message
Last commit date
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Sample Size Calculator logo

๐Ÿ“Š Sample Size Calculator

A modern, minimal desktop app to calculate the ideal sample size for your research, surveys and studies.

Python PyQt6 License Platform


๐Ÿ“‘ Table of Contents


โœจ Overview

Sample Size Calculator is a lightweight desktop application built with Python and PyQt6 that helps students, researchers, statisticians and market analysts determine how many individuals they need to survey to obtain statistically reliable results.

Whether you are working with a known population (for example, the 2,500 students of a school) or an unknown or very large population, the app gives you the minimum sample size in a single click, using the classic statistical formulas based on the normal distribution (Z-table).

The interface is designed to be clean, dark and distraction-free, with a mint-green accent palette and full English / Spanish support.


๐ŸŽฏ Features

Feature Description
๐Ÿ”ข Finite population Calculates the sample size when the total population size is known.
โ™พ๏ธ Infinite population Calculates the sample size when the population is unknown or very large.
๐ŸŽš๏ธ Configurable confidence level Set your desired confidence level as a percentage (default: 99%).
๐ŸŽฒ Configurable success probability Set the expected success probability p (default: 50%, the most conservative case).
๐ŸŒ Bilingual interface Switch instantly between English and Spanish with a single click.
๐ŸŽจ Modern dark UI Black, mint-green and white palette with segmented controls and smooth animations.
โœ… Input validation Only numeric input is accepted, with inline error messages for invalid values.
โŒจ๏ธ Keyboard friendly Press Enter in any field to calculate.
๐Ÿชถ Lightweight No heavy dependencies, only PyQt6.

๐Ÿ–ผ๏ธ Screenshots

Sample Size Calculator screenshot

๐Ÿงฎ How It Works

The calculator relies on the standard sample size formulas for proportions.

Finite population

        N ยท Zยฒ ยท p ยท q
n = โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
     eยฒ ยท (N โˆ’ 1) + Zยฒ ยท p ยท q

Infinite population

      Zยฒ ยท p ยท q
n = โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
          eยฒ
Symbol Meaning
n Required sample size
N Population size (finite case only)
Z Z-score associated with the confidence level (looked up in a built-in Z-table)
p Probability of success
q Probability of failure, q = 1 โˆ’ p
e Margin of error, e = 1 โˆ’ confidence level

โ„น๏ธ Note: If you leave the confidence level or the success probability empty (or enter an invalid value), the app falls back to the defaults of 99% and 50% respectively.


๐Ÿ› ๏ธ Tech Stack

Technology Purpose
๐Ÿ Python 3.11+ Core language
๐Ÿ–ฅ๏ธ PyQt6 Graphical user interface (widgets, layouts, QSS styling, animations)
๐Ÿ“ decimal (stdlib) Precise percentage arithmetic
๐Ÿ“Š Z-table lookup Built-in normal distribution table for Z-score resolution

The project is split into two clear layers:

  • ๐Ÿง  Backend โ€“ SampleSize.py: all statistical logic, independent from the UI.
  • ๐ŸŽจ Frontend โ€“ Program.py: the PyQt6 interface, styled with QSS.

๐Ÿ“‹ Requirements

  • ๐Ÿ Python 3.11 or higher โ€“ Download Python
  • ๐Ÿ“ฆ pip (included with Python)
  • ๐Ÿ–ฅ๏ธ Windows, macOS or Linux

๐Ÿš€ Installation

1๏ธโƒฃ Clone the repository

git clone https://github.com/ia-MarvinRios/Sample-Size-Calculator.git
cd Sample-Size-Calculator

2๏ธโƒฃ (Recommended) Create a virtual environment

๐ŸชŸ Windows
python -m venv venv
venv\Scripts\activate
๐ŸŽ macOS / ๐Ÿง Linux
python3 -m venv venv
source venv/bin/activate

3๏ธโƒฃ Install the dependencies

pip install PyQt6

4๏ธโƒฃ Run the app

python Program.py

โ–ถ๏ธ Usage

๐Ÿ”ข Finite population

  1. Select the Finite tab.
  2. Enter the population size.
  3. Enter the confidence level (%).
  4. Enter the success probability (%).
  5. Click Calculate (or press Enter).

โ™พ๏ธ Infinite population

  1. Select the Infinite tab.
  2. Enter the confidence level (%).
  3. Enter the success probability (%).
  4. Click Calculate (or press Enter).

๐ŸŒ Change language

Use the ES | EN switch in the top-right corner of the window.

๐Ÿ’ก Example

Input Value
Population 1000
Confidence level 95
Success probability 50

The result is shown in the large mint-colored card at the bottom of the window.


๐Ÿ“ฆ Build a Standalone Executable

Want to share the app without requiring Python? Package it with PyInstaller:

pip install pyinstaller
pyinstaller --noconsole --onefile --icon=icon.ico --name "SampleSizeCalculator" Program.py

The executable will be generated inside the dist/ folder.

๐ŸชŸ On Windows, make sure icon.ico is in the project root. The app loads it at runtime, so when distributing, place it next to the executable or bundle it with --add-data "icon.ico;.".


๐Ÿ—‚๏ธ Project Structure

Sample-Size-Calculator/
โ”œโ”€โ”€ ๐Ÿ“„ Program.py            # PyQt6 user interface
โ”œโ”€โ”€ ๐Ÿ“„ SampleSize.py      # Statistical logic (Z-table + formulas)
โ”œโ”€โ”€ ๐ŸŽจ icon.svg           # Vector app icon
โ”œโ”€โ”€ ๐ŸŽจ icon.ico           # Windows app icon
โ”œโ”€โ”€ ๐Ÿ“ docs/              # Screenshots
โ”œโ”€โ”€ ๐Ÿ“„ README.md
โ”œโ”€โ”€ ๐Ÿ“„ LICENSE
โ””โ”€โ”€ ๐Ÿ“„ .gitignore

๐Ÿค Contributing

Contributions, issues and feature requests are welcome!

  1. ๐Ÿด Fork the project
  2. ๐ŸŒฟ Create your feature branch: git checkout -b feature/amazing-feature
  3. ๐Ÿ’พ Commit your changes: git commit -m "Add amazing feature"
  4. ๐Ÿ“ค Push to the branch: git push origin feature/amazing-feature
  5. ๐Ÿ”ƒ Open a Pull Request

๐Ÿ“„ License

This project is released under the CC0 1.0 Universal license. See the LICENSE file for details.


Made with ๐Ÿ’š by ia-MarvinRios

โญ If you find this project useful, consider giving it a star!

About

This is a python app with GUI made using python and PyQT6 library that calculates the finite and infinite sample size.

Topics

Resources

Stars

2 stars

Watchers

2 watching

Forks

Releases

Packages

Contributors

Languages