Skip to contents

Draws the profiles computed by profile.RiskMap(), as plot() of the result does. Each marginal profile shows the relative profile log-likelihood, the profile log-likelihood minus its maximum, against the parameter. It is 0 at the maximum, which is the estimate unless a point on a profile is higher, and negative elsewhere. The panel also shows the quadratic approximation implied by the standard error (dashed), the cut-off for the requested level and the profile interval shaded, with the estimate, the profile interval and the Wald interval in the subtitle, one per line. Each joint profile shows the relative log-likelihood over the grid as filled regions at the 50%, 80% and 95% levels of a chi-squared distribution on two degrees of freedom, the estimate, and the ridges of the two marginal profiles (the value of one parameter that maximises the likelihood for each value of the other). With one joint profile and both its marginal profiles, the panels are arranged as a corner plot. Variances and the scale are shown on a logarithmic axis.

Usage

plot_profile(
  x,
  parameters = NULL,
  pairs = NULL,
  scale = c("loglik", "deviance"),
  ...
)

# S3 method for class 'RiskMap_profile'
plot(x, ...)

Arguments

x

The result of profile.RiskMap().

parameters

Names of the marginal profiles to draw, as in profile.RiskMap(), where the prefix beta. can be left out. The default is all of them.

pairs

The joint profiles to draw, given as in profile.RiskMap(), each by two names, as in list(c("sigma2", "phi")), or by one name "first:second", as in "sigma2:phi", with the parameters in the order given to profile.RiskMap(). The default is all of them.

scale

The vertical scale of the profiles: "loglik" (the default) for the relative log-likelihood, or "deviance" for the profile deviance.

...

For plot(), the arguments of plot_profile(). For plot_profile(), not used, and an error if given, so that a misspelt argument is not ignored.

Value

A ggplot object for one panel, and otherwise a patchwork object that arranges the panels. Nothing is drawn until the object is printed, so it can be saved or changed first. One marginal panel is plot_profile(x, parameters = "phi", pairs = character()), since pairs defaults to every joint profile.

Details

With scale = "deviance", the panels show the profile deviance instead, twice the drop in the log-likelihood from its maximum, which is minus twice the relative log-likelihood. The cut-off of a profile interval at level \(1 - \alpha\) is then the quantile \(\chi^2_{1, 1 - \alpha}\), and on the relative log-likelihood it is \(-\chi^2_{1, 1 - \alpha}/2\) (about -1.92 at the 95% level).

Examples

# \donttest{
data(galicia)
fit <- glgpm(log(lead) ~ gp(kappa = 1.5), data = galicia,
             family = "gaussian", distance_units = "km", messages = FALSE)
profiles <- profile(fit, pairs = list(c("sigma2", "phi")), n_grid = 7,
                    messages = FALSE)
plot_profile(profiles)

plot_profile(profiles, parameters = "phi", pairs = character(),
             scale = "deviance")

# The same panels
plot(profiles)

# }