Statistics with python, Part 1

Photo by Christopher Burns on Unsplash

Easy python, no installing

Let’s use Google Colaboratory to write python code!

viewer = "😎 Physicist" ## variable assingment
print(f"Hello world {viewer}")
normal_dist = np.random.normal(30,5,60)
import matplotlib.pyplot as plt
figure = plt.hist(normal_dist)
normal_dist2 = np.random.normal(34,3,60)
fig1 = plt.hist(normal_dist)
fig2 = plt.hist(normal_dist2)
from scipy.stats import ttest_ind
test = ttest_ind(normal_dist,normal_dist2)
Result, the statistic is -5, and p-value = 1e-8
from scipy.stats import ttest_rel
test = ttest_rel(normal_dist,normal_dist2)
from scipy.stats import wilcoxontest
test = wilcoxon(normal_dist,normal_dist2)
from scipy.stats import mannwhitneyu
test = mannwhitneyu(normal_dist,normal_dist2)



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
João Castelo

João Castelo

Radiation Therapy Medical Physicist and Programmer