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

Performing t-test loop over columns in a dataframe: ERROR variables differ in length

I have an issue with performing a t-test over all columns of my dataframe. What I want to do? Each column represents a KPI of a certain research question. Moreover each column can be divided into two groups target = 1 and non-target = 0, defined in…
0
votes
1 answer

R: t.test multiple variables in dataframe with dplyr then summarise in table

Suppose I have this reproducible dataset: set.seed(949494) KPI1 <- round(runif(50, 1, 100)) KPI2 <- round(runif(50, 1, 100)) KPI3 <- round(runif(50, 1, 100)) ID <- rep(c("ID1", "ID2", "ID3", "ID4", "ID5", "ID6", "ID7", "ID8", "ID9", "ID10"), times =…
Smuts94
  • 49
  • 7
0
votes
1 answer

Multiple comparisons T-test function

I have the table with 9 columns, 8 of which presented by numeric data and last column is grouping variable with 3 categories. It looks like in example of the table below. data.frame(var1=rnorm(9), var2=rnorm(9), var3=rnorm(9),…
0
votes
2 answers

Using dplyr in function: Error when passing variable name

I am making a function to conduct a t-test (for multiple temperature variables called temp_). I want to make a function that passes var_name . For example, in the case of passing dataframe, I made a function below and it was successfully…
Take
  • 1
0
votes
1 answer

MICE: Paired sample t-test and cohen's d estimation using imputed datasets?

I've created 12 imputed samples using the MICE package and wish to run paired sample t-tests and cohen's d calculation using an imputed dataset but I'm not sure how to do this. My end goal is to compare parameter estimates, t-test results and effect…
0
votes
0 answers

Performing tests on a dynamically created variable inside a for loop in R

I have successfully created a dynamic variable inside a for loop. I want to perform a simple one sample ttest on the created variable. How do I do that within the loop/ dynamically? This is what I have written - for (i in 1:15) { # create a…
Nilima
  • 197
  • 1
  • 2
  • 9
0
votes
0 answers

Error while making t test - Problem selecting the variables

Im trying to do a t test between two means of a test of two groups but I have been unable to get a result. Im receieving this error Warning in is.na(y) : is.na() applied to non-(list or vector) of type 'language' Error: ! Can't combine…
0
votes
1 answer

T-test of gridded (3-D) data in Python

I have two sets of gridded (NetCDF) data with dimensions: Time, S-N, W-E and would like to do a t-test of paired values in time across the entire grid with Python. The computation should return decisions across the entire grid that can then be…
0
votes
2 answers

I have 6 matrices and I have to perform a t-test over cell values combined from the 6 matrices and store the p-value in a new matrix

Input: There are 6 input matrices of same dimensions 3 input matrices from normal tissues: GeneA GeneB GeneA 31 4 GeneB 5 8 GeneA …
0
votes
1 answer

Checking R code and this debug error: unexpected '}' in "}"

I just need some feedback on a very simple code I made, it's also saying Error: unexpected '}' in "}", and I wonder if this is a unicode issue? Any feedback would be appreciated!! My data is here: joint.sexdiff.csv I'm a really really new coder, and…
0
votes
1 answer

How to fix my t.test error message in R that has no missing value?

My data frame is the following : Df <- structure(list(SES = c("High", "High", "High", "Low", "High", "Low", "High", "High", "High", "Low", "Low", "Low", "High", "High", "Low", "High", "High", "Low", "High", "High", "Low", "High", "Low",…
0
votes
0 answers

excel result and stats test are not the same for p-value

I'm trying to get the same result from this excel table, indicating that there's a link between the wight and the result (after going to the gym) The result on the excel shows the p-value as 1.28% (for 2 tails) and 0.64% for 1 tail. Given weight =…
ProcolHarum
  • 721
  • 3
  • 17
0
votes
0 answers

Error running pairwise_t_test in R: x data are essentially constant

I posted this question a few days ago with no luck, so here we go again: I am trying to run a posthoc t-test on the following dataset: data.type <-…
ramateur
  • 41
  • 5
0
votes
1 answer

How can I apply 2 sample t-test to all columns in a R dataframe?

I have a dataframe consisting of multiple columns (each of them is a different variable) and the first column is the "Group", which indicates controls and patients. How can I perform 2-sample t-tests for all the columns (variables) based on the two…
0
votes
0 answers

R Shiny T-test returning error with reactive input

T.test function works in my Shiny app until I make one of the variables reactive then it returns Error:variable lengths differ (found for 'Group') output$t_test <- reactive({ t_test_result <- t.test(Age ~ Group, data,…