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
2
votes
1 answer

How to generate "Unbalanced" (unequal) factor levels in Base?

Background: I usually use gl() to generate "equal" number of factor levels for a set of random variables. For example, to generate 2 factor levels for 60 random variables in x, I use the following: x = rnorm(n = 60) groups = gl( 2, length(x)/2 ) ##…
rnorouzian
  • 7,397
  • 5
  • 27
  • 72
2
votes
3 answers

How to perform a t-test on variables within the same category on r?

I want to perform a t-test on mean age between men and women at time of arrest. However, my data is arranged like so: Sex: Age: M 21 F 31 F 42 M 43 Is there a way to separate the sex category into two separate categories (male and…
Eliza Paige
  • 21
  • 1
  • 3
2
votes
1 answer

Significance Testing in R

I am trying to determine whether there is a significant difference between two interfaces. I have a text file that looks like this: group conversion A 0 A 0 A 1 A 0 A 0 A 1 A 1 A 0 A 0 A 1 A 1 A 1 A 1 A 1 A 1 A 0 A …
Tibia Rook
  • 349
  • 1
  • 3
  • 9
2
votes
2 answers

R t.test() with data.frames as arguments

There is a question on CrossValidated, where someone gave two dataframes instead of two vectors to the t.test function: https://stats.stackexchange.com/questions/261830/t-test-or-wilcox-in-r-and-how-to-apply-to-dataframe-splitted-in-2-groups/ See…
Bernhard
  • 4,272
  • 1
  • 13
  • 23
2
votes
1 answer

What is the significance of t-stats value while applying ttest_ind on two pandas series?

what conclusion can be drawn from the resulting t-stats value When ttest_ind is applied on two independent series?
1
vote
1 answer

How can I convert two of my paired t.test results into a table in Microsoft Word?

I've tried to convert my results got from my paired t.tests into one table to Microsoft Word. However, I found no luck in doing so. Found errors such as 'Error: (converted from warning) package ‘flextable’ was built under R version 4.2.3'. I did…
1
vote
1 answer

How to split a continuous variable into multiple groups based on the categorical values in another column

I am new to R coding and I am trying to split column A into two different groups based on the results of categorical values given in the column "Outcome". Then I want to perform a t-test on them. The data looks like this: Column "A" = 4, 6, 8, 10,…
1
vote
0 answers

Combine multiple y-variables in a single bar plot after implementing t-test (unpaired)

The intent is to combine the numerical variables on a sigle plot of 2 by 2 or a single stack, with the x-axis being the "Treatments" factor. Each treatment in the barchart represents the different periods. Since there will be letters indicating…
1
vote
0 answers

R - Adding T-Test/Anova using dplyr summarise

I have a dataset which I would like to run a significance test based on the year. A sample of the dataset is as follows: df = structure(list(Index = c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16), Year =…
Luther_Proton
  • 348
  • 1
  • 7
1
vote
1 answer

Integrating the PDF of a t-distribution in R via integrate()

I am trying to replicate the t-test with mathematical formulas and it somehow wont work with may current attempt below: # PDF t-distribution: t_distr = function(x,df){ t_1 = gamma((df+1)/2)/(sqrt(df*pi)*gamma(df/2)) t_2 = (1 +…
1
vote
2 answers

Make a table with multiple t-tests

I have over 150 t-tests between different groups in a study (with only like 25 variables being significant) but I still need to list out all the results for my thesis appendix. Is there an easy way to combine each of the t-tests into 1 table? Also,…
1
vote
1 answer

Performing one sample t test with given mean and sd

I'm trying to perform a one sample t test with given mean and sd. Sample mean is 100.5 population mean is 100 population standard deviation is 2.19 and sample size is 50. although it is relatively simple to perfrom a t-test with a datasheet, I don't…
1
vote
2 answers

Performing the non-paired t-test column-wise in my data

When we have two 1-D arrays: import numpy as np import scipy.stats as stats a=np.array([0.36619718309859156, 0.32558139534883723, 0.3333333333333333, 0.3333333333333333, 0.2549019607843137, 0.3695652173913043, …
Amelia
  • 97
  • 8
1
vote
1 answer

how to run Two Proportion Z-Test if I run the test over entire population

I know Z test is applied for Test concerning two proportions. Let there be two treatments with population proportions p1 and p2 and sample sizes of n1 and n2 respectively. Samples associated with a certain event are x1 and x2 with the respective…
Exploring
  • 2,493
  • 11
  • 56
  • 97
1
vote
1 answer

report_text from report not working with lists in R

I want to report a couple of t-tests using report_text() from report. My tests are stored in a list. I'm able to report the tests outside the lists, but nothing that I do seems to work to unlist my tests and report them Works just fine: a <-…
Larissa Cury
  • 806
  • 2
  • 11