Skip to content

Instantly share code, notes, and snippets.

@jkclem
Created August 8, 2020 21:47
Show Gist options
  • Save jkclem/8ceaeb7943dfc7e88e1862ecfdfcc5e1 to your computer and use it in GitHub Desktop.
Save jkclem/8ceaeb7943dfc7e88e1862ecfdfcc5e1 to your computer and use it in GitHub Desktop.
# for the paired t-test for differnce of means
from scipy.stats import ttest_rel
# save and printprint the results of the test on the Ridge estimates
lasso_results = ttest_rel(unbiased_sigma_estimates, lasso_sigma_estimates)
print(f'Test Statistic for the Paired t-test between the True Model and LASSO: {round(lasso_results[0], 4)}')
print(f'p-value for the Paired t-test between the True Model and LASSO: {round(lasso_results[1], 4)}')
print()
# save and printprint the results of the test on the Ridge estimates
ridge_results = ttest_rel(unbiased_sigma_estimates, ridge_sigma_estimates)
print(f'Test Statistic for the Paired t-test between the True Model and Ridge: {round(ridge_results[0], 4)}')
print(f'p-value for the Paired t-test between the True Model and Ridge: {round(ridge_results[1], 4)}')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment