Setting up my blog
This is my first blog post. Here's some bold text and a list:
- Point one
- Point two
Here's a code block:
import numpy as np
import scipy.stats as stats
# Month lengths in days
month_lengths = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
month_names = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
# Calculate mean and standard deviation
mean_length = np.mean(month_lengths)
std_length = np.std(month_lengths, ddof=1) # sample standard deviation
print(f"Month lengths: {dict(zip(month_names, month_lengths))}")
print(f"Mean: {mean_length:.4f}")
print(f"Standard deviation: {std_length:.4f}")
# Get February's length
february_length = month_lengths[1]
print(f"\nFebruary length: {february_length} days")
# Calculate z-score for February
z_score = (february_length - mean_length) / std_length
print(f"Z-score for February: {z_score:.4f}")
# Calculate p-value (two-tailed test)
# This is the probability of observing a value as extreme or more extreme than February's
p_value = 2 * (1 - stats.norm.cdf(abs(z_score)))
print(f"P-value: {p_value:.6f}")
# Alternative interpretation: probability of being <= 28 days
p_value_one_tailed = stats.norm.cdf(z_score)
print(f"One-tailed p-value (P(X <= 28)): {p_value_one_tailed:.6f}")
# Show the distribution parameters
print(f"\nAssumed Normal Distribution:")
print(f"μ = {mean_length:.4f}")
print(f"σ = {std_length:.4f}")
print(f"February is {abs(z_score):.2f} standard deviations from the mean")
And an image:
