 

Abstract:
This article demonstrates how to generate probability
plots for more than one variable on the same
graph using Statit Custom QC. It will be necessary
to use Statit commands rather than the Probability
Plot Dialog Box.
Products:
Statit
e-QC, Statit
e-Server, Statit
Custom QC
Probability plots are usually used show whether
the data approximates a normal distribution,
which can be an important assumption in many
statistical analyses. The Probability Plot dialog
box in Statit can be used to generate plot for
a single variable. You can find the Probability
Plot dialog box in Statit products by choosing:
Graphics -> Distribution Plots
It is also possible to customize a probability
plot graph to include more than one plot, however,
it is necessary to use Statit commands in the
operation. If you are new to Statit commands,
please do continue reading. I have tried to
show the "natural" language behind
the Statit commands.
Generating the First Plot Using Statit Command
Language
This example shows the steps to getting two
variables onto the same probability plot. I
began by opening an example data file that Statit
Software ships with Statit using the command:
getfile
qc.wrk /begin
This commands gets the file "qc.wrk"
and begins a new workspace by clearing any data
that may already have been entered.
Then, I decided to omit for all variables cases
19, 54,58 and 99. These cases have extreme values
that only confuse this probability plot example,
but in real life you probably don't want to
omit information with out good cause. I used
the command:
omit
all (19,54,58,99)
After I got the data into good shape for this
example, I used the command:
gprob
Pressure /notest /noref /xname=""
/xmin=75 /xmax=150 /nodraw
to graph a probability plot of the variable
Pressure. I decided on no normality test, no
reference line, and no x-axis name. I set the
x-axis minimum and x-axis maximum values at
75 and 150, respectively. I decided to not draw
the graph until later.
Because I am going to put more than one plot
on the graph, I thought it was a good idea to
build a legend. So, I used the command:
xy
1 /color=Red /legend="Pressure"
to be sure the plot elements in the xy1 space
were red in color and the legend was labeled
"Pressure".
Calculating Z-scores of Cumulative Probability
Values for the Second Plot
Now I needed some help. So I asked a local
statistician about probability plots. She told
me that a probability plot is a plot of the
cumulative probabilities of the observation
values for each case. Not only that, but, for
normally distributed observations a plot of
the z-scores of the cumulative probabilities
results in a more or less straight line. And
that is what Statit generates. So, I knew that
I needed to calculate cumulative probabilities
for the second variable and then calculate z-scores
for the cumulative probabilities in order to
get a second plot on the graph.
Seemed like a lot of work to me, but I did
it anyway. The formula for cumulative probability
is R/n+1, where R is the ordinal number which
indicates each cases relative position in the
ordered set of all cases, and, n+1 is the total
number of cases plus one.
The command:
rank
Width into rWidth
is used to calculate a new variable called
rWidth by ranking Width.
I also calculated the cumulative probabilities
as the new variable rt2 by dividing rWidth by
the number of cases in (rWidth) plus 1 (n+1).
The command looks like:
let
rt2 = rWidth/(case(rWidth)+1)
The z-score is also called the inverse of the
standard normal distribution. So the command:
let
z2 = invn(rt2)
directly calculates the z-scores of rt2 and
saves them in the new variable z2.
Drawing the Second Plot and Creating the
Graph
Once I got the statistics out of the way, all
I had to do was to tell Statit to get another
plot on the graph, add a legend and draw everything.
This took three commands. First, the command:
xy
3 Width z2 /color=Violet /legend="Width"
plotted Width along the x-axis and the z-scores
in z2 on the y-axis. The color and legend subcommands
are the same as before. With the command:
legend
/display=column /location=980 749 /anchor=rc
The legend was displayed as a column with the
right center anchor point at the grahp space
location 980 749.
Finally, I used the command draw to draw all
of the elements, the separate plots and legend,
all at once.
And the plot ...

Gathering All of the Commands in One Spot
These are all of the commands I used in the
order I used them to generate two probability
plots on the same graph.
getfile
qc.wrk /begin
omit all (19,54,58,99)
gprob Pressure /notest /noref /xname=""
/xmin=75 /xmax=150 /nodraw
xy 1 /color=Red /legend="Pressure"
rank Width into rWidth
let rt2 = rWidth/(case(rWidth)+1) (cum prob)
let z2 = invn(rt2)
xy 3 Width z2 /color=Violet /legend="Width"
legend /display=column /location=980 749 /anchor=rc
draw
If you have Statit Custom QC and aren't familiar
with Statit macros, all they are is a "gathering
of the commands." Copy these commands into
a the Macro Editor (File->Macros->Editor)
and click apply. Or copy them into a plain text
(ASCII) editor like Notepad, save the file on
your desktop as 2ProbPlots.stc and use the lightening
bolt icon
to run the combined commands as a macro.
A Few Warnings
I cheated on this plot be making sure the first
gprob command generated a x-axis wide enough
to accommodate both Width and Pressure data.
If you aren't careful, a second plot will be
generated but you will never see it because
it ends up outside the space defined in the
graph range.
Second, good programming protocol would normally
have me cleaning up all of the intermediate
variables I calculated. I left them in the dataspace
so that the curious among you could look at
the intermediate results.
If you would like additional information, please
call our Support staff at (541) 752-4100 or
send email to
.
|