cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Check out the JMP® Marketplace featured Capability Explorer add-in
Choose Language Hide Translation Bar

Paired t-test on long format table

Hi,

I am rather new to JMP so perhaps I am missing something obvious.

I would like to run a paired t-test. I made a toy dataset with 8 cases and 2 columns: one "before" and one "after". Running a paired t-test on this wide format data is no problem: Analyze -> Specialized Modeling -> Matched Pairs and give both columns as "Y" inputs. Easy!

 

My "wide format" toy data:

RankBarracuda15_0-1711677090178.png

 

But can I do the same thing with the data in a long format? It's the same data but now there is a "condition" column with "before" and "after" values, and a "name" column (for example) that encodes the pairing of values. The same data in long format looks like this:

RankBarracuda15_2-1711677426755.png

 

I understand that I could just manually turn this into a broad format table. But this becomes tedious if there are multiple variables (i.e.: imagine if there is not just "feature" but "feature1", "feature2", etc).

 

Is it possible to run a paired t-test directly on this long format?

 

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: Paired t-test on long format table

I do not see an option to perform a matched t test in a long format.  However, you do not have to manually move the data.  You can simply use the Split Platform to  do that.

Given your data table

txnelson_0-1711682194494.png

Go the Split Platform     Tables=>Split

txnelson_2-1711682363596.png

Fill in the Split By, Split Columns and Group boxes, and Click OK and a new transformed data table will be created.

You then can run the Matched Pairs

txnelson_3-1711682548697.png

There is an old school method for performing the Matched Pairs analysis by using Anova.  If you run Fit Model, and specify both the Condition and Name as factors

txnelson_0-1711683085864.png

You will get the same result.

txnelson_1-1711683187883.png

F = t squared

F= 4.8752 = -2.208^2 = t

Of course you don't get the nice graphics of the Matched Pairs t-test Platform

 

 

Jim

View solution in original post

6 REPLIES 6
txnelson
Super User

Re: Paired t-test on long format table

I do not see an option to perform a matched t test in a long format.  However, you do not have to manually move the data.  You can simply use the Split Platform to  do that.

Given your data table

txnelson_0-1711682194494.png

Go the Split Platform     Tables=>Split

txnelson_2-1711682363596.png

Fill in the Split By, Split Columns and Group boxes, and Click OK and a new transformed data table will be created.

You then can run the Matched Pairs

txnelson_3-1711682548697.png

There is an old school method for performing the Matched Pairs analysis by using Anova.  If you run Fit Model, and specify both the Condition and Name as factors

txnelson_0-1711683085864.png

You will get the same result.

txnelson_1-1711683187883.png

F = t squared

F= 4.8752 = -2.208^2 = t

Of course you don't get the nice graphics of the Matched Pairs t-test Platform

 

 

Jim

Re: Paired t-test on long format table

Thanks a lot, Jim!

I confirmed the Split By function. More importantly, I confirmed that even if you have several features (feature1, feature2, etc), the Split By function will split all of them (into for example "feature1 before", "feature1 after", "feature2 before", "feature2 after", etc). Then, you can run the paired t-tests on those columns.

 

I accepted this as the solution, although - as you also wrote - there is probably no way to directly run the pairwise t-tests on the long format table.

Re: Paired t-test on long format table

@RankBarracuda15 -

Here is a way to run the analysis on the tall table using Fit Y by X. In this case, use Data as Y, Label as X, and Name as the Block:
scott_allen_0-1711729318107.png

 

The summary statistics are the same, but the reports are different.

scott_allen_2-1711729587067.png

 

 

 

-Scott
MRB3855
Super User

Re: Paired t-test on long format table

Hi @RankBarracuda15 : And to extend @txnelson 's "old School" method, it can be generalized to include a wider class of of problems: What if you have more than 2 conditions? Old School. Multiple, balanced or unbalanced, reps across condition*name combinations? Old School. And, strictly speaking, the "old school" method should  have "name" as a random effect. But in the simpler case such as you have, it doesn't really matter.       

Re: Paired t-test on long format table

Just to add that you can also add a new column that computes the difference (After - Before) and use this result as your response.

MRB3855
Super User

Re: Paired t-test on long format table

Yup @RankBarracuda15 , as @Mark_Bailey said, then just use the distribution platform.