cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Browse apps to extend the software in the new JMP Marketplace
Choose Language Hide Translation Bar
BigScientist
Level I

How to create a linear regression graph from this table?

I have a table like this:

Patient        Drug        Result
Patient 1      Drug A      15.0
Patient 1      Drug B      5.2
Patient 2      Drug A      13.1
Patient 2      Drug B      6.0
Patient 3      Drug A      14.5
Patient 3      Drug B      5.0

 

I basically want to create a linear regression between Drug A and Drug B using all my patient samples. My actual table is a bit more complicated - for example, I have some patients and drugs that I don't want to include. How do I set this graph up in JMP?

1 ACCEPTED SOLUTION

Accepted Solutions
BigScientist
Level I

Re: How to create a linear regression graph from this table?

These weren't the solutions I was looking for and I sincerely apologize for not being clearer. My issue was that I didn't know how to put split the numerical data and put each drug on the X and Y axis against each other...without manually copying the data to create a new table. My actual table comes from thousands of .csv files with hundreds of columns. I finally figured it out on my own, however.

 

As you can see in my screenshots, all I needed to do was to use the Tables>Split function. 

 

screenshot0.jpgscreenshot1.jpg

View solution in original post

3 REPLIES 3
txnelson
Super User

Re: How to create a linear regression graph from this table?

txnelson_1-1730251317246.pngtxnelson_2-1730251440124.png

Or you could use the Fit Y by X platform and compare the 2 drugs

txnelson_0-1730254773304.png

It is not possible to perform a linear regression on the data since there is not a defined numerical measurement used to define the difference between Drug 1 and Drug 2.  Some statistical camps might suggest setting drug A to 0 and drug B to 1, however I believe what you really want is to know if there is a statistical difference between the drugs.  The Oneway Analysis will show if there is a statistical difference.

Jim
MRB3855
Super User

Re: How to create a linear regression graph from this table?

Hi @BigScientist : Adding to @txnelson  suggestion, be careful here. The two drugs are not independent (requirement for 1-way ANOVA). i.e., Patient 1 took both, patient 2 took both, and patient three took both. So, it is  the within patient comparison that is appropriate here. This is a paired t-test.   You can do this via Matched Pairs, or Fit Model. If your data is organized as above, the Fit Model with  Result as "Y" and Patient and Drug as Model Effects will do the trick. And set Patient as Random (highlight Patient then click on Attribute and choose Random Effect). 

 

BigScientist
Level I

Re: How to create a linear regression graph from this table?

These weren't the solutions I was looking for and I sincerely apologize for not being clearer. My issue was that I didn't know how to put split the numerical data and put each drug on the X and Y axis against each other...without manually copying the data to create a new table. My actual table comes from thousands of .csv files with hundreds of columns. I finally figured it out on my own, however.

 

As you can see in my screenshots, all I needed to do was to use the Tables>Split function. 

 

screenshot0.jpgscreenshot1.jpg