Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

Set up and run a two-sample independent t-test

# Import the libraries
import numpy as np
from scipy import stats
np.random.seed(42)

# Generate the random variables with the specified mean, std, and sample size
rvs1 = stats.norm.rvs(loc=5, scale=10,size=500)
rvs2 = stats.norm.rvs(loc=5, scale=20, size=500)

# Calculate the t statistic for these two sample populations
stats.ttest_ind(rvs1, rvs2)
Source by lambdaschool.instructure.com #
 
PREVIOUS NEXT
Tagged: #Set #run #independent
ADD COMMENT
Topic
Name
7+6 =