From d566ba840f4351a3aeebf21aae0649caebe0e009 Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Fri, 23 Nov 2018 19:52:18 +0100 Subject: Add logLik method to enable AIC() on mkinfit models Further relax two tests to pass build on Travis --- man/logLik.mkinfit.Rd | 40 ++++++++++++++++++++++++++++++++++++++++ man/mkinfit.Rd | 5 ++++- 2 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 man/logLik.mkinfit.Rd (limited to 'man') diff --git a/man/logLik.mkinfit.Rd b/man/logLik.mkinfit.Rd new file mode 100644 index 00000000..2f3e58a1 --- /dev/null +++ b/man/logLik.mkinfit.Rd @@ -0,0 +1,40 @@ +\name{logLik.mkinfit} +\alias{logLik.mkinfit} +\title{ + Calculated the log-likelihood of a fitted mkinfit object +} +\description{ + This function simply calculates the product of the likelihood densities + calc +} +\usage{ +\method{logLik}{mkinfit}(object, ...) +} +\arguments{ + \item{object}{ + An object of class \code{\link{mkinfit}}. + } + \item{\dots}{ + For compatibility with the generic method + } +} +\value{ + An object of class \code{\link{logLik}} with the number of + estimated parameters (degradation model parameters plus variance + model parameters) as attribute. +} +\examples{ + sfo_sfo <- mkinmod( + parent = mkinsub("SFO", to = "m1"), + m1 = mkinsub("SFO") + ) + d_t <- FOCUS_2006_D + d_t[23:24, "value"] <- c(NA, NA) # can't cope with zero values at the moment + f_nw <- mkinfit(sfo_sfo, d_t, quiet = TRUE) + f_obs <- mkinfit(sfo_sfo, d_t, reweight.method = "obs", quiet = TRUE) + f_tc <- mkinfit(sfo_sfo, d_t, reweight.method = "tc", quiet = TRUE) + AIC(f_nw, f_obs, f_tc) +} +\author{ + Johannes Ranke +} diff --git a/man/mkinfit.Rd b/man/mkinfit.Rd index 00d7eb47..228bab24 100644 --- a/man/mkinfit.Rd +++ b/man/mkinfit.Rd @@ -179,7 +179,7 @@ mkinfit(mkinmod, observed, \item{weight}{ only if \code{err}=\code{NULL}: how to weight the residuals, one of "none", "std", "mean", see details of \code{\link{modCost}}, or "tc" for the - two component error model. The option "manual" is available for + two component error model. The option "manual" is available for the case that \code{err}!=\code{NULL}, but it is not necessary to specify it. } \item{tc}{The two components of the error model as used for (initial) @@ -245,6 +245,9 @@ mkinfit(mkinmod, observed, Plotting methods \code{\link{plot.mkinfit}} and \code{\link{mkinparplot}}. + Comparisons of models fitted to the same data can be made using \code{\link{AIC}} + by virtue of the method \code{\link{logLik.mkinfit}}. + Fitting of several models to several datasets in a single call to \code{\link{mmkin}}. } -- cgit v1.2.1