Description Usage Arguments Details Note Examples
The default callback function prints a line whenever estimation with a masspoint is completed.
1 | mphcrm.callback(fromwhere, opt, dataset, control, ...)
|
fromwhere |
a string which identifies which step in the algorithm it is called from. |
opt |
Typically the result of a call to |
dataset |
The dataset in a structured form. |
control |
The |
... |
other arguments |
If you write your own callback function it will replace the default function, but you can
of course call the default callback from your own callback function, and in addition print your
own diagnostics, or save the intermediate opt
in a file, or whatever. You can even
stop the estimation by doing a stop('<some message>')
, and mphcrm
will return
with the estimates done so far, provided the control parameter trap.interrupt=TRUE
.
Beware that
control
contains a reference to the callback function, which may contain a reference
to the top-level environment, which may contain the full dataset. So if you save control
to file, you may end up saving the entire dataset.
1 2 3 4 5 6 7 8 9 | callback <- function(fromwhere, opt, dataset, control, ...) {
# call the standard callback to print a diagnostic line
mphcrm.callback(fromwhere, opt, dataset, control, ...)
# print the distribution and two coefficients
if(fromwhere == 'full') {
print(round(mphdist(opt),6))
print(summary(opt)$coefs[c('job.alpha','job.x1'),])
}
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.