Calculation STATBEANS®

 

STATBEAN Name: HypothesisTests

 

Purpose: Performs hypothesis testing in statistics for means, medians, standard deviations, proportions, and rates. Lets Statgraphics function as hypothesis testing software.

DataSource for Statgraphics hypothesis testing software: Any. 

Read/Write Properties
Name Type Description Possible Values Default Value
alpha double Type I Error, as a percentage. 0.0001-50.0 5.0
alternativeHypothesis String Type of alternative hypothesis. "Not equal",
"Less than",
"Greater than"
"Not equal"
assumeEqualSigmas boolean Whether to assume equal sigmas if comparing 2 means. true,false true
class1Name String Name for first class to be used in title. Any string. ""
class2Name String Name for second class to be used in title. Any string. ""
missingValueExclusion String The method for handling records which contain missing values. "Columnwise","Casewise",
"Tablewise"
"Columnwise"
nullHypothesis double The value of the null hypothesis. Any double. 1.0
parameterOfInterest String Parameter to be tested. "Mean",
"Median",
"Sigma",
"Proportion",
"Rate",
"Difference of Means",
"Ratio of Sigmas",
"Difference of Proportions",
"Difference of Rates",
"Difference of Medians",
"Difference of Distributions"
"Mean"
sample1VariableName String The name of the column with data values for the first sample (if any). Any string. ""
sample2VariableName String The name of the column with data values for the first sample (if any). Any string. ""
sample1Mean double The mean of the first sample. Any double. Missing.
sample2Mean double The mean of the second sample. Any double. Missing.
sample1Proportion double The proportion for the first sample. 0.0-1.0 Missing.
sample2Proportion double The proportion for the second sample. 0.0-1.0 Missing.
sample1Rate double The rate for the first sample. 0+ Missing.
sample2Rate double The rate for the second sample. 0+ Missing.
sample1Sigma double The standard deviation of the first sample. >0 Missing.
sample2Sigma double The standard deviation of the second sample. >0 Missing.
sample1Size int The number of observations in the first sample. 1+ 0
sample2Size int The number of observations in the second sample. 1+ 0
signTest boolean Whether to use sign test rather than signed rank test if comparing 2 medians. true,false false

Other Public Methods
Name Description Arguments Return Value
double getPValue() Returns the P-Value for the test. None P-Value
double getTestStatistic() Returns the value of the test statistic. None Test statistic



Notes For Hypothesis Testing In Statistics

1. For tests involving means or standard deviations, the statistics may either be supplied directly in hypothesis testing software through methods such as setSample1Size or calculated from the data by specifying variable names. If specifying statistics directly, callcalculateStatistics(null). If providing data, make the HypothesisTests bean a listener for a StatDataSource.

2. For hypothesis testing in statistics involving medians, the data must be provided.

3. For hypothesis testing in statistics involving proportions or rates, the statistics must be provided and any data is ignored.


Code Sample 

//create a calculation bean 
HypothesisTests hypothesistests1 = new STATBEANS.HypothesisTests(); 

//set the parameter to be tested 
hypothesistests1.setParameterOfInterest("Sigma"); 

//set the sample statistics 
hypothesistests1.setSample1Size(30); 
hypothesistests1.setSample1Sigma(8.0); 

//set the hypotheses to be tested 
hypothesistests1.setNullHypothesis(10.0); 

//set up a table to display results 
hypothesisTestsTable hypothesistestsTable1 = new STATBEANS.HypothesisTestsTable(); 

//add the table to the display 
add(hypothesistestsTable1); 

//create a plot bean 
HypothesisTestsPlot hypothesistestsPlot1 = new STATBEANS.HypothesisTestsPlot(); 

//add the plot to the display 
add(hypothesistestsPlot1); 

//make the table and plot beans listeners for changes in the calculation bean 
hypothesistests1.addDataChangeListener(hypothesistestsTable1.listenerForDataChange); 
hypothesistests1.addDataChangeListener(hypothesistestsPlot1.listenerForDataChange); 

//instruct the calculation bean to compute the probabilities 
hypothesistests1.calculateStatistics(null);