aboutsummaryrefslogtreecommitdiff
path: root/man
diff options
context:
space:
mode:
authorJohannes Ranke <jranke@uni-bremen.de>2020-03-27 11:47:48 +0100
committerJohannes Ranke <jranke@uni-bremen.de>2020-03-27 11:47:48 +0100
commit20ece4e0bcbeceb90a940e04a858f4ffb6d6b5e4 (patch)
tree7595dbb6e129332a6ad0c273ecd3fbd92643e0d5 /man
parent731dd9450f08868140f90af7a305133ec9342994 (diff)
parent68eed166cbe10a5ee79f5b1139261dea98234b22 (diff)
Merge branch 'master' into mxkin
Diffstat (limited to 'man')
-rw-r--r--man/aw.Rd47
-rw-r--r--man/loftest.Rd81
-rw-r--r--man/lrtest.mkinfit.Rd6
-rw-r--r--man/plot.mmkin.Rd4
-rw-r--r--man/sigma_twocomp.Rd2
5 files changed, 137 insertions, 3 deletions
diff --git a/man/aw.Rd b/man/aw.Rd
new file mode 100644
index 00000000..40676716
--- /dev/null
+++ b/man/aw.Rd
@@ -0,0 +1,47 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/aw.R
+\name{aw}
+\alias{aw}
+\alias{aw.mkinfit}
+\alias{aw.mmkin}
+\title{Calculate Akaike weights for model averaging}
+\usage{
+aw(object, ...)
+
+\method{aw}{mkinfit}(object, ...)
+
+\method{aw}{mmkin}(object, ...)
+}
+\arguments{
+\item{object}{An \link{mmkin} column object, containing two or more
+\link{mkinfit} models that have been fitted to the same data,
+or an mkinfit object. In the latter case, further mkinfit
+objects fitted to the same data should be specified
+as dots arguments.}
+
+\item{\dots}{Not used in the method for \link{mmkin} column objects,
+further \link{mkinfit} objects in the method for mkinfit objects.}
+}
+\description{
+Akaike weights are calculated based on the relative
+expected Kullback-Leibler information as specified
+by Burnham and Anderson (2004).
+}
+\examples{
+\dontrun{
+f_sfo <- mkinfit("SFO", FOCUS_2006_D, quiet = TRUE)
+f_dfop <- mkinfit("DFOP", FOCUS_2006_D, quiet = TRUE)
+aw_sfo_dfop <- aw(f_sfo, f_dfop)
+sum(aw_sfo_dfop)
+aw_sfo_dfop # SFO gets more weight as it has less parameters and a similar fit
+f <- mmkin(c("SFO", "FOMC", "DFOP"), list("FOCUS D" = FOCUS_2006_D), cores = 1, quiet = TRUE)
+aw(f)
+sum(aw(f))
+aw(f[c("SFO", "DFOP")])
+}
+}
+\references{
+Burnham KP and Anderson DR (2004) Multimodel
+Inference: Understanding AIC and BIC in Model Selection.
+\emph{Sociological Methods & Research} \strong{33}(2) 261-304
+}
diff --git a/man/loftest.Rd b/man/loftest.Rd
new file mode 100644
index 00000000..397b5c08
--- /dev/null
+++ b/man/loftest.Rd
@@ -0,0 +1,81 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/loftest.R
+\name{loftest}
+\alias{loftest}
+\alias{loftest.mkinfit}
+\title{Lack-of-fit test for models fitted to data with replicates}
+\usage{
+loftest(object, ...)
+
+\method{loftest}{mkinfit}(object, ...)
+}
+\arguments{
+\item{object}{A model object with a defined loftest method}
+
+\item{\dots}{Not used}
+}
+\description{
+This is a generic function with a method currently only defined for mkinfit
+objects. It fits an anova model to the data contained in the object and
+compares the likelihoods using the likelihood ratio test
+\code{\link[lmtest]{lrtest.default}} from the lmtest package.
+}
+\details{
+The anova model is interpreted as the simplest form of an mkinfit model,
+assuming only a constant variance about the means, but not enforcing any
+structure of the means, so we have one model parameter for every mean
+of replicate samples.
+}
+\examples{
+\dontrun{
+test_data <- subset(synthetic_data_for_UBA_2014[[12]]$data, name == "parent")
+sfo_fit <- mkinfit("SFO", test_data, quiet = TRUE)
+plot_res(sfo_fit) # We see a clear pattern in the residuals
+loftest(sfo_fit) # We have a clear lack of fit
+#
+# We try a different model (the one that was used to generate the data)
+dfop_fit <- mkinfit("DFOP", test_data, quiet = TRUE)
+plot_res(dfop_fit) # We don't see systematic deviations, but heteroscedastic residuals
+# therefore we should consider adapting the error model, although we have
+loftest(dfop_fit) # no lack of fit
+#
+# This is the anova model used internally for the comparison
+test_data_anova <- test_data
+test_data_anova$time <- as.factor(test_data_anova$time)
+anova_fit <- lm(value ~ time, data = test_data_anova)
+summary(anova_fit)
+logLik(anova_fit) # We get the same likelihood and degrees of freedom
+#
+test_data_2 <- synthetic_data_for_UBA_2014[[12]]$data
+m_synth_SFO_lin <- mkinmod(parent = list(type = "SFO", to = "M1"),
+ M1 = list(type = "SFO", to = "M2"),
+ M2 = list(type = "SFO"), use_of_ff = "max")
+sfo_lin_fit <- mkinfit(m_synth_SFO_lin, test_data_2, quiet = TRUE)
+plot_res(sfo_lin_fit) # not a good model, we try parallel formation
+loftest(sfo_lin_fit)
+#
+m_synth_SFO_par <- mkinmod(parent = list(type = "SFO", to = c("M1", "M2")),
+ M1 = list(type = "SFO"),
+ M2 = list(type = "SFO"), use_of_ff = "max")
+sfo_par_fit <- mkinfit(m_synth_SFO_par, test_data_2, quiet = TRUE)
+plot_res(sfo_par_fit) # much better for metabolites
+loftest(sfo_par_fit)
+#
+m_synth_DFOP_par <- mkinmod(parent = list(type = "DFOP", to = c("M1", "M2")),
+ M1 = list(type = "SFO"),
+ M2 = list(type = "SFO"), use_of_ff = "max")
+dfop_par_fit <- mkinfit(m_synth_DFOP_par, test_data_2, quiet = TRUE)
+plot_res(dfop_par_fit) # No visual lack of fit
+loftest(dfop_par_fit) # no lack of fit found by the test
+#
+# The anova model used for comparison in the case of transformation products
+test_data_anova_2 <- dfop_par_fit$data
+test_data_anova_2$variable <- as.factor(test_data_anova_2$variable)
+test_data_anova_2$time <- as.factor(test_data_anova_2$time)
+anova_fit_2 <- lm(observed ~ time:variable - 1, data = test_data_anova_2)
+summary(anova_fit_2)
+}
+}
+\seealso{
+lrtest
+}
diff --git a/man/lrtest.mkinfit.Rd b/man/lrtest.mkinfit.Rd
index bc8ab4dc..84d7bc99 100644
--- a/man/lrtest.mkinfit.Rd
+++ b/man/lrtest.mkinfit.Rd
@@ -2,12 +2,16 @@
% Please edit documentation in R/lrtest.mkinfit.R
\name{lrtest.mkinfit}
\alias{lrtest.mkinfit}
+\alias{lrtest.mmkin}
\title{Likelihood ratio test for mkinfit models}
\usage{
\method{lrtest}{mkinfit}(object, object_2 = NULL, ...)
+
+\method{lrtest}{mmkin}(object, ...)
}
\arguments{
-\item{object}{An \code{\link{mkinfit}} object}
+\item{object}{An \code{\link{mkinfit}} object, or an \code{\link{mmkin}} column
+object containing two fits to the same data.}
\item{object_2}{Optionally, another mkinfit object fitted to the same data.}
diff --git a/man/plot.mmkin.Rd b/man/plot.mmkin.Rd
index 333998da..605e458e 100644
--- a/man/plot.mmkin.Rd
+++ b/man/plot.mmkin.Rd
@@ -8,7 +8,7 @@ of an mmkin object}
\method{plot}{mmkin}(x, main = "auto", legends = 1,
resplot = c("time", "errmod"), show_errmin = TRUE,
errmin_var = "All data", errmin_digits = 3, cex = 0.7,
- rel.height.middle = 0.9, ...)
+ rel.height.middle = 0.9, ymax = "auto", ...)
}
\arguments{
\item{x}{An object of class \code{\link{mmkin}}, with either one row or one
@@ -36,6 +36,8 @@ chi2 error percentage.}
\item{rel.height.middle}{The relative height of the middle plot, if more
than two rows of plots are shown.}
+\item{ymax}{Maximum y axis value for \code{\link{plot.mkinfit}}.}
+
\item{\dots}{Further arguments passed to \code{\link{plot.mkinfit}} and
\code{\link{mkinresplot}}.}
}
diff --git a/man/sigma_twocomp.Rd b/man/sigma_twocomp.Rd
index 3e7854f1..0004144f 100644
--- a/man/sigma_twocomp.Rd
+++ b/man/sigma_twocomp.Rd
@@ -2,7 +2,7 @@
% Please edit documentation in R/sigma_twocomp.R
\name{sigma_twocomp}
\alias{sigma_twocomp}
-\title{Two component error model}
+\title{Two-component error model}
\usage{
sigma_twocomp(y, sigma_low, rsd_high)
}

Contact - Imprint