% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/print-export-outlier.R, R/outlier.R
\name{print.sc_outlier}
\alias{print.sc_outlier}
\alias{export.sc_outlier}
\alias{outlier}
\title{Handling outliers in single-case data}
\usage{
\method{print}{sc_outlier}(x, digits = "auto", ...)

\method{export}{sc_outlier}(object, caption = NA, footnote = NA, filename = NA, ...)

outlier(
  data,
  dvar,
  pvar,
  mvar,
  method = c("MAD", "Cook", "SD", "CI"),
  criteria = 3.5
)
}
\arguments{
\item{x}{An object returned by \code{\link[=outlier]{outlier()}}}

\item{digits}{The minimum number of significant digits to be use.
If set to "auto" (default), values are predefined.}

\item{...}{Further parameters passed to the print function}

\item{object}{An scdf or an object exported from a scan function.}

\item{caption}{Character string with table caption. If left NA (default) a
caption will be created based on the exported object.}

\item{footnote}{Character string with table footnote. If left NA (default) a
footnote will be created based on the exported object.}

\item{filename}{String containing the file name. If a filename is given the
output will be written to that file.}

\item{data}{A single-case data frame. See \code{\link[=scdf]{scdf()}} to learn about this
format.}

\item{dvar}{Character string with the name of the dependent variable.
Defaults to the attributes in the scdf file.}

\item{pvar}{Character string with the name of the phase variable. Defaults to
the attributes in the scdf file.}

\item{mvar}{Character string with the name of the measurement time variable.
Defaults to the attributes in the scdf file.}

\item{method}{Specifies the method for outlier identification. Set \code{method = "MAD"} for mean average deiviation, \code{method = "SD"} for standard
deviations, \code{method = "CI"} for confidence intervals, \code{method = "Cook"} for
Cook's Distance based on the Piecewise Linear Regression Model.}

\item{criteria}{Specifies the criteria for outlier identification. Based on
the \code{method} setting.}
}
\value{
\tabular{ll}{
    \tab  \cr
   \code{data} \tab A single-case data frame with substituted outliers. \cr
   \code{dropped.n} \tab A list with the number of dropped data points for each single-case. \cr
   \code{dropped.mt} \tab A list with the measurement-times of dropped data points for each single-case (values are based on the mt variable of each single-case data frame). \cr
   \code{sd.matrix} \tab A list with a matrix for each case with values for the upper and lower boundaries based on the standard deviation. \cr
   \code{ci.matrix} \tab A list with a matrix for each single-case with values for the upper and lower boundaries based on the confidence interval. \cr
   \code{cook} \tab A list of Cook's Distances for each measurement of each single-case. \cr
   \code{criteria} \tab Criteria used for outlier analysis. \cr
   \code{N} \tab Number of single-cases. \cr
   \code{case.names} \tab Case identifier. \cr
}
}
\description{
Identifies and drops outliers within a single-case data frame (scdf).
Outliers can be identified based on mean average deviation (MAD),
standard deviation (SD), confidence intervals (CI), or Cook's Distance
from a Piecewise Linear Regression Model.
}
\details{
For \code{method = "SD"}, \code{criteria = 2} would refer t0 two standard
deviations. For \code{method = "MAD"}, \code{criteria = 3.5} would refer to 3.5 times
the mean average deviation. For \code{method = "CI"}, \code{criteria = 0.99} would
refer to a 99 percent confidence interval. For \code{method = "cook"}, \code{criteria = "4/n"} would refer to a Cook's Distance greater than 4/n.
}
\section{Functions}{
\itemize{
\item \code{print(sc_outlier)}: Print results

\item \code{export(sc_outlier)}: Export html results

}}
\examples{

## Identify outliers using 1.5 standard deviations as criterion
susanne <- random_scdf(level = 1.0)
res_outlier <- outlier(susanne, method = "SD", criteria = 1.5)
res_outlier

## Identify outliers in the original data from Grosche (2011)
## using Cook's Distance greater than 4/n as criterion
res_outlier <- outlier(Grosche2011, method = "Cook", criteria = "4/n")
res_outlier

}
\seealso{
Other data manipulation functions: 
\code{\link{add_l2}()},
\code{\link{as.data.frame.scdf}()},
\code{\link{as_scdf}()},
\code{\link{batch_apply}()},
\code{\link{fill_missing}()},
\code{\link{moving_median}()},
\code{\link{ranks}()},
\code{\link{rescale}()},
\code{\link{scdf}()},
\code{\link{select_cases}()},
\code{\link{set_vars}()},
\code{\link{shift}()},
\code{\link{smooth_cases}()},
\code{\link{standardize}()},
\code{\link{truncate_phase}()}
}
\author{
Juergen Wilbert
}
\concept{data manipulation functions}
\keyword{manip}
