2 sample z-test scores larger than 12 for hypothesis testing. Is it correct?

I am using a dataset and taking input dataframe df. I am doing a hypothesis testing that for all features male and female mean are same. I am doing 2 sample z statistic. I am doing the following:

1. select features whose skewness is between -0.5 and 0.5 to have moderate normally distributed features
2. among the selected features calculating z-statistic to check null hypothesis, for p=0.05, using critical value of 1.96, 2 tailed tests.

Problem is when I am testing I am having absolute z statistic over 10,12 which is much higher than 1.96 so, null hypothesis is rejected. But even after step 1, how such large z statistics are possible.

def z_test(self, df, threshold_val=1.96, show_top=1):
'''
Assumptions:
1. sample size=population size
2. normal distribution
input:
df=dataframe of numerical features
threshold_val= z score of 1.96 for 95% confidence(p<0.05)
'''
self.df=df

std_error1=(self.df[self.df[self.cls]==self.cls_vals[0]].std().pow(2.))/self.df[self.df[self.cls]==self.cls_vals[0]].shape[0]
std_error2=(self.df[self.df[self.cls]==self.cls_vals[1]].std().pow(2.))/self.df[self.df[self.cls]==self.cls_vals[1]].shape[0]

denominator=(std_error1+std_error2).pow(1./2)

nominator=(self.df[self.df[self.cls]==self.cls_vals[0]].mean()-self.df[self.df[self.cls]==self.cls_vals[1]].mean())\
-self.population_mean_diff

z_scores=nominator/denominator

return z_scores[z_scores.abs()>threshold_val]



something like these are z scores that reject the null hypothesis: 1st column feature name, 2nd column is 2 sample z scores :

My question is this correct? One thing is that I have already limited the skewness between -0.5 to 0.5 so these features are not largely skewed or anything, but still getting values over 16, how? Even this will suffice if results are ok, meaning testing is correct and just beating null hypothesis by large margin?

• It just means that you have a tiny p-value. What does skewness have to do with that? // It might help to ask another question about what you’re trying to do overall with the analysis of features for males and females.
– Dave
Oct 9 at 13:39