Bootstrap-t-student/generateData.py

33 lines
1015 B
Python
Raw Normal View History

2022-05-18 11:20:39 +02:00
from random import randint
import random
import numpy as np
import pandas as pd
from math import sqrt
from scipy import stats
from scipy.stats import sem
from scipy.stats import t
import matplotlib.pyplot as plt
from statistics import mean, stdev
from scipy.stats import ttest_ind, ttest_1samp, ttest_rel
man_heights = np.random.normal(175, 10, 500)
woman_heights = np.array([x-randint(1, 10) for x in man_heights])
weights_before = np.random.normal(80, 10, 500)
weights_after = np.array([x-randint(1, 5) for x in weights_before])
man_heights = np.round(man_heights, 2)
woman_heights = np.round(woman_heights, 2)
weights_before = np.round(weights_before, 2)
weights_after = np.round(weights_after, 2)
dataset = pd.read_csv('experiment_data.csv')
dataset['Weight before'] = weights_before
dataset['Weight after'] = weights_after
dataset['Male height'] = man_heights
dataset['Female height'] = woman_heights
dataset.to_csv("experiment_data2.csv", encoding="utf-8", index=False)