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

How can I do a t-test between sub-set of data in dataframe in R?

I have a df1 like this: Stabr Area_name Score1 Score2 POVALL_2018 Score3 3 AL Autauga County 2 2 7,587 13.8 4 AL Baldwin County 2 2 …
Evan
  • 1,477
  • 1
  • 17
  • 34
0
votes
2 answers

.I want to do a pairwise.t.test of every column against every column in a dataframe

violin plots generated from data frame The numbers in each column represent localisation of signal relative to another signal inside nuclei of cells. There are 3 treatment conditions and 7 time points of treatment + 2 controls giving a total of 23…
SisiDI
  • 1
0
votes
1 answer

How to iterate a t-test in R with data that has more than two arguments or categorical variables?

I have dataset with comprises observations on a field, at 2 differents years (year1, year2), which compares 3 treatments (A, B, C). A long list of identical variables (var1, var2, var3... var20) was measured for each treatment for both…
Tom
  • 97
  • 7
0
votes
0 answers

What kind of test in R should I run to compare a factor to a number, and then factor to factor?

I have a factor of values, "Good" and "Bad" in the first column for both dataframes listed below: I have one dataframe that contains columns of 20 different numerics. I have a second dataframe that contains columns of 9 different factors. What I…
obizues
  • 1,473
  • 5
  • 16
  • 30
0
votes
0 answers

how to use a quoted string in a t_test function

I have a test datafile I would like to run a t test. This will work, which I already know t.test(df_test$clin_value ~ df_test$trt_variable) But I would like to do this: trt_var = "trt_variable" noquote(trt_var) # which gives me trt_variable why I…
cautree
  • 35
  • 7
0
votes
1 answer

Independent t-test with an aov-object in R

Is there a simple way to compute independent t-tests with an aov object, similar to how pairwise comparisons can be computed by pairs(emmeans(aov.object,~variable)?
0
votes
1 answer

Use group mean to conduct one-sample t.test across multiple groups

I'm interested in how results may differ when means are compared by using a two sample t-test as opposed to a one sample t-test from the same data. Two assessments where "counts" are sampled randomly from across multiple populations ("Group_ID")…
0
votes
2 answers

Un-paired t-test using data within one column

I want to do an unpaired t-test to examine if values differ between sites in each type category. So my question is, within types (AB or CD), do values (valueA or valueB) differ between sites (A or B)? Here is an example of my data: dat <-…
cgxytf
  • 421
  • 4
  • 11
0
votes
2 answers

How to divide a data frame into new data frames(like new data1,data2,data3 ..so on), so I can anaylsis each of them(like T-test)

I am just start learning R for data analysis. Here is my problem. I want to analyse the body weight(BW) difference between male and female in different species. (For example, in Sorex gracilliums, male and female body weight is significantly…
LiLily
  • 15
  • 4
0
votes
2 answers

R t-test 2 groups, 3 replicates each with multiple values to compare

I have three Samples (replicates) per Group. I want to use a T-test to compare values (MappedReadsCPM) between groups. However, I have 4000 values to compare sequentially (designated by PeakNumber). The following line is close, but it isn’t…
JVGen
  • 401
  • 3
  • 10
0
votes
1 answer

How do I perform a T-test from a dataframe?

I want to do a t-test for the means of hourly wages of male and female staff. `df1 = df[["gender","hourly_wage"]] #creating a sub-dataframe with only the columns of gender and hourly wage staff_wages=df1.groupby(['gender']).mean() #grouping the data…
Brytedata
  • 37
  • 1
  • 8
0
votes
1 answer

test for difference of means returns wrong result

I'm running the example of the R-intro manual: A = c(79.98, 80.04, 80.02, 80.04, 80.03, 80.03, 80.04, 79.97, 80.05, 80.03, 80.02, 80.00, 80.02) B = c(80.02, 79.94, 79.98, 79.97, 79.97, 80.03, 79.95, 79.97) t.test(A, B) Which produces the following…
Luke
  • 1,633
  • 3
  • 23
  • 37
0
votes
1 answer

Test if group means are statistically significantly different in R

*(I asked this question earlier, but it got migrated to stackexchange and was labeled 'unclear' and I couldn't edit it, so I'm going to try to clean up the question and make it more clear). I have the following data frame and need to determine if…
Bjorno
  • 119
  • 7
0
votes
1 answer

Use paired or unpaired t-test to determine whether the difference in temperature means is statistically significant?

I am doing an analysis on whether there is a meaningful difference between the temperature in June and December in Hawaii. I first identify the average temperature in June at all stations across all available years in the dataset. I did the same for…
ashton
  • 29
  • 3
0
votes
1 answer

Paired-T test error in R not all arguments have the same length

The following error is put out when I want to perform a paired t-test: t.test(materix_first_timepoint[,1], materix_second_timepoint[0,1], paired=TRUE) Error in complete.cases(x, y) : not all arguments have the same length This is the str of my…
ghs101
  • 103
  • 6