cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Try the Materials Informatics Toolkit, which is designed to easily handle SMILES data. This and other helpful add-ins are available in the JMP® Marketplace
Choose Language Hide Translation Bar
jacaalgo
Level II

Can the amount of jittering be customized?

Can anyone tell me if jittering is customizable? how do I do it?  Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
efriedman
Level I

Re: Can the amount of jittering be customized?

For scatter plots you can create a formula column with a jittered version of the actual variable.  I generally add a multiple of a random uniform and try various multipliers until I find one that looks good.


However, one cannot then draw regression lines through the jittered data.  To do that one might be able to create two separate graphs, one with the regression lines and hidden data and one with the jittered data.  I don't know whether you could overlay them in JMP but you could very carefully overlay them in something like PowerPoint.  Maybe someone can suggest a simpler way.

View solution in original post

5 REPLIES 5
yvesa_roy
Level II

Re: Can the amount of jittering be customized?

Hi,

this is not a response but another question : why, in graph builder, is it possible to define some form of jittering for dot plots (only 1 semi-continuous variable) and not (at least JMP Pro 11.1) for a scatter-plot, where jittering is the most useful?

Sunflowers will be very useful too. Just see what SPSS can do about that.

Yves Roy, France

efriedman
Level I

Re: Can the amount of jittering be customized?

For scatter plots you can create a formula column with a jittered version of the actual variable.  I generally add a multiple of a random uniform and try various multipliers until I find one that looks good.


However, one cannot then draw regression lines through the jittered data.  To do that one might be able to create two separate graphs, one with the regression lines and hidden data and one with the jittered data.  I don't know whether you could overlay them in JMP but you could very carefully overlay them in something like PowerPoint.  Maybe someone can suggest a simpler way.

yvesa_roy
Level II

Re: Can the amount of jittering be customized?

I already use the first solution for jittering but I would prefer something simpler to use. And, for the sunflowers,  there is a solution for SAS/Graph in Michael Friendly's SAS System for statistical graphics that I've been using since 1992.

For the overlay of jittered points and a regression or loess line, there is a simpler way for the Y axis only : put the unjittered and jittered y variables on the Yaxis, send the unjittered to the right Y axis, then remode the line for the left variable and the points for the right one. But I did'nt find yet a simple solution for the X axis.

Thanks anyway.

karenb
Level II

Re: Can the amount of jittering be customized?

I got it to work as follows.

Problem: X & Y in original dataset have a lot discretization so there are occluded points.

Goal:  display the data with jitter in X and  Y but do the line-fit on the original data

Ex:  Original Dataset has N=6, notice repeating values of X & Y

Y         X            

50        1           

80        2        

80        2          

90        2           

150      8          

150      8      

   

Procedure

1.Double the number of rows, adding new rows at the bottom of the dataset equal in number to the number of rows in the original dataset. In this case, add 6 rows.

2.Create new X' and Y' columns using formulas shown at bottom to repeat the original data but also have additional rows which are off by a random jitter from the original X using 1/20th (or some other fraction) of the sd of the various data points.  Create new Group column to denote whether X' and Y' contain original or jittered results.  (Instead of capturing the 1/20 jitter multiplier in the formulas you could also create a table variable so it is easier to change the multiplier on the fly.)

Y         X             Group            X'          Y'

50       1            original           1           50

80       2            original           2           80

80       2            original           2           80

90       2            original           2           90

150      8           original           8           150

150      8           original           8           150

                           jittered      0.8675       47.178279975

                           jittered      2.0640       79.698789972

                           jittered      2.0296       79.164367702

                           jittered      2.0775       92.320672901

                           jittered      7.9297      150.14705263

                           jittered      7.7895      151.34309192

3.Hide the first 6 rows where X is not empty (not sure how to do this with a formula).  Exclude the second 6 rows where X is empty (same comment).

4.Plot Y' by X' and fit a line. Turn automatic recalc on so that you can play around with the formulas and see the effect on the line. Voila', you see only the jittered data but the line-fit is based only on the non-jittered data.

It seems you could script this and give the user dynamic control over the jittering:

script could take the original dataset and copy it to a new temp table, perform the function that I did manually to the table (double the rows, add X' and Y', do the hiding and excluding), fit a line, and give the user a way to control the multiplier used in the jitter width (I used 1/20 of orignal StdDev as the new jitter Std Dev) using a slider that sits beneath the graph and controls a constant that is used in the temp table dataset.

Formulas used:

Group = If( Is Missing( :X ), "jittered", "original")

X'  = If( Is Missing( :X ),   :X[Row() - Col Number( :X ), Empty()]     +     Random Normal() * (Col Std Dev( :X ) / 20),     :X)

Y'  = If( Is Missing( :Y ),     :Y[Row()  - Col Number( :Y ), Empty()]     +   Random Normal() * (Col Std Dev( :Y ) / 20),     :Y)

ms
Super User (Alumni) ms
Super User (Alumni)

Re: Can the amount of jittering be customized?

If using Graph Builder there may not be necessary to change the data table. In JMP 11 it's possible to add local custom transforms directly in the Graph Builder control panel.

To jitter X just right-click on the variable and select Formula..., enter an adequate transformation and and click Apply or OK to create the local variable (i.e. it can be used as a normal variable in Graph Builder but is not added to the data table). Drag both X's to the X-axis field and select points for the jittered transform and Line of Fit for the original X.

Here's the JSL version applied to KarenB's example table:

Graph Builder(

  Variables(

  X( :X ),

  X(

  Transform Column(

  "Jittered X",

  Formula( :X + Random Normal() * Col Std Dev( :X ) / 20 )

  ),

  Position( 1 )

  ),

  Y( :Y )

  ),

  Elements(

  Line Of Fit(

  X( 1 ),

  Y,

  Legend( 5 ),

  Confidence of Fit( 1 ),

  Degree( "Linear" ),

  ),

  Points( X( 2 ), Y, Legend( 6 ) )

  )

)