scipy.stats

Performing the non-paired t-test column-wise in my data

Performing the non-paired t-test column-wise in my data Question: When we have two 1-D arrays: import numpy as np import scipy.stats as stats a=np.array([0.36619718309859156, 0.32558139534883723, 0.3333333333333333, 0.3333333333333333, 0.2549019607843137, 0.3695652173913043, 0.3157894736842105, 0.3625]) and b=np.array([0.938456, 0.3239485723, 0.300, 0.8658, 1.254901137, 2.3695, 0.75, 1.3625]) we can perform the t-test by the following: stats.ttest_ind(a=a, b=b, equal_var=np.amax([np.var(a),np.var(b)])/np.amin([np.var(a),np.var(b)])<4) However, I would like …

Total answers: 2

How to get Effect Size from tt_ind_solve_power?

How to get Effect Size from tt_ind_solve_power? Question: I am trying to get the Effect Size given my alpha, power, sample size, ratio. I found tt_ind_solve_power to do this but how would this work for 4 variants + 1 control? This is how I have it currently from statsmodels.stats.power import tt_ind_solve_power effect_size = tt_ind_solve_power(nobs1=X, alpha=0.05, …

Total answers: 1

Why does SciPy ttest_rel return numpy ndarray of NaN?

Why does SciPy ttest_rel return numpy ndarray of NaN? Question: I am trying to calculate t-test score of data stored in different dataframes using ttest_rel from scipy.stats. But when calculating t-test between same data, it is returning a numpy ndarray of NaN instead of a single NaN. What am I doing wrong that I am …

Total answers: 1

Assign brackets to values in pandas dataframe

Assign brackets to values in pandas dataframe Question: I have a dataframe that looks like this: dict = {‘industryId’: {0: ‘1730B’ , 1: ‘1730B’, 2: ‘1730B’, 3: ‘1730B’, 4: ‘3524A’, 5: ‘3524A’, 6: ‘3524A’, 7: ‘3524A’}, ‘year’: {0: 2017, 1: 2018, 2: 2019, 3: 2020, 4: 2017, 5: 2018, 6: 2019, 7: 2020}, ‘value’: {0: …

Total answers: 1

How to get the Sigma of a Rayleigh distribution in python scipy.stats

How to get the Sigma of a Rayleigh distribution in python scipy.stats Question: Calling rayleigh_args = stats.rayleigh.fit(num_list) Returns a tuple of 2 values e.g. (-320.34, 360.77). Where I can use it to get the CDF or PDF of the distribution for a given value. I can’t find what each of those values represents. In addition, …

Total answers: 1

How to generate lognormal distribution with specific mean and std in python?

How to generate lognormal distribution with specific mean and std in python? Question: I need to generate a lognormal distribution with mean=1 and std=1. That is:w~logN(1,1). I need the variable w has mu=1 and sigma=1. However, when I use scipy.stats.lognorm, I have trouble on manipulating the parameters s,loc,sigma. The code is as follows: import numpy …

Total answers: 2

3 functions for computing relative entropy in scipy. What's the difference?

3 functions for computing relative entropy in scipy. What's the difference? Question: Scipy in python offers the following functions that seem to compute the same information theory measure, Kullback-Leibler divergence, which is also called relative entropy: scipy.stats.entropy, which can be switched to computing KL-divergence if qk=None scipy.special.rel_entr scipy.special.kl_div Why three of the same thing? Could …

Total answers: 2