topmod-class {BMS} | R Documentation |
An updateable list keeping the best x models it encounters in any kind of model iteration
Objects can be created by calls to
topmod
, or indirectly by calls to bms
.
A 'topmod' object (as created by topmod
) holds three basic vectors:
lik
(for the (log) likelihood of models or similar), bool()
for a hexcode presentation of the model binaries (cf. bin2hex
)
and ncount() for the times the models have been drawn.
All these vectors
are sorted descendantly by lik
, and are of the same length. The
maximum length is limited by the argument nbmodels
.
If tmo
is a topmod object, then a call to tmo$addmodel
(e.g.
tmo$addmodel(mylik=4,vec01=c(T,F,F,T))
updates the object tmo
by a model represented by vec01
(here the one including the first and
fourth regressor) and the marginal (log) likelihood lik
(here: 4).
If this model is already part of tmo
, then its respective
ncount
entry is incremented by one; else it is inserted into a
position according to the ranking of lik
.
In addition, there is
the possibility to save (the first moments of) coefficients of a model
(betas
) and their second moments (betas2
), as well as an
arbitrary vector of statistics per model (fixed_vector
).
Martin Feldkircher and Stefan Zeugner
topmod
to create topmod
objects and a more
detailed description,
is.topmod
to test for this class
tm= topmod(2,4,TRUE,0) #should keep a maximum two models tm$addmodel(-2.3,c(1,1,1,1),1:4,5:8) #update with some model tm$addmodel(-2.2,c(0,1,1,1),1:3,5:7) #add another model tm$addmodel(-2.2,c(0,1,1,1),1:3,5:7) #add it again -> adjust ncount tm$addmodel(-2.5,c(1,0,0,1),1:2,5:6) #add another model #read out tm$lik() tm$ncount() tm$bool_binary() tm$betas()