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
1
vote
1 answer

How to run a paired t-test on different levels of a categorical variable?

I am trying to run a paired t-test on pre- and post-intervention results of three intervention types. I am trying to run the the test on each intervention separately using "subset" in t.test function but it keeps running the test on the whole…
Jazmin2252
  • 11
  • 2
1
vote
0 answers

How do I produce the correct Cohen's d estimate?

I am trying to replicate the result of an academic paper below to practice how to apply statistical methods in R. This is what the paper states: Pre- and postoutbreak differences in voter intentions. Across the 32 elections included in primary…
Stella Do
  • 11
  • 1
1
vote
1 answer

Matrix of t-test across vectors stored in one column of data.frame

I have a data.frame with two columns. One specifying a type, the other the performance associated with that type. DF <- data.frame(type = c(rep("A",25), rep("B",25),rep("C",25), rep("D",25)), performance = runif(100)) I want to…
Henning Piezunka
  • 255
  • 1
  • 3
  • 9
1
vote
1 answer

Conduct paired t-test for data in one column

I am trying to conduct paired t-tests for variables in one column Here is an example of my data: datexample <- data.frame( "time" = c("before","after"), "site" = c("A","B","B","A","A","B","B","A"), "valueA" = c("13","-10", "-5",…
cgxytf
  • 421
  • 4
  • 11
1
vote
1 answer

R code for unpaired t-test across multiple columns

I am looking to adjust the p-value (fdr method) in the following code: >lstOut <- combn(unique(df1$ATTRIBUTE_Group), 2, FUN = function(x) {+ dat1 <- subset(df1, ATTRIBUTE_Group == x[1])+ dat2 <- subset(df1, ATTRIBUTE_Group == x[2])+ Map(function(x,…
lst22
  • 97
  • 7
1
vote
1 answer

R code for unpaired t-test with multiple groups & multiple traits

Suppose I had the following…
lst22
  • 97
  • 7
1
vote
0 answers

Simulation to visualize power does not predict built-in power functions

I built a shiny web APP with a nice interface to calculate sample size needed to differentiate between test groups. I wanted to build a simulation that visualizes how power works, my understanding is that power is the probability of differentiating…
1
vote
1 answer

T-test by multiple factors

I have a data frame in which I have one single variable and multiple factor columns. It looks like…
1
vote
2 answers

R Function to get Confidence Interval of Difference Between Means

I am trying find a function that allows me two easily get the confidence interval of difference between two means. I am pretty sure t.test has this functionality, but I haven't been able to make it work. Below is a screenshot of what I have tried so…
bmb
  • 361
  • 2
  • 13
1
vote
0 answers

java double sided Welch's t test

I have to implement the Welch's t test myself. To test my code I took the samples from Wikipedia as well as comparing custom examples with two different online calculators: https://en.wikipedia.org/wiki/Welch%27s_t-test…
Flova
  • 65
  • 6
1
vote
2 answers

calculate multiple t-tests for all the combinations of 2 list elements in R tidyverse environment

I am looking for a way to calculate multiple t-tests for all the combinations of 2 list elements in R tidyverse environment. I would like to test the means of Miles/(US) gallon based on Transmission for each combination of cyl and vs. My working…
Hamideh
  • 665
  • 2
  • 8
  • 20
1
vote
1 answer

Sample t-test in Matlab

In Matlab I have to generate two Gaussian random samples with distributions: N(100,5) N(115,15) Then run the simulation 1,000 times and compute how many times the null hypothesis was rejected out of 1,000 times for each sample sizes scanning from…
FunnyBuzer
  • 313
  • 2
  • 14
1
vote
2 answers

R - fast two sample t test

I would like to perform a two sample t test in R using separate groupings. The t.test must be "unbiased", meaning that for all transactions in the outer group (group 2 below), the T test must be run for each inner group (group 1 below) like: "inner…
enmyj
  • 371
  • 4
  • 14
1
vote
1 answer

How to apply t-test for groups by dates in R?

Sorry i am new in R and really need guidance for this: I have a dataset like this: date CVDadmissions 2001.04.01 22 2001.04.02 26 2001.04.03 27 2002.04.01 22 2002.04.02 23 2002.04.03 25 2003.04.01 27 2003.04.02 …
hasan arshad
  • 41
  • 2
  • 6
1
vote
1 answer

two sided t-test in pandas

If I have a df like this: normalized_0 normalized_1 normalized_0 mean std Site 0 NaN 0.798262 1.456576 0.888687 0.118194 1 0.705540 0.885226 NaN …
prog2de
  • 309
  • 2
  • 11