In case you're wondering, Parisse is the brains behind the CAS that HP uses for Prime. I think the rest of the Prime mostly comes HP.
I hope HP does put in an easy to use GUI for the probability distributions. If they do, I'm sure it will look much more professional than mine, but in the mean time, feel free to use the following. I've added the rest of the continuous distributions and put in easy to edit strings so that you can put in whatever descriptions you prefer. (I want to eventually do the same for the discrete distributions, but right now in my stats class, I'm covering topics related to continuous distributions, so that's what's on my mind.)
Code:
#pragma mode( separator(.,;) integer(h64) )
// Probability Distribution UI
// local but persistent
LOCAL x=0, x2=1, mu=0, sigma=1, area=0.05, tail=1;
LOCAL df=30, ddf=30;
// strings
sLeft = "left tail";
sRight = "right tail";
sInner = "inner interval";
sOuter = "outer tails";
sCanceled = "canceled";
sInvalidTail = "invalid tail";
// label strings
lblMean = "Mean:";
lblStdDev = "StdDev:";
lblX = "X:";
lblX1 = "X1:";
lblX2 = "X2:";
lblDF = "df:";
lblNDF = "Num df:";
lblDDF = "Den df:";
lblArea = "Area:";
lblTail = "Tail:";
// help strings
hMean = "mean of the distribution";
hStdDev = "standard deviation of the distribution";
hX = "independent variable x";
hX1 = "left x";
hX2 = "right x";
hDF = "degrees of freedom";
hNDF = "numerator degrees of freedom";
hDDF = "denominator degrees of freedom";
hArea = "area (probability)";
hTail = "left tail, right tail, inner interval, or outer tails area";
//////////////////////////////////////////////////////////////////////////////////////////
// Normal PDF
//////////////////////////////////////////////////////////////////////////////////////////
EXPORT NormalPDF()
BEGIN
LOCAL status;
status:=INPUT(
{
{mu,[0],{20,50,0}},
{sigma,[0],{20,50,1}},
{x,[0],{20,50,2}}
},
"Normal PDF",
{lblMean,lblStdDev,lblX},
{hMean,hStdDev,hX}
);
IF status==0 THEN
RETURN sCanceled;
END;
RETURN NORMALD(mu, sigma, x);
END;
//////////////////////////////////////////////////////////////////////////////////////////
// Normal CDF
//////////////////////////////////////////////////////////////////////////////////////////
EXPORT NormalCDF()
BEGIN
LOCAL status;
status:=CHOOSE(tail,"Normal CDF Tail",sLeft,sRight,sInner,sOuter);
IF status==0 THEN
RETURN sCanceled;
END;
CASE
// left
IF tail==1 THEN
status:=INPUT(
{
{mu,[0],{20,50,0}},
{sigma,[0],{20,50,1}},
{x,[0],{20,50,2}}
},
"Normal CDF Left Tail",
{lblMean,lblStdDev,lblX},
{hMean,hStdDev,hX}
);
IF status==0 THEN
RETURN sCanceled;
END;
RETURN NORMALD_CDF(mu, sigma, x);
END;
// right
IF tail==2 THEN
status:=INPUT(
{
{mu,[0],{20,50,0}},
{sigma,[0],{20,50,1}},
{x,[0],{20,50,2}}
},
"Normal CDF Right Tail",
{lblMean,lblStdDev,lblX},
{hMean,hStdDev,hX}
);
IF status==0 THEN
RETURN sCanceled;
END;
RETURN NORMALD_CDF(-mu, sigma, -x); // 1-NORMALD_CDF(mu, sigma, x)
END;
// inner
IF tail==3 THEN
status:=INPUT(
{
{mu,[0],{20,50,0}},
{sigma,[0],{20,50,1}},
{x,[0],{20,50,2}},
{x2,[0],{20,50,3}}
},
"Normal CDF Inner Interval",
{lblMean,lblStdDev,lblX1,lblX2},
{hMean,hStdDev,hX1,hX2}
);
IF status==0 THEN
RETURN sCanceled;
END;
RETURN NORMALD_CDF(mu, sigma, x, x2);
END;
// outer
IF tail==4 THEN
status:=INPUT(
{
{mu,[0],{20,50,0}},
{sigma,[0],{20,50,1}},
{x,[0],{20,50,2}},
{x2,[0],{20,50,3}}
},
"Normal CDF Outer Tails",
{lblMean,lblStdDev,lblX1,lblX2},
{hMean,hStdDev,hX1,hX2}
);
IF status==0 THEN
RETURN sCanceled;
END;
RETURN NORMALD_CDF(mu, sigma, x)+NORMALD_CDF(-mu, sigma, -x2); //1-NORMALD_CDF(mu, sigma, x, x2)
END;
DEFAULT RETURN sInvalidTail;
END;
END;
//////////////////////////////////////////////////////////////////////////////////////////
// Normal Inverse CDF
//////////////////////////////////////////////////////////////////////////////////////////
EXPORT NormalInv()
BEGIN
LOCAL status;
status:=INPUT(
{
{mu,[0],{20,50,0}},
{sigma,[0],{20,50,1}},
{area,[0],{20,50,2}},
{tail,{sLeft,sRight,sInner,sOuter},{20,25,3}}
},
"Normal Inverse CDF",
{lblMean,lblStdDev,lblArea,lblTail},
{hMean,hStdDev,hArea,hTail}
);
IF status==0 THEN
RETURN sCanceled;
END;
CASE
// left
IF tail==1 THEN RETURN NORMALD_ICDF(mu,sigma,area); END;
// right
IF tail==2 THEN RETURN -NORMALD_ICDF(-mu,sigma,area); END; // NORMALD_ICDF(mu,sigma,1-area)
// inner
IF tail==3 THEN RETURN {NORMALD_ICDF(mu,sigma,(1-area)/2),-NORMALD_ICDF(-mu,sigma,(1-area)/2)}; END // NORMALD_ICDF(mu,sigma,(1+area)/2)
// outer (2 tail)
IF tail==4 THEN RETURN {NORMALD_ICDF(mu,sigma,area/2),-NORMALD_ICDF(-mu,sigma,area/2)}; END // NORMALD_ICDF(mu,sigma,1-area/2)
DEFAULT RETURN sInvalidTail;
END;
END;
//////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////
// Student-t PDF
//////////////////////////////////////////////////////////////////////////////////////////
EXPORT StudentPDF()
BEGIN
LOCAL status;
status:=INPUT(
{
{df,[0],{20,50,0}},
{x,[0],{20,50,1}}
},
"Student-t PDF",
{lblDF,lblX},
{hDF,hX}
);
IF status==0 THEN
RETURN sCanceled;
END;
RETURN STUDENT(df, x);
END;
//////////////////////////////////////////////////////////////////////////////////////////
// Student-t CDF
//////////////////////////////////////////////////////////////////////////////////////////
EXPORT StudentCDF()
BEGIN
LOCAL status;
status:=CHOOSE(tail,"Student-t CDF Tail",sLeft,sRight,sInner,sOuter);
IF status==0 THEN
RETURN sCanceled;
END;
CASE
// left
IF tail==1 THEN
status:=INPUT(
{
{df,[0],{20,50,0}},
{x,[0],{20,50,1}}
},
"Student-t CDF Left Tail",
{lblDF,lblX},
{hDF,hX}
);
IF status==0 THEN
RETURN sCanceled;
END;
RETURN STUDENT_CDF(df, x);
END;
// right
IF tail==2 THEN
status:=INPUT(
{
{df,[0],{20,50,0}},
{x,[0],{20,50,1}}
},
"Student-t CDF Right Tail",
{lblDF,lblX},
{hDF,hX}
);
IF status==0 THEN
RETURN sCanceled;
END;
RETURN STUDENT_CDF(df, -x); // 1-STUDENT_CDF(df, x)
END;
// inner
IF tail==3 THEN
status:=INPUT(
{
{df,[0],{20,50,0}},
{x,[0],{20,50,2}},
{x2,[0],{20,50,3}}
},
"Student-t CDF Inner Interval",
{lblDF,lblX1,lblX2},
{hDF,hX1,hX2}
);
IF status==0 THEN
RETURN sCanceled;
END;
RETURN STUDENT_CDF(df, x, x2);
END;
// outer
IF tail==4 THEN
status:=INPUT(
{
{df,[0],{20,50,0}},
{x,[0],{20,50,2}},
{x2,[0],{20,50,3}}
},
"Student-t CDF Outer Tails",
{lblDF,lblX1,lblX2},
{hDF,hX1,hX2}
);
IF status==0 THEN
RETURN sCanceled;
END;
RETURN STUDENT_CDF(df, x) + STUDENT_CDF(df, -x2); // 1-STUDENT_CDF(df, x, x2)
END;
END;
END;
/////////////////////////////////////////////
// Student-t Inverse CDF
/////////////////////////////////////////////
EXPORT StudentInv()
BEGIN
LOCAL status, t;
status:=INPUT(
{
{df,[0],{20,50,0}},
{area,[0],{20,50,1}},
{tail,{sLeft,sRight,sInner,sOuter},{20,25,2}}
},
"Student-t Inverse CDF",
{lblDF,lblArea,lblTail},
{hDF,hArea,hTail}
);
IF status==0 THEN
RETURN sCanceled;
END;
CASE
// left
IF tail==1 THEN RETURN STUDENT_ICDF(df,area); END;
// right
IF tail==2 THEN RETURN -STUDENT_ICDF(df,area); END;
// inner
IF tail==3 THEN
t:=STUDENT_ICDF(df,(1-area)/2);
RETURN {t,-t};
END
// outer (2 tail)
IF tail==4 THEN
t:=STUDENT_ICDF(df,area/2);
RETURN {t,-t};
END
DEFAULT RETURN sInvalidTail;
END;
END;
//////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////
// Chi Square PDF
//////////////////////////////////////////////////////////////////////////////////////////
EXPORT ChiSqPDF()
BEGIN
LOCAL status;
status:=INPUT(
{
{df,[0],{20,50,0}},
{x,[0],{20,50,1}}
},
"Chi Square PDF",
{lblDF,lblX},
{hDF,hX}
);
IF status==0 THEN
RETURN sCanceled;
END;
RETURN CHISQUARE(df, x);
END;
//////////////////////////////////////////////////////////////////////////////////////////
// Chi Square CDF
//////////////////////////////////////////////////////////////////////////////////////////
EXPORT ChiSqCDF()
BEGIN
LOCAL status;
status:=CHOOSE(tail,"Chi Square CDF Tail",sLeft,sRight,sInner,sOuter);
IF status==0 THEN
RETURN sCanceled;
END;
CASE
// left
IF tail==1 THEN
status:=INPUT(
{
{df,[0],{20,50,0}},
{x,[0],{20,50,1}}
},
"Chi Square CDF Left Tail",
{lblDF,lblX},
{hDF,hX}
);
IF status==0 THEN
RETURN sCanceled;
END;
RETURN CHISQUARE_CDF(df, x);
END;
// right
IF tail==2 THEN
status:=INPUT(
{
{df,[0],{20,50,0}},
{x,[0],{20,50,1}}
},
"Chi Square CDF Right Tail",
{lblDF,lblX},
{hDF,hX}
);
IF status==0 THEN
RETURN sCanceled;
END;
RETURN 1-CHISQUARE_CDF(df, x);
END;
// inner
IF tail==3 THEN
status:=INPUT(
{
{df,[0],{20,50,0}},
{x,[0],{20,50,2}},
{x2,[0],{20,50,3}}
},
"Chi Square CDF Inner Interval",
{lblDF,lblX1,lblX2},
{hDF,hX1,hX2}
);
IF status==0 THEN
RETURN sCanceled;
END;
RETURN CHISQUARE_CDF(df, x, x2);
END;
// outer
IF tail==4 THEN
status:=INPUT(
{
{df,[0],{20,50,0}},
{x,[0],{20,50,2}},
{x2,[0],{20,50,3}}
},
"Chi Square CDF Outer Tails",
{lblDF,lblX1,lblX2},
{hDF,hX1,hX2}
);
IF status==0 THEN
RETURN sCanceled;
END;
RETURN 1-CHISQUARE_CDF(df, x, x2);
END;
END;
END;
/////////////////////////////////////////////
// Chi Square Inverse CDF
/////////////////////////////////////////////
EXPORT ChiSqInv()
BEGIN
LOCAL status;
status:=INPUT(
{
{df,[0],{20,50,0}},
{area,[0],{20,50,1}},
{tail,{sLeft,sRight,sInner,sOuter},{20,25,2}}
},
"Inverse Chi Square CDF",
{lblDF,lblArea,lblTail},
{hDF,hArea,hTail}
);
IF status==0 THEN
RETURN sCanceled;
END;
CASE
// left
IF tail==1 THEN RETURN CHISQUARE_ICDF(df,area); END;
// right
IF tail==2 THEN RETURN CHISQUARE_ICDF(df,1-area); END;
// inner
IF tail==3
THEN RETURN {CHISQUARE_ICDF(df,(1-area)/2),CHISQUARE_ICDF(df,(1+area)/2)}; END
// outer (2 tail)
IF tail==4 THEN RETURN {CHISQUARE_ICDF(df,area/2),CHISQUARE_ICDF(df,1-area/2)}; END
DEFAULT
RETURN sInvalidTail;
END;
END;
//////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////
// Fisher PDF
//////////////////////////////////////////////////////////////////////////////////////////
EXPORT FisherPDF()
BEGIN
LOCAL status;
status:=INPUT(
{
{df,[0],{25,50,0}},
{ddf,[0],{25,50,1}},
{x,[0],{25,50,2}}
},
"Chi Square PDF",
{lblNDF,lblDDF,lblX},
{hNDF,hDDF,hX}
);
IF status==0 THEN
RETURN sCanceled;
END;
RETURN FISHER(df,ddf,x);
END;
//////////////////////////////////////////////////////////////////////////////////////////
// Fisher CDF
//////////////////////////////////////////////////////////////////////////////////////////
EXPORT FisherCDF()
BEGIN
LOCAL status;
status:=CHOOSE(tail,"F CDF Tail",sLeft,sRight,sInner,sOuter);
IF status==0 THEN
RETURN sCanceled;
END;
CASE
// left
IF tail==1 THEN
status:=INPUT(
{
{df,[0],{25,50,0}},
{ddf,[0],{25,50,1}},
{x,[0],{25,50,2}}
},
"F CDF Left Tail",
{lblNDF,lblDDF,lblX},
{hNDF,hDDF,hX}
);
IF status==0 THEN
RETURN sCanceled;
END;
RETURN FISHER_CDF(df,ddf,x);
END;
// right
IF tail==2 THEN
status:=INPUT(
{
{df,[0],{25,50,0}},
{ddf,[0],{25,50,1}},
{x,[0],{25,50,2}}
},
"F CDF Right Tail",
{lblNDF,lblDDF,lblX},
{hNDF,hDDF,hX}
);
IF status==0 THEN
RETURN sCanceled;
END;
RETURN 1-FISHER_CDF(df,ddf,x);
END;
// inner
IF tail==3 THEN
status:=INPUT(
{
{df,[0],{25,50,0}},
{ddf,[0],{25,50,1}},
{x,[0],{25,50,2}},
{x2,[0],{25,50,3}}
},
"F CDF Inner Interval",
{lblNDF,lblDDF,lblX1,lblX2},
{hNDF,hDDF,hX1,hX2}
);
IF status==0 THEN
RETURN sCanceled;
END;
RETURN FISHER_CDF(df,ddf,x,x2);
END;
// outer
IF tail==4 THEN
status:=INPUT(
{
{df,[0],{25,50,0}},
{ddf,[0],{25,50,1}},
{x,[0],{25,50,2}},
{x2,[0],{25,50,3}}
},
"F CDF Outer Tails",
{lblNDF,lblDDF,lblX1,lblX2},
{hNDF,hDDF,hX1,hX2}
);
IF status==0 THEN
RETURN sCanceled;
END;
RETURN 1-FISHER_CDF(df,ddf,x,x2);
END;
END;
END;
/////////////////////////////////////////////
// Fisher Inverse CDF
/////////////////////////////////////////////
EXPORT FisherInv()
BEGIN
LOCAL status;
status:=INPUT(
{
{df,[0],{25,50,0}},
{ddf,[0],{25,50,1}},
{area,[0],{25,50,2}},
{tail,{sLeft,sRight,sInner,sOuter},{25,25,3}}
},
"Inverse F Distribution CDF",
{lblNDF,lblDDF,lblArea,lblTail},
{hNDF,hDDF,hArea,hTail}
);
IF status==0 THEN
RETURN sCanceled;
END;
CASE
// left
IF tail==1 THEN RETURN FISHER_ICDF(df,ddf,area); END;
// right
IF tail==2 THEN RETURN FISHER_ICDF(df,ddf,1-area); END;
// inner
IF tail==3
THEN RETURN {FISHER_ICDF(df,ddf,(1-area)/2),FISHER_ICDF(df,ddf,(1+area)/2)}; END
// outer (2 tail)
IF tail==4 THEN RETURN {FISHER_ICDF(df,ddf,area/2),FISHER_ICDF(df,ddf,1-area/2)}; END
DEFAULT
RETURN sInvalidTail;
END;
END;