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.
Questo esercizio fa parte del corso
Experimental Design in Python
Istruzioni dell'esercizio
- 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.
Esercizio pratico interattivo
Prova a risolvere questo esercizio completando il codice di esempio.
# 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)