Features and functionality described on this page are available with our new Pro and Enterprise plans. Learn More... |
You can now run t-tests directly from Multiple Variables data tables in addition to the traditional Column table format. This gives you more flexibility in how you organize your data, especially when working with datasets that have multiple measured variables or complex experimental designs.
The t-test analysis itself hasn't changed - you get the same statistical tests, same options, and same results. What's different is:
•Data format: Your data is in the standard database or "tidy" format with rows as observations and columns as variables
•Variable assignment: A new Data tab in the analysis parameters dialog where you specify which variable contains your measurements, which defines your groups, and which identifies subjects (for paired designs)
•Flexibility: Easier to work with data from other programs or databases, and a more standard data format to access a range of analyses and data wrangling operations
There are many reasons to consider using the Multiple Variables data table for performing a t test (or related analysis). Factors to consider when choosing to use this data format:
•Use it as your default! The flexibility and standard data structure make this data organization both easy to work with and process
•Your data is already in database or spreadsheet format with one row per observation
•You're importing data from other statistical software, databases, or data collection systems
•You have multiple measured variables and want to run different analyses on the same dataset
•You're running multiple related analyses and want to keep all data in one table
•You prefer working with long-format data
When working with Multiple Variables tables, you can define your t-test in three ways, depending on how your data is organized:
Use this when you have:
•All measurements in one variable
•A separate column identifying which group each measurement belongs to
•Independent observations (unpaired design)
Example data structure:
SubjectID |
Blood_Pressure |
Treatment |
|---|---|---|
1 |
145 |
Control |
2 |
138 |
Control |
3 |
152 |
Control |
4 |
128 |
Drug |
5 |
132 |
Drug |
6 |
125 |
Drug |
Variable assignment:
•Response (Y): Blood_Pressure
•Grouping: Treatment
Use this when you have:
•Your two groups stored in separate columns
•Independent observations (unpaired design)
•Potentially different numbers of observations per group
Example data structure:
Control_BP |
Drug_BP |
|---|---|
145 |
128 |
138 |
132 |
152 |
125 |
148 |
|
Variable assignment:
•Response (Y): Control_BP AND Drug_BP (both assigned)
•Grouping: None
Use this when you have:
•All response measurements in one variable
•A separate column identifying which group each measurement belongs to
•Repeated measures from the same subjects (before/after, pre/post)
•Matched pairs that should be analyzed together
•A subject identifier linking the paired observations
Example data structure:
PatientID |
Blood_Pressure |
Timepoint |
|---|---|---|
P001 |
145 |
Before_treatment |
P002 |
138 |
Before_treatment |
P003 |
152 |
Before_treatment |
P004 |
148 |
Before_treatment |
P005 |
142 |
Before_treatment |
P001 |
132 |
After_treatment |
P002 |
128 |
After_treatment |
P003 |
141 |
After_treatment |
P004 |
135 |
After_treatment |
P005 |
129 |
After_treatment |
Variable assignment:
•Response (Y): Blood_Pressure
•Grouping: Timepoint
•Subject: PatientID
Use this when you have:
•Repeated measures from the same subjects (before/after, pre/post)
•Matched pairs that should be analyzed together
•A subject identifier linking the paired observations
Example data structure:
PatientID |
Before_Treatment |
After_Treatment |
|---|---|---|
P001 |
145 |
132 |
P002 |
138 |
128 |
P003 |
152 |
141 |
P004 |
148 |
135 |
P005 |
142 |
129 |
Variable assignment:
•Response (Y): Before_Treatment AND After_Treatment (both assigned)
•Subject: PatientID
•Grouping: None
The fundamental requirement of a t-test is that it compares exactly two groups. Prism will check this and show an error if:
•You have one response variable and a grouping variable with only 1 level (nothing to compare)
•You have one response variable and a grouping variable with 3 or more levels (use ANOVA instead)
•You assign more than 2 response variables
•You assign only 1 response variable with no grouping variable