I have got a question regarding the ordinal
package in R
or specifically regarding the predict.clm()
function. I would like to calculate the linear predictor
of an ordered probit
estimation. With the polr function of the MASS package the linear predictor can be accessed by object$lp. It gives me on value for each line and is in line with what I understand what the linear predictor is namely X_i'beta. If I however use the predict.clm(object, newdata,"linear.predictor")
on an ordered probit estimation with clm() I get a list with the elements eta1 and eta2,
- with one column each, if the newdata contains the dependent variable
- where each element contains as many columns as levels in the dependent variable, if the newdata doesn't contain the dependent variable
Unfortunately I don't have a clue what that means. Also in the documentations and papers of the author I don't find any information about it. Would one of you be so nice to enlighten me? This would be great.
Cheers,
AK
UPDATE (after comment):
Basic
clm
model is defined like this (see clm tutorial for details):Generating data:
Constructing models:
Now we can access
thetas
andbetas
(see formula above):Obtaining linear predictors (only parts without
theta
on the right side of the formula):New data generation:
There are four types of predictions available for
clm
model. We are interested intype=linear.prediction
, which returns a list with two matrices:eta1
andeta2
. They contain linear predictors for each observation innew.data
:Note 1:
eta1
andeta2
are literally equal. Second is just a rotation ofeta1
by 1 inj
index. Thus, they leave left side and right side of linear predictor scale opened respectively.Note 2: Prediction for first line in
new.data
is equal tothetas
(as far as we set this line to zeros).Note 3: We can manually construct such predictions. For instance, prediction for second line in
new.data
:Note 4: If
new.data
contains response variable, thenpredict
returns only linear predictor for specified level ofy
. Again we can check it manually: