Questions tagged [hypothesis-test]

Functions used to choose between competing hypotheses about one or more probability distributions. For statistical questions, please use stats.stackexchange.com.

Common hypothesis tests include the one-sample and paired t-test for means, the z-test, which approximates the t-test for large samples, F-test for differences in variance, and Chi-square test for independence, and Fisher's exact test for differences in proportion.

Please note that this tag is totally different from , which refers to software testing.

349 questions
3
votes
1 answer

R: prop.test returns different values based on whether matrix or vectors are passed to it

Why would r's prop.test function (documentation here) return different results based on whether I pass it a matrix or vectors? Here I pass it vectors: > prop.test(x = c(135, 47), n = c(1781, 1443)) 2-sample test for equality of proportions…
Jarad
  • 17,409
  • 19
  • 95
  • 154
3
votes
2 answers

Implementation of E-test for Poisson in Python

Is there a Python implementation of the E-Test for Poissons? For Binomials scipy has the Fisher's Exact test as stats.fisher_exact and for Gaussians scipy.stats has Welch's T-test as ttest_ind. I can't seem to find any Python implementation for the…
Keith
  • 4,646
  • 7
  • 43
  • 72
3
votes
4 answers

doing t.test for columns for each row in data set

I have a set of data x which consists of 12 columns and 167 rows. The first column is compound Id for each row. I want to run a t.test for 3 column as one group and the other 3 groups as the second group, separately for each row. My code is as below…
leila aghili
  • 41
  • 1
  • 1
  • 4
2
votes
4 answers

paired t-test crashes apply-loop (edited)

In response to the helpful comments, I have edited the original question (where I had assumed that a for-loop and an apply-loop give different results). I am using R to run a large number of 2-group t-tests, using input from a delimited table.…
user900889
  • 75
  • 3
  • 8
2
votes
1 answer

Chi square tests for multiple columns in R

Here,I made data as follows: data<-data.frame(alzheimer=c(1,1,0,1,0,0,1,0,0,0), asthma=c(1,1,0,0,1,1,1,1,0,0), points=c(0,1,3,5,3,2,1,2,1,5), sex=c(1,1,0,0,0,0,1,1,1,0)) I want to know whether sex…
Lee
  • 369
  • 1
  • 6
2
votes
1 answer

How to apply a two sample proportion test to a pandas dataframe?

I'm trying to apply a z-test to every row of a pandas dataframe like so: from statsmodels.stats.proportion import proportions_ztest def apply_ztest(n1, n2, x1, x2): return proportions_ztest( count=[n1 , n2], nobs=[x1,…
goose
  • 2,502
  • 6
  • 42
  • 69
2
votes
1 answer

(Homework Question) alternative hypothesis argument

I apologize for the vague title, but I don't really know to explain it well cause I just don't understand what it is I'm supposed to do. Below is my code which I believe provides everything e (ii) asks for, but I don't know what to do for the alt…
redwoods
  • 59
  • 5
2
votes
1 answer

Test 80,000+ simulated normal distribution observation sets against a null hypothesis

I need to generate a random sample of size 200 (n=200) from a normal distribution with variance 1 and true mu (average) I specify; then, I test the draw against a hypothesis: mu <= 1. I need to do this for each of 400 potential true thetas, and for…
eades
  • 71
  • 7
2
votes
1 answer

Error code: insufficient values in manual scale

I am trying to run a hypothesis test using the following code: library(statsr) inference(x= sex, y = natheal, data = dataset, statistic = "proportion", type = "ht", method = "theoretical", alternative = "greater", success = "Too…
2
votes
2 answers

How to use hypothesis testing to compare groups

I have a data frame with name, type, and Turnover per game. A sample of that df is given below. Name Type Turnover per game kevin A 5 duke B 10 jonas A 12 angly A 2 anjelo B 10 wily A 4 nick …
user13419531
2
votes
1 answer

How to compute the confidence interval of the Difference in Differences method using Python?

I'm trying to analyze the total active minutes per user before and after an experiment. Here I've included the associated user data before and after the experiment - variant_number = 0 indicates control group while 1 means treatment group.…
2
votes
1 answer

Pytest: generating list of floats summing up to 1 with hypothesis

For a unit test, I would like to generate a list of float using the hypothesis library. There are some important constraints: The number of constituents within the list must be greater than 1 and less than 15 The minimum value must be greater than…
Andi
  • 3,196
  • 2
  • 24
  • 44
2
votes
0 answers

Checking if Frequentist approach is correct? Bayesian approach using MCMC for AB test. How to calculate Bayes Factors in Python?

I've been trying to get my head around Frequentist and Bayesian approaches for a toy data AB test problem. The results don't really make sense to me. I am struggling to understand the results, or whether I have computed them (in)correctly (which is…
mad-a
  • 153
  • 3
  • 11
2
votes
2 answers

pytest: monkeypatch while using hypothesis

Within a unit test, I'm using monkeypatch in order to change entries in a dict. from hypothesis import given, strategies test_dict = {"first": "text1", "second": "text2"} given(val=strategies.text()) def…
Andi
  • 3,196
  • 2
  • 24
  • 44
2
votes
2 answers

how to calculate pvalue for one tailed test in python?

One Population Proportion Research Question: In previous years 52% of parents believed that electronics and social media was the cause of their teenager’s lack of sleep. Do more parents today believe that their teenager’s lack of sleep is caused due…
1 2
3
23 24