Questions tagged [scipy.stats]

297 questions
3
votes
2 answers

SciKit Learn R-squared is very different from square of Pearson's Correlation R

I have 2 numpy arrays ike so: a = np.array([32.0, 25.97, 26.78, 35.85, 30.17, 29.87, 30.45, 31.93, 30.65, 35.49, 28.3, 35.24, 35.98, 38.84, 27.97, 26.98, 25.98, 34.53, 40.39, 36.3]) b = np.array([28.778585, 31.164268, 24.690865,…
3
votes
1 answer

How do you draw random numbers from a given scipy random distribution?

I'm trying to generate random numbers from a given scipy stats random distribution, in my case a negative binomial distribution. The documentation isn't entirely clear to me. Unfortunately, the documentation is a bit sparse:…
Cornelius Roemer
  • 3,772
  • 1
  • 24
  • 55
3
votes
1 answer

TypeError: '<' not supported between instances of 'float' and 'str' when using shapiro test with scipy

I'm trying to run shapiro test for each column in pandas dataframe based on column "code". This is how my df looks like: >>>name code 2020-10-22 2020-10-23 2020-10-24 ... 0 a 1 0.05423 0.1254 0.1432 1 b 1 …
Reut
  • 1,555
  • 4
  • 23
  • 55
3
votes
1 answer

Smooth Approximation of KDE in python

I am trying to get only non-negative values on the x-axis on the plot for my KDE. I know I can limit the x-axis values but I do not want that. Is there way to smoothly approximate the KDE such that there are no non-negative value? All my data are…
Deep
  • 79
  • 1
  • 1
  • 7
3
votes
2 answers

SciPy: von Mises distribution on a half circle?

I'm trying to figure out the best way to define a von-Mises distribution wrapped on a half-circle (I'm using it to draw directionless lines at different concentrations). I'm currently using SciPy's vonmises.rvs(). Essentially, I want to be able to…
mscone
  • 33
  • 4
3
votes
2 answers

interpreting the Anderson darling test scipy

Interested in knowing how to Interpret the result of the Anderson darling test in python. It seems as though the AD stat has to be lower then the critical value at its associated significance level though I am not sure how to properly determine this…
pete lee
  • 95
  • 1
  • 10
2
votes
1 answer

Fit data with a lognormal function via Maximum Likelihood estimators

Could someone help me in fitting the data collapse_fractions with a lognormal function, which has median and standard deviation derived via the maximum likelihood method? I tried scipy.stats.lognormal.fit(data), but I did not obtain the data I…
2
votes
2 answers

Count the frequency of unique values in every pandas column using groupby

How can i get all unique values and their frequencies in each dataframe column using groupby? I have tried stats.mode which gives info on the most frequent value which i would like to expand with frequenices of other column values. from scipy…
alex
  • 41
  • 3
2
votes
1 answer

equal_var value of scipy.stats.ttest_ind interpreting the result of a null hypothesis AB test

I am trying to interpret the results of a null hypothesis A/B testing by conducting a two-sample t-test and I am using scipy's stats.ttest_ind function. ttest_ind function has a parameter called "equal_var" of a boolean type. When this is true…
kee
  • 10,969
  • 24
  • 107
  • 168
2
votes
1 answer

How to draw the Probability Density Function (PDF) plot in Python?

I'd like to ask how to draw the Probability Density Function (PDF) plot in Python. This is my codes. import numpy as np import pandas as pd from pandas import DataFrame import matplotlib.pyplot as plt import scipy.stats as stats . x =…
2
votes
1 answer

T Test on Multiple Columns in Dataframe

Dataframe looks something like: decade rain snow 1910 0.2 0.2 1910 0.3 0.4 2000 0.4 0.5 2010 0.1 0.1 I'd love some help with a function in python to run a t test comparing decade combinations for…
gf7
  • 145
  • 11
2
votes
1 answer

How to perform Sidak's test (multi comp) following two-way anova on a dataframe?

I have a dataframe with the following columns: Time, Drug and mobility for a full 24 hour period. A Snapshot of the dataframe Time Drug Mobility 18 A 1.2 19 A 1.3 20 A 1.3 21 A 1.2 18 B 3.2 19 B 3.2 20 B 3.3 21 …
user17304179
2
votes
2 answers

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

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…
lalala8797
  • 47
  • 5
2
votes
0 answers

student cdf and normal ppf precision

Is there a way to increase the precision for the scipy.stats functions norm.pdf and t.cdf? Because if I do this it works: from scipy.stats import norm, t norm.ppf(t.cdf(9, 140)) but if I do the following, I got "inf" for the pdf and "1.0" for the…
1
2
3
19 20