Skip to contents

Evaluate change in objective function and likelihood components for up to 2 parameters.

Usage

# S3 method for class 'MARSassess'
profile(fitted, p1, v1, p2, v2, cores = 1, ...)

# S3 method for class 'MARSprof'
plot(
  x,
  component = "objective",
  rel = TRUE,
  xlab,
  ylab,
  main,
  plot2d = c("contour", "filled.contour"),
  ...
)

Arguments

fitted

MARSassess object returned by fit_MARS()

p1

Character string that represents the first parameter to be profiled, including the parameter name and index of the vector/array. See "Parameters" section of make_parameters(). Additionally, this function allows users to specify R0_s and h_s (in normal units).

v1

Vector of values corresponding to p1

p2

Character string that represents the optional second parameter to be profiled

v2

Vector of values corresponding to p2

cores

Integer for the number of cores to use for parallel processing (snowfall package)

...

Other argument to the base graphics function, i.e., either plot() or contour()

x

Output from profile.MARSassess()

component

Character for the column in x to be plotted

rel

Logical, whether the relative change in component is plotted (TRUE) or the raw values (FALSE)

xlab

Optional character for the x-axis label

ylab

Optional character for the y-axis label

main

Optional character for the plot title

plot2d

Character, plotting function for two-dimensional profiling (either a contour() or filled.contour() plot)

Value

The profile generic returns a data frame of the likelihood values that correspond to fixed values of p1 and p2.

  • Likelihood loglike refers to maximizing the probability of the observed data (higher values for better fit)

  • Prior logprior refers to maximizing the probability of a parameter to their prior distribution (higher values are closer to the prior mode)

  • Penalty penalty are values added to the objective function when parameters exceed model bounds (lower values are better)

  • fn is the objective function returned by RTMB (lower values are better)

  • objective is the objective function returned by the optimizer (lower values are better)

The accompanying plot function returns a line plot for a 1-dimensional profile or a contour plot for a two dimensional profile. Will plot the negative log likelihood or negative log prior (better fit with lower values).

Relative values are obtained by subtracting from the fitted value. See attr(x, "fitted")