chow.test {gap} | R Documentation |
Chow's test for heterogeneity in two regressions
Description
Chow's test for heterogeneity in two regressions
Usage
chow.test(y1, x1, y2, x2, x = NULL)
Arguments
y1 |
a vector of dependent variable. |
x1 |
a matrix of independent variables. |
y2 |
a vector of dependent variable. |
x2 |
a matrix of independent variables. |
x |
a known matrix of independent variables. |
Details
Chow's test is for differences between two or more regressions. Assuming that
errors in regressions 1 and 2 are normally distributed with zero mean and
homoscedastic variance, and they are independent of each other, the test of
regressions from sample sizes and
is then carried out using
the following steps. 1. Run a regression on the combined sample with size
and obtain within group sum of squares called
. The
number of degrees of freedom is
, with
being the number
of parameters estimated, including the intercept. 2. Run two regressions on
the two individual samples with sizes
and
, and obtain their
within group sums of square
, with
degrees of
freedom. 3. Conduct an
test defined by
If the statistic
exceeds the critical
, we reject the null hypothesis that the two
regressions are equal.
In the case of haplotype trend regression, haplotype frequencies from combined data are known, so can be directly used.
Value
The returned value is a vector containing (please use subscript to access them):
F the F statistic.
df1 the numerator degree(s) of freedom.
df2 the denominator degree(s) of freedom.
p the p value for the F test.
Note
adapted from chow.R.
Author(s)
Shigenobu Aoki, Jing Hua Zhao
References
Chow GC (1960). “Tests of Equality Between Sets of Coefficients in Two Linear Regressions.” Econometrica, 28(3), 591-605. ISSN 00129682, 14680262, doi:10.2307/1910133.
See Also
Examples
## Not run:
dat1 <- matrix(c(
1.2, 1.9, 0.9,
1.6, 2.7, 1.3,
3.5, 3.7, 2.0,
4.0, 3.1, 1.8,
5.6, 3.5, 2.2,
5.7, 7.5, 3.5,
6.7, 1.2, 1.9,
7.5, 3.7, 2.7,
8.5, 0.6, 2.1,
9.7, 5.1, 3.6), byrow=TRUE, ncol=3)
dat2 <- matrix(c(
1.4, 1.3, 0.5,
1.5, 2.3, 1.3,
3.1, 3.2, 2.5,
4.4, 3.6, 1.1,
5.1, 3.1, 2.8,
5.2, 7.3, 3.3,
6.5, 1.5, 1.3,
7.8, 3.2, 2.2,
8.1, 0.1, 2.8,
9.5, 5.6, 3.9), byrow=TRUE, ncol=3)
y1<-dat1[,3]
y2<-dat2[,3]
x1<-dat1[,1:2]
x2<-dat2[,1:2]
chow.test.r<-chow.test(y1,x1,y2,x2)
# from http://aoki2.si.gunma-u.ac.jp/R/
## End(Not run)