calibrate.rrvglm | R Documentation |
Performs maximum likelihood calibration for constrained linear ordination models (CLO models are better known as RR-VGLMs).
calibrate.rrvglm(object, newdata = NULL,
type = c("latvar", "predictors", "response", "vcov", "everything"),
lr.confint = FALSE, cf.confint = FALSE,
level = 0.95, initial.vals = NULL, ...)
object |
The fitted |
newdata |
See |
type |
See |
lr.confint , cf.confint , level |
Same as |
initial.vals |
Same as |
... |
Arguments that are fed into
|
Given a fitted regression CLO model, maximum likelihood calibration is theoretically easy and elegant. However, the method assumes that all responses are independent. More details and references are given in Yee (2015).
Calibration requires grouped or non-sparse data
as the response.
For example,
if the family function is multinomial
then
one cannot usually calibrate y0
if it is a vector of 0s
except for one 1.
Instead, the response vector should be from grouped data
so that there are few 0s.
Indeed, it is found empirically that the stereotype model
(also known as a reduced-rank multinomial
logit
model) calibrates well only with grouped data, and
if the response vector is all 0s except for one 1 then
the MLE will probably be at -Inf
or +Inf
.
As another example, if the family function is poissonff
then y0
must not be a vector of all 0s; instead, the response
vector should have few 0s ideally. In general, you can use simulation
to see what type of data calibrates acceptably.
Internally, this function is a simplification of
calibrate.qrrvglm
and users should look at
that function for details.
Good initial values are
needed, and a grid is constructed to obtain these.
The function calibrate.rrvglm.control
allows the user some control over the choice of these.
See calibrate.qrrvglm
.
Of course, the quadratic term in the latent variables vanishes
for RR-VGLMs, so the model is simpler.
See calibrate.qrrvglm
.
See calibrate.qrrvglm
about, e.g.,
calibration using real-valued responses.
T. W. Yee
calibrate.qrrvglm
,
calibrate
,
rrvglm
,
weightsvglm
,
optim
,
uniroot
.
## Not run: # Example 1
nona.xs.nz <- na.omit(xs.nz) # Overkill!! (Data in VGAMdata package)
nona.xs.nz$dmd <- with(nona.xs.nz, round(drinkmaxday))
nona.xs.nz$feethr <- with(nona.xs.nz, round(feethour))
nona.xs.nz$sleephr <- with(nona.xs.nz, round(sleep))
nona.xs.nz$beats <- with(nona.xs.nz, round(pulse))
p2 <- rrvglm(cbind(dmd, feethr, sleephr, beats) ~ age + smokenow +
depressed + embarrassed + fedup + hurt + miserable + # 11 psychological
nofriend + moody + nervous + tense + worry + worrier, # variables
noRRR = ~ age + smokenow, trace = FALSE, poissonff, data = nona.xs.nz,
Rank = 2)
cp2 <- calibrate(p2, newdata = head(nona.xs.nz, 9), trace = TRUE)
cp2
two.cases <- nona.xs.nz[1:2, ] # Another calibration example
two.cases$dmd <- c(4, 10)
two.cases$feethr <- c(4, 7)
two.cases$sleephr <- c(7, 8)
two.cases$beats <- c(62, 71)
(cp2b <- calibrate(p2, newdata = two.cases))
# Example 2
p1 <- rrvglm(cbind(dmd, feethr, sleephr, beats) ~ age + smokenow +
depressed + embarrassed + fedup + hurt + miserable + # 11 psychological
nofriend + moody + nervous + tense + worry + worrier, # variables
noRRR = ~ age + smokenow, trace = FALSE, poissonff, data = nona.xs.nz,
Rank = 1)
(cp1c <- calibrate(p1, newdata = two.cases, lr.confint = TRUE))
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.