Handling missing data when plotting variability charts with multiple Ys and BY groups
| m1 | m2 | m3 | m4 | m5 | m6 | m7 | m8 | Device | Family |
| 1 | 2 | -2 | -1 | -3 | 2 | -1.5 | 0.5 | D1 | F1 |
| 2 | -2 | 2 | 3 | 2 | -1 | 1 | 2 | D2 | F1 |
| 1.5 | 2 | 2.5 | 2 | 0.5 | 1 | -1 | -1.5 | D3 | F1 |
| -1 | 1 | -1 | -1 | -0.5 | 1 | 0.5 | -1 | D4 | F1 |
| 2 | -3 | 1 | -2 | 1 | -2.5 | 0.5 | -1 | D5 | F1 |
| -3 | -0.5 | -1 | 1.5 | . | . | -1 | 1 | D6 | F2 |
| 2.5 | 1 | 0.5 | 1.5 | . | . | -0.5 | 2 | D7 | F2 |
I am going to use this table as an example. Assume that m1-m8 are some test parameters of some devices. In the actual table, the number of test parameters queried may be different. I want to plot variability charts using JSL for those parameters across Device for different Family.
In JSL, I did
myVC = Variability Chart(
invisible,
Y(Eval(parameterlist)),
X(:Device),
By(:Family)
);
I have grouped the parameters m1-m8 as parameterlist. However due to the missing data, the code would result in error when it tries to plot the charts for F2.
Is there a way to handle the missing data? I want JMP to still plot the variability charts for F2 for the parameters that have data. (m1,m2,m3,m4,m7,m8 in this case). After that I want JMP to display the variability charts by family and save it as a html report.
F1 - m1
.
.
F1 - m8 (Order in which variability charts are shown in the report)
F2 - m1
.
.
F2 - m8
Note that the number of test paramters, number of device and the number of different families may vary depending on the queries.
Re: Handling missing data when plotting variability charts with multiple Ys and BY groupsNice! Although I noticed that AsColumn in the variability chart doesnt seem to work for me. Changing it to Column (parameterlist[j]) worksRe: Handling missing data when plotting variability charts with multiple Ys and BY groupsXiangLoh,
You might want to review an earlier post
https://community.jmp.com/t5/Discussions/JSL-Generate-x-y-Plot-that-loops-through-columns-with-different/m-p/56020#M31438
The recommendations, I made there, I would apply to your data. Here are the steps/ pseudo code:
- create parameterlist (already done)
- Run, summarize( fgrp=By(:Family) ); the fgrp is the list of family values
- nw = New Window("Tests", vl = VListBox());
for( i=1, i<=nitems(fgrp), i++,
fam = fgrp[i];
for(j=1, j<=nitems(parameterlist), j++,
param = parameterlist[j];
idx = dt << get rows where(:Family == fam);
// compute the number of non-missing values for column(param)[idx]
// if that number is greater than 0 or some minimum you set then
myVC = dt << Variability Chart( invisible, Y ( AsColumn(param) ) , X(:Device), By(:Family), where(:Family==fam) );
get rid of the where where textbox and append to VL
); //end j
); //end i
This method gives you a lot of flexibility. You could save a different HTML for each family, or change the order and plot by variable then family. Instead of the code for the 2 commented steps, you could use a Try()
Try( myVC = dt << Variability Chart( invisible, Y ( AsColumn(param) ) , X(:Device), By(:Family), where(:Family==fam) );
// get rid of the where where textbox and append to VL
, //else do nothing
Show( "variable " || param || " for Family == " || fam || "has no valid data." )
);
It looks like a lot of work, but I have found that most scripters after they have done this once, and realize the amount of options this method offers, they use it often.
Good luck!