|
EQUAL SLOPES TESTName:
\( y_2 = a_2 + b_2 x_2 \) we want to test whether \( b_1 = b_2 \). For example, this might be of interest when we are fitting a regression line based on two different measurement methods and we would like to know if the fits are equivalent. If the residul variances from the two regressions are statistically equivalent, the test statstic is
where
\( c_2 = \frac{1}{Q_{x_1}} + \frac{1} {Q_{x_2}} \)
\( Q(x) = \sum{(x_{i} - \bar{x})^{2}} \) This test statistic is compared to a t distribution with n1 + n2 - 4 degrees of freedom. If the residual variances are not statistically equivalent and n1 and n2 are both greater than 20, the test statistic is
This is compared to a standard normal distribution. If n1 or n2 is less than or equal to 20, the test statistic is compared to a t distribution with ν degrees of freedom where
\( c = \frac{\frac{s_{y_1 \cdot x_1}^{2}} {Q_{x_1}}} {\sqrt{ \frac{s_{y_1 \cdot x_1}^{2}} {Q_{x_1}} + \frac{s_{y_2 \cdot x_2}^{2}} {Q_{x_2}}} } \) Note that n1 should be set to the smaller sample size. To determine whether the residual variances are equal, the test statistic is
The hypothesis of equal residual variances is rejected if this statistic is greater than the F percent point function with n1 -2 and n2 - 2 degrees of freedom. Dataplot will perform the test for equal residual variances first and apply the appropriate test based on this. For the case where three or more regression lines are being compared, a series of three tests are performed.
<SUBSET/EXCEPT/FOR qualification> where <y> is a response (= dependent) variable; <x> is a factor (= independent) variable; <tag> is a group-id variable; and where the <SUBSET/EXCEPT/FOR qualification> is optional.
EQUAL SLOPE TEST Y X TAG SUBSET TAG 1 2 4 6
LET A = EQUAL SLOPES TEST CDF Y X TAG LET A = EQUAL SLOPES TEST PVALUE Y X TAG LET A = EQUAL SLOPES TEST CRITICAL VALUE Y X TAG The critical value is the 95% critical value. For the more than two groups case, the values returned are the second of the three tests (i.e., the test for equal slopes). In addition to the above LET command, built-in statistics are supported for 20+ different commands (enter HELP STATISTICS for details).
. Step 1: Read the data
.
dimension 40 columns
read y x indx
0.04101 297.16000 0.00000
0.04104 297.17000 0.00000
0.04105 297.18000 0.00000
0.04103 297.20000 0.00000
0.04109 297.20000 0.00000
0.03707 280.12000 0.00000
0.03929 290.12000 0.00000
0.04171 300.18000 0.00000
0.04428 310.18000 0.00000
0.04700 320.17000 0.00000
0.04052 297.15000 1.00000
0.04055 297.15000 1.00000
0.04056 297.15000 1.00000
0.04056 297.15000 1.00000
0.04056 297.15000 1.00000
0.03656 280.15000 1.00000
0.03883 290.15000 1.00000
0.04125 300.15000 1.00000
0.04381 310.15000 1.00000
0.04654 320.15000 1.00000
end of data
let n = size y
.
. Step 2: Generate the individual fits
.
set write decimals 6
write "Fit for Lab One"
write " "
write " "
fit y x subset indx = 0
let pred1 = pred
write " "
write " "
write "Fit for NIST"
write " "
write " "
fit y x subset indx = 1
let pred2 = pred
.
. Step 3: Plot the fit
.
let x1 = x
let x2 = x
retain pred1 x1 subset indx = 0
retain pred2 x2 subset indx = 1
.
case asis
label case asis
title case asis
title offset 2
line blank blank solid solid
line color black black blue red
character circle box
character fill on on
character color blue red
char hw 1.0 0.75 all
y1label Y
x1label X
x2label Red: Lab 1, Blue: Lab 2
title Summary of Fits
.
ylimits 0.035 0.050
xlimits 280 320
xtic mark offset 5 5
.
plot y x subset indx = 1 and
plot y x subset indx = 0 and
plot pred2 x2 and
plot pred1 x1
.
. Step 4: Perform the equal slopes test
.
let statva = equal slopes test y x indx
let statcd = equal slopes test cdf y x indx
let pval = equal slopes test pvalue y x indx
let statcv = equal slopes test critical value y x indx
.
print statva statcd statcv pval
.
equal slopes test y x indx
The following output is generated
Fit for Lab One
Least Squares Multilinear Fit
Sample Size: 10
Number of Variables: 1
Residual Standard Deviation: 0.000122
Residual Degrees of Freedom: 8
BIC: -177.777585
Replication Case:
Replication Standard Deviation: 0.000042
Replication Degrees of Freedom: 1
Number of Distinct Subsets: 9
Lack of Fit F Ratio: 9.381749
Lack of Fit F CDF (%): 75.360484
Lack of Fit Degrees of Freedom 1: 7
Lack of Fit Degrees of Freedom 2: 1
--------------------------------------------------------------------
Approximate
Parameter Estimates Standard Deviation t-Value
--------------------------------------------------------------------
1 A0 -0.032834 0.001143 -28.7237
2 A1 X 0.000249 0.000004 65.0287
Fit for NIST
Least Squares Multilinear Fit
Sample Size: 10
Number of Variables: 1
Residual Standard Deviation: 0.000115
Residual Degrees of Freedom: 8
BIC: -179.031014
Replication Case:
Replication Standard Deviation: 0.000017
Replication Degrees of Freedom: 4
Number of Distinct Subsets: 6
Lack of Fit F Ratio: 87.226813
Lack of Fit F CDF (%): 99.961750
Lack of Fit Degrees of Freedom 1: 4
Lack of Fit Degrees of Freedom 2: 4
--------------------------------------------------------------------
Approximate
Parameter Estimates Standard Deviation t-Value
--------------------------------------------------------------------
1 A0 -0.033728 0.001075 -31.3736
2 A1 X 0.000250 0.000004 69.5272
PARAMETERS AND CONSTANTS--
STATVA -- -0.265061
STATCD -- 0.397174
STATCV -- 2.119905
PVAL -- 0.794347
Summary Table
-----------------------------------------------------------------
Sample Residual
Group-ID Size Intercept Slope Variance
-----------------------------------------------------------------
1 10 -0.032834 0.000249 0.000000
2 10 -0.033728 0.000250 0.000000
Equal Slopes Test for Two Groups
(Equal Residual Variances Case)
Dependent (Y) Variable: Y
Independent (X) Variable: X
Group-ID Variable: INDX
H0: The Regression Slopes are Equal
Ha: The Regression Slopes are not Equal
Total Number of Observations: 20
Number of Groups with Ni > 3: 2
Test:
Equal Slopes Test Statistic Value: -0.265061
CDF Value: 0.397174
P-Value: 0.794347
Conclusions (Two-Tailed t-Test)
H0: Slopes Are Equal
------------------------------------------------------------
Null
Significance Test Critical Hypothesis
Level Statistic Region (+/-) Conclusion
------------------------------------------------------------
80.0% -0.265061 1.336757 ACCEPT
90.0% -0.265061 1.745883 ACCEPT
95.0% -0.265061 2.119905 ACCEPT
99.0% -0.265061 2.920773 ACCEPT
Date created: 07/21/2017 |
Last updated: 12/11/2023 Please email comments on this WWW page to [email protected]. | ||||||||||||||||