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
0 answers

Why is the mean of this random distribution 0?

According to the central limit theorem, when you take many samples, the distribution of the sample means center/average around the population mean, with standard deviation = pop standard dev / square root of sample size. The problem below is from an…
Kevin Lee
  • 321
  • 2
  • 8
0
votes
1 answer

independent sample t-test in R using test statistics (mean, std. dev, count)

Hi I am trying to do an independent sample t-test, but do not have full data, only summary statistics. Is there an R package where I can use the mean, standard deviation, and count for each sample?
Sophia
  • 99
  • 5
0
votes
1 answer

A good way for pairwise t-test for many rows? (R)

I'm writing a code that, from a table of raw data (output of microbiome QIIME analysis), generates a t-test per group of all the rows. Every row has a bacteria and the values corresponding for every sample. The table can be huge, like 80 columns per…
camcecc10
  • 47
  • 6
0
votes
1 answer

How do you efficiently perform millions of t-tests in Python?

Long story short, I need to perform several hundred million t-tests. I have two lists of samples, ys and ns, and I want to compare a sample from each list, so the first sample in ys will be compared to the first sample in ns and so on. The result…
user13867283
0
votes
1 answer

T test in r: How to change the x and y arguments of a t-test using a lapply function

I have this dataframe: I'm performing a t_test using this lapply approach: columns = colnames(my_data)[-1] my_t_test<-lapply(my_data[columns], function(x) t.test(x~my_data$Treatment,alternative='less')) But it seems the t_test take…
David López
  • 500
  • 5
  • 21
0
votes
1 answer

t-test on dataframe columns

Here is my dataframe: Id Tell Number 0 2 Perhaps 2 1 1 Yes 6 2 1 No 9 3 2 Yes 4 4 2 Yes 7 5 1 No 8 6 1 Yes 15 7 2 Perhaps 2 8 1 No …
yegu sanon
  • 39
  • 4
0
votes
1 answer

why doesn't the html table give me p-values and add -9 values? table1

I'm trying to make a table with several nominal values and a few logical values against a single nominal value using the "table1" package. I also want each column to include a p value. This code: table1(~ age + obese + low_income + married + HSless…
Joseph
  • 15
  • 7
0
votes
0 answers

T-test using two dfs in R

I am trying to run a t-test to determine if a column in one df is significantly different from a column in another df. I have two dfs, "block 1" and "block 2". I have tried this code: t.test(block1$Duration ~ block2$Duration, paired=FALSE,…
Lee Drown
  • 35
  • 2
  • 6
0
votes
2 answers

Error message when running a T-Test in R due to character variable

I have been trying to run a two side t-test in R but keep running into error. Below is my process flow, dataset details and script from R-studio. I used a dataset called LungCapacity that I downloaded from this website:…
Joe 5
  • 29
  • 7
0
votes
1 answer

Ttest_indResult(statistic=nan, pvalue=nan) error

I have the following command below: Townames = [] Notowns = [] def run_ttest(): for key,value in enumerate(data['RegionName']): if value in stateslist: indexing = data['differ'].iloc[key] …
Caledonian26
  • 727
  • 1
  • 10
  • 27
0
votes
2 answers

Loop t.test over columns in R

I have a numeric and several binary variables. I'd like to loop a ttest for each binary variable. Using library(boot) df <- nuclear both t.test(df$cost, df[6]) and t.test(df$cost, df$pr) give me the same result. However, If I want to loop it,…
0
votes
1 answer

R How to make working t.test command line into function?

I have a code line which works independently, but I am trying to make it into a function which does not work. Data set: cooper <- data.frame(preDist=c(2454, 2666, 2153, 2144, 2957, 2407, 2167, 2259, 1993, 2351, 1642,…
Herman
  • 25
  • 3
0
votes
1 answer

T-statistics calculated from bootstrapped standard error

May I ask does anyone know if there is a library for calculating t-statistics based on bootstrapped standard error instead of regular standard error in python? I have searched for so long but it seems there isn't anyone... Thank you in advance.
0
votes
1 answer

How to run t-test with subset of rows in R

Below is a part of my data (pairht_protein) I am trying to run t-test on all the variables (columns) between two groups which are: Resistant_group <- c(PAIR-01, PAIR-12, PAIR-09) Sensitive_group <- c(PAIR-07, PAIR-02, PAIR-05) Before I make a…
Chris Ahn
  • 13
  • 2
0
votes
0 answers

independentSamplesTTest returns Error in get(as.character(FUN), mode = "function", envir = envir)

I ran the following code in RStudio: library("lsr") df <- data.frame( rt = c(451, 562, 704, 324, 505, 600, 829), cond = factor(x=c(1, 1, 1, 2, 2, 2, 2), labels=c("group1", "group2"))) # Welch t-test independentSamplesTTest(rt ~…