Generation

generate functionTue, 21 Mar 2023

You are given test results for two drugs: A (results for the group of people getting drug A) and B (results for the other group of people getting drug B). 1) You need to assess whether there is a statistically significant difference in the effect in these patients. Use the null hypothesis, the inverse hypothesis, and Student's t-test for calculations. 2) construct a boxplot and histogram to visually confirm the result

import numpy as np import scipy.stats as st import seaborn as sns import matplotlib.pyplot as plt def difference_of_means(data_1, data_2): """Difference in means of two arrays.""" # The difference of means of data_1, data_2: diff diff = np.mean(data_1) - np.mean(data_2) return diff def permutation_sample(data1, data2): """Generate a permutation sample from two data sets.""" # Concatenate the data sets: data data = np.concatenate((data1, data2)) # Permute the concatenated array: permuted_data permuted_data = np.random.permutation(data) # Split the permuted array into two: perm_sample_1, perm_sample_2 perm_sample_1 = permuted_data[:len(data1)] perm_sample_2 = permuted_data[

Questions about programming?Chat with your personal AI assistant