A modern, minimal desktop app to calculate the ideal sample size for your research, surveys and studies.
- โจ Overview
- ๐ฏ Features
- ๐ผ๏ธ Screenshots
- ๐งฎ How It Works
- ๐ ๏ธ Tech Stack
- ๐ Requirements
- ๐ Installation
โถ๏ธ Usage- ๐ฆ Build a Standalone Executable
- ๐๏ธ Project Structure
- ๐ค Contributing
- ๐ License
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.
| 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. |
The calculator relies on the standard sample size formulas for proportions.
N ยท Zยฒ ยท p ยท q
n = โโโโโโโโโโโโโโโโโโโโโโโโโ
eยฒ ยท (N โ 1) + Zยฒ ยท p ยท q
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.
| 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.
- ๐ Python 3.11 or higher โ Download Python
- ๐ฆ pip (included with Python)
- ๐ฅ๏ธ Windows, macOS or Linux
git clone https://github.com/ia-MarvinRios/Sample-Size-Calculator.git
cd Sample-Size-Calculator๐ช Windows
python -m venv venv
venv\Scripts\activate๐ macOS / ๐ง Linux
python3 -m venv venv
source venv/bin/activatepip install PyQt6python Program.py- Select the Finite tab.
- Enter the population size.
- Enter the confidence level (%).
- Enter the success probability (%).
- Click Calculate (or press Enter).
- Select the Infinite tab.
- Enter the confidence level (%).
- Enter the success probability (%).
- Click Calculate (or press Enter).
Use the ES | EN switch in the top-right corner of the window.
| 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.
Want to share the app without requiring Python? Package it with PyInstaller:
pip install pyinstaller
pyinstaller --noconsole --onefile --icon=icon.ico --name "SampleSizeCalculator" Program.pyThe executable will be generated inside the dist/ folder.
๐ช On Windows, make sure
icon.icois 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;.".
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
Contributions, issues and feature requests are welcome!
- ๐ด Fork the project
- ๐ฟ Create your feature branch:
git checkout -b feature/amazing-feature - ๐พ Commit your changes:
git commit -m "Add amazing feature" - ๐ค Push to the branch:
git push origin feature/amazing-feature - ๐ Open a Pull Request
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!
