Matlab defines LinearModel
and GeneralizedLinearMixedModel
classes. Browsing the documentation indicates that either (i) one is derived from the other, or (ii) there is automatic conversion. These are complex objects, and I am just starting to explore them, so I apologize if their relationship is obvious, but what exactly is their relationship?
Note also that I expressed (i) and (ii) above in terms of my object-oriented background (C++), and I know there maybe be differences with the Matlab paradigm.
This question arose because the function coefTest
accepts a GeneralizedLinearMixedModel
object, yet the Econometrics toolbox example "Time Series Regression IX: Lag Order Selection" submits a LinearModel
object instead.
Note that this this question pertains to Matlab-specific classes and the Matlab command coefTest
. As such, it does not belong on "Cross Validated" Stack Exchange forum. I posted this to:
Relationship between LinearModel & GeneralizedLinearMixedModel classes
http://groups.google.com/forum/#!topic/comp.soft-sys.matlab/OHLajBEuPU0
To determine this, you can use the superclasses
function:
superclasses('LinearModel')
superclasses('GeneralizedLinearMixedModel')
This will return the names of the visible superclasses for each case. As you'll see, both inherit from the abstract superclass classreg.regr.ParametricRegression
.
You can also view the actual classdef
files and look at the inheritances. In your Command Window, type edit LinearModel
and edit GeneralizedLinearMixedModel
. You will see, respectively:
classdef (Sealed = true) LinearModel < classreg.regr.TermsRegression
and
classdef (Sealed = true) GeneralizedLinearMixedModel < classreg.regr.LinearLikeMixedModel
And so on. Both LinearModel
and GeneralizedLinearMixedModel
are Sealed
, meaning they are not allowed to be subclassed.
Why does coefTest
"accept" objects both LinearModel
and GeneralizedLinearMixedModel
class objects?
Both LinearModel
and GeneralizedLinearMixedModel
have methods called coefTest
: LinearModel/coefTest
and GeneralizedLinearMixedModel/coefTest
. Despite the name, these are entirely separate functions. Which method gets called is determined by the class of the object you pass to it. The methods of each of these classes are listed in their respective documentation, however, you can also use the methods
function on an object of either class to list its public methods.