Estimating required sample size for energy study
In the energy sector, researchers are often tasked with evaluating the effectiveness of new technologies or initiatives to enhance energy efficiency or reduce consumption. A study is being designed to compare the impact of two energy-saving measures: "Smart Thermostats" and "LED Lighting". To ensure the study has sufficient power to detect a meaningful difference in energy savings between these two measures, you'll conduct a power analysis.
pandas as pd, numpy as np, and from statsmodels.stats.power import TTestIndPower are loaded.
Deze oefening maakt deel uit van de cursus
Experimental Design in Python
Oefeninstructies
- Instantiate a
TTestIndPowerobject. - Conduct the power analysis to estimate the required sample size for each group (Smart Thermostats and LED Lighting) to achieve a power of 0.9, assuming a moderate effect size (Cohen's d = 0.5) and an alpha of 0.05 with an equal sized groups.
Praktische interactieve oefening
Probeer deze oefening eens door deze voorbeeldcode in te vullen.
# Instantiate a TTestIndPower object
power_analysis = ____
# Conduct a power analysis to determine the required sample size
required_n = power_analysis.solve_power(
effect_size=____,
alpha=____,
power=____,
ratio=____)
print(required_n)