Questions tagged [t-test]

Related to statistical hypothesis testing. Most software packages used for statistical analysis (including R) provide functions for performing the t-test. Use this tag for questions related to the t-test.

The t-test is also known as the "Student's t-test" after the pseudonym of its inventor. It is used for comparing the means of two samples, or the mean of one sample (or even parameter estimates) with a specified value. See the Wikipedia article for more details. Refer to the R documentation for details on the t.test function arguments and return values.

494 questions
0
votes
1 answer

T-test, anova, chi-square in R

1 2 y1 48 44 y2 38 39 y3 49 56 y4 3 4 y5 55 28 y6 99 101 y7 121 120 y8 2 6 1) Given this descriptive statistics where 1 and 2 are the outcome (Y = 1 or 2 ) and Y1 - Y8 are the variables, I want to perform independent t-test…
JParkDS
  • 19
  • 5
0
votes
1 answer

Parametric or Non-parametric group test for 5 different groups

Problem Statement - Statistically prove that 5 groups are same or different I am working on a problem with dataset size ~600,000. There are 5 groups say [A,B,C,D,E] and corresponding salaries with around ~100k observations per group. df['Salary']…
krksam19
  • 13
  • 3
0
votes
3 answers

For Loop t.test, Comparing Means by Factor Class in R

I want to loop a lot of one sided t.tests, comparing mean crop harvest value by pattern for a set of different crops. My data is structured like this: df <- data.frame("crop" = rep(c('Beans', 'Corn', 'Potatoes'), 10), "value" =…
A David
  • 48
  • 7
0
votes
0 answers

ttest_ind giving TypeError: unsupported operand type(s) for /: 'str' and 'int'

I have a dataframe that looks like: df: Method Success A 0.67 B 0.71 C 0.88 A 0.91 B 0.45 C 0.91 Code: t,p= stats.ttest_ind(group["Method"],group["Success"]) Output: TypeError:…
TjS
  • 277
  • 2
  • 5
  • 16
0
votes
0 answers

optimal sample size for control/test group for T-test

Recently we launched a feature on one of our website pages.I have all the historical data worth 6 months about the page including impressions and CTR .It has been 20 days since we launched the feature and now we want to know if there is any…
M_Nayak
  • 1
  • 3
0
votes
0 answers

T-test and importing data from columns

I am trying to conduct a T-test on two unequal samples using the following code. import pandas as pd import numpy as np from scipy import stats UG = pd.read_csv('Mostfrequentscores.csv') print('Mean', UG['Iceland'].mean()) print('Mean',…
MS.TO
  • 13
  • 2
0
votes
2 answers

R compare group to full sample

Sample data df <- data.frame("id"=c(1,2,3,4,5), "group"=c(0,0,1,1,1), "score"=c(10,14,15,13,12)) My goal is to compare the scores for group = 1 to the complete sample. I figured how to do the t test: t.test(df$score ~ df$group) But is this for…
bvowe
  • 3,004
  • 3
  • 16
  • 33
0
votes
1 answer

Is it possible to do a paired t-test is SAS using panel data?

I am working with paneldata that looks something like this: I am going to perform a t-test in SAS 9.4 to find out if there is a significant change in var1 from 2014 to 2016, and I am assuming that I have to use a paired t-test, since I have several…
BeeBee
  • 55
  • 6
0
votes
1 answer

dplyr t-test with "mu = greater than", by group

how can I run t-test with the mu-argument = "greater than" in dplyr, by group? here my data frame structure(list(Lattobacilli = c(6.39794000867204, 4.91381385238372, 7.7160033436348, 7.91907809237607, 6.6232492903979, 7.63346845557959,…
Spigonico
  • 137
  • 1
  • 10
0
votes
1 answer

How to perform t-test between two groups in pandas

My dataframe looks like this: exp itr res1 e01 1 20 e01 2 21 e01 3 22 e01 4 23 e01 5 24 e01 6 25 e01 7 26 e01 8 27 e02 . . e02 . . I have to split…
TjS
  • 277
  • 2
  • 5
  • 16
0
votes
1 answer

R: Independent t-tests for multiple by groups

I have a dataset named 'dat' with 5 columns: month; mean0; sd0; mean1; sd1. It looks like the following (but with numbers): month mean0 sd0 mean1 sd1 1 2 3 .. 48 I would like to use an independent (not paired) t-test to compare mean0 and…
eabc0351
  • 13
  • 1
0
votes
0 answers

how to test for difference between means and variances in r?

I have a model that has one continuous predictor and one categorical predictor. Is the code below, the correct way to test for a difference between the means and variances? short<-function(t) { str(t) print("model") …
Ray Tayek
  • 9,841
  • 8
  • 50
  • 90
0
votes
0 answers

T2 Hotelling in PCA - how to choose covariance matrix after dimensional reduction

I'm trying to use T-squared distribution (by hand) in my pca analysis. It's purpose is diagnostics after dimensional reduction. M=self.PCA_red.shape[1] N=self.PCA_red.shape[0] F=scipy.stats.f.ppf(0.95,M,N-M) self.T2lim=(M*(N-1)/(N-M))*F for i in…
Alex Max
  • 1
  • 1
0
votes
1 answer

How do I condense multiple lines of code for t-tests?

I am working on a simple dataset which is best analysed with t-tests, but there are at least 2 dozen t-tests, which creates a lot of lines of code and many tables! I was wondering if the there is a way to have one line of code that has all the…
Rachel
  • 41
  • 5
0
votes
1 answer

performing a T-test in R with categorical variables

Hey guys i am trying to do a t-test but it looks like something is wrong ... The data looks like: pot pair type height I 1 Cross 23,5 I 1 Self 17,375 I 2 Cross 12 I 2 Self 20,375 I performed the t-test as : …
Jens Wouters
  • 1
  • 1
  • 2