Description Usage Arguments Details Author(s) References See Also Examples
View source: R/checkSpecification.R
Tests to check the model specifications
1  checkSpecif(obj1, obj2, level = 0.05)

obj1 

obj2 
An object of class ' 
level 
The significance level. 
This function is equipped with two types of specificationtests:
The first specificationtests is the Hausmantype test
proposed by Bai (2009), which is computed if obj1
as well
as obj2
are specified by 'Eup
'objects. In this case
the model given to the arguments obj1
and obj2
are
compared with each other. Note that this test assumes that the
(unobserved) true factor dimension is lower or equal to 2; see
Section 9 in Bai (2009) for more details.
Given the assumption that there is only one unobserved common factor:
NullHypothesis: 'The unobserved common factor is a
classical individual
or time
effect'.
AlternativeHypothesis: 'The unobserved common factor is an arbitrary process'.
Given the assumption that there are two unobserved common factors:
NullHypothesis: 'The two unobserved common factors are classical
twoways
effects'.
AlternativeHypothesis: 'The two unobserved common factors are arbitrary processes'.
The second specificationtest tests the existence of an additional
factor structure beyond a classical additive effects model; as suggested
in Kneip, Sickles, and Song (2012), which is applied if only
obj1
is specified and obj2
is left unspecified. This
test can be used for 'Eup
'objects as well as for
'KSS
'objects.
NullHypothesis: 'There are no unobserved common factors
beyond the classical individual
, time
, or
twoways
effects'.
AlternativeHypothesis: 'There are additional unobserved common factors'.
Oualid Bada, Dominik Liebl
Bai, J., 2009 “Panel data models with interactive fixed effects”, Econometrica
Kneip, A., Sickles, R. C., Song, W., 2012 “A New Panel Data Treatment for Heterogeneity in Time Trends”, Econometric Theory
KSS, Eup, OptDim
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67  ## See the example in 'help(Cigar)' in order to take a look at the
## data set 'Cigar'
##########
## DATA ##
##########
data(Cigar)
## PanelDimensions:
N < 46
T < 30
## Dependent variable:
## CigaretteSales per Capita
l.Consumption < log(matrix(Cigar$sales, T,N))
d.l.Consumption < diff(l.Consumption)
## Independent variables:
## Consumer Price Index
cpi < matrix(Cigar$cpi, T,N)
## Real Price per Pack of Cigarettes
l.Price < log(matrix(Cigar$price, T,N)/cpi)
d.l.Price < diff(l.Price)
## Real Disposable Income per Capita
l.Income < log(matrix(Cigar$ndi, T,N)/cpi)
d.l.Income < diff(l.Income)
#####################################################################
## Testing the Sufficiency of a classical 'twoways' effects model: ##
## Hausmantype Test of Bai (2009) ##
#####################################################################
## Model under the null Hypothesis:
twoways.obj < Eup(d.l.Consumption ~ 1 + d.l.Price + d.l.Income,
factor.dim = 0, additive.effects = "twoways")
## Model under the alternative Hypothesis:
not.twoways.obj < Eup(d.l.Consumption ~ 1 + d.l.Price + d.l.Income,
factor.dim = 2, additive.effects = "none")
###########
## Test: ##
###########
## (This test returns an error message, since the (unobserved) true
## factor dimension is probably greater than 2.)
## Not run:
checkSpecif(obj1 = twoways.obj, obj2 = not.twoways.obj, level = 0.01)
## End(Not run)
#####################################################################
## Testing the Existence of additional (unobserved) common Factors ##
## Specification Test of Kneip, Sickles, and Song (2012) ##
#####################################################################
## For the model of Bai (2009):
Eup.obj < Eup(d.l.Consumption ~ 1 + d.l.Price + d.l.Income,
additive.effects = "twoways")
## Test:
checkSpecif(Eup.obj, level = 0.01)
## For the model of Kneip, Sickles, and Song (2012):
KSS.obj < KSS(l.Consumption ~ 1 + l.Price + l.Income,
additive.effects = "twoways")
## Test:
checkSpecif(KSS.obj, level = 0.01)

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.
Please suggest features or report bugs in the GitHub issue tracker.
All documentation is copyright its authors; we didn't write any of that.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.