summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown2015-04-02 15:59:09 +0530
committerunknown2015-04-02 15:59:09 +0530
commitbff582e5c13b775d7d2dda17015ed8e2990c3f6d (patch)
treed22cd06be46754e55d559114de552efc5b3f7c49
parentb11662f4d96bc14843b8861fe80dc029a1804094 (diff)
downloadSysID-R-code-bff582e5c13b775d7d2dda17015ed8e2990c3f6d.tar.gz
SysID-R-code-bff582e5c13b775d7d2dda17015ed8e2990c3f6d.tar.bz2
SysID-R-code-bff582e5c13b775d7d2dda17015ed8e2990c3f6d.zip
updated documentation for the detrend function
-rw-r--r--R/detrend.R19
-rw-r--r--man/demean.Rd32
-rw-r--r--man/detrend.Rd39
-rw-r--r--man/detrend.idframe.Rd32
-rw-r--r--man/predict.detrend.Rd29
5 files changed, 83 insertions, 68 deletions
diff --git a/R/detrend.R b/R/detrend.R
index 49122c2..354ceae 100644
--- a/R/detrend.R
+++ b/R/detrend.R
@@ -18,8 +18,11 @@
#'
#' @examples
#' data(cstr)
-#' fit <- detrend(cstr)
-#' Zdetrend <- predict(fit)
+#' fit <- detrend(cstr) # remove linear trends
+#' Zdetrend <- predict(fit) # get the detrended data
+#'
+#' demean <- detrend(cstr,type="constant") # remove mean values
+#' Zcent <- predict(demean) # get the centered data
#'
#' @seealso \code{\link{predict.detrend}}, \code{\link[stats]{lm}}
#' @export
@@ -65,11 +68,19 @@ detrend <- function(data,type=c("constant","linear")[2]){
#' Detrended \code{idframe} object based on linear trend fit
#'
#' @param object an object of class \code{idframe}
-#' @param newdata An optional idframe object in which to look for variables with which
-#' to predict. If ommited, the original detrended idframe object is used
+#' @param newdata An optional idframe object in which to look for variables with
+#' which to predict. If ommited, the original detrended idframe object is used
#'
#' @return an \code{idframe} object
#'
+#' @examples
+#' data(distill)
+#' train <- dataSlice(distill,end=60) # subset the first 60 indices
+#' test <- dataSlice(distill,start=61) # subset from index 61 till the end
+#' fit <- detrend(train)
+#' Ztrain <- predict(fit)
+#' Ztest <- predict(fit,test)
+#'
#' @export
predict.detrend <- function(object,newdata=NULL,...){
diff --git a/man/demean.Rd b/man/demean.Rd
deleted file mode 100644
index 7359222..0000000
--- a/man/demean.Rd
+++ /dev/null
@@ -1,32 +0,0 @@
-% Generated by roxygen2 (4.1.0): do not edit by hand
-% Please edit documentation in R/demean.R
-\name{demean}
-\alias{demean}
-\title{Mean-Center the data}
-\usage{
-demean(data)
-}
-\arguments{
-\item{data}{an object of class \code{idframe}}
-}
-\value{
-A list containing the following elements
-
-\tabular{ll}{
- \code{fitted.values} \tab \code{idframe} object with mean-centered variables \cr
- \code{output.mean} \tab \code{vector} containing means for each output variable \cr
- \code{input.mean} \tab \code{vector} containing means for each input variable
- }
-}
-\description{
-Mean Centers the input and output matrices.
-}
-\examples{
-data(cstr)
-fit.mean <- demean(cstr)
-cstr_demean <- predict(fit.mean)
-}
-\seealso{
-\code{\link{predict.demean}}, \code{\link[stats]{colMeans}}
-}
-
diff --git a/man/detrend.Rd b/man/detrend.Rd
new file mode 100644
index 0000000..b63d3a0
--- /dev/null
+++ b/man/detrend.Rd
@@ -0,0 +1,39 @@
+% Generated by roxygen2 (4.1.0): do not edit by hand
+% Please edit documentation in R/detrend.R
+\name{detrend}
+\alias{detrend}
+\title{Remove linear trends}
+\usage{
+detrend(data, type = c("constant", "linear")[2])
+}
+\arguments{
+\item{data}{an object of class \code{idframe}}
+
+\item{type}{trend type - "constant" or "linear". (Default: \code{"linear"})}
+}
+\value{
+A list containing the following elements
+
+\tabular{ll}{
+ \code{fitted.values} \tab \code{idframe} object with detrended variables \cr
+ \code{output.trend} \tab \code{list} containing trend fits for each output
+ variable \cr
+ \code{input.trend} \tab \code{list} containing trend fits for each input
+ variable
+ }
+}
+\description{
+Removes the mean value or linear trends in each of the input and output matrices.
+}
+\examples{
+data(cstr)
+fit <- detrend(cstr) # remove linear trends
+Zdetrend <- predict(fit) # get the detrended data
+
+demean <- detrend(cstr,type="constant") # remove mean values
+Zcent <- predict(demean) # get the centered data
+}
+\seealso{
+\code{\link{predict.detrend}}, \code{\link[stats]{lm}}
+}
+
diff --git a/man/detrend.idframe.Rd b/man/detrend.idframe.Rd
deleted file mode 100644
index 973bd08..0000000
--- a/man/detrend.idframe.Rd
+++ /dev/null
@@ -1,32 +0,0 @@
-% Generated by roxygen2 (4.1.0): do not edit by hand
-% Please edit documentation in R/detrend.R
-\name{detrend.idframe}
-\alias{detrend.idframe}
-\title{Remove linear trends}
-\usage{
-detrend.idframe(data)
-}
-\arguments{
-\item{data}{an object of class \code{idframe}}
-}
-\value{
-A list containing the following elements
-
-\tabular{ll}{
- \code{fitted.values} \tab \code{idframe} object with detrended variables \cr
- \code{output.trend} \tab \code{list} containing trend fits for each output variable \cr
- \code{input.trend} \tab \code{list} containing trend fits for each input variable
- }
-}
-\description{
-Removes the linear trends in the input and output matrices.
-}
-\examples{
-data(cstr)
-fit <- detrend.idframe(cstr)
-cstr_detrend <- predict(fit)
-}
-\seealso{
-\code{\link{predict.detrend.idframe}}, \code{\link[stats]{lm}}
-}
-
diff --git a/man/predict.detrend.Rd b/man/predict.detrend.Rd
new file mode 100644
index 0000000..d6d68f4
--- /dev/null
+++ b/man/predict.detrend.Rd
@@ -0,0 +1,29 @@
+% Generated by roxygen2 (4.1.0): do not edit by hand
+% Please edit documentation in R/detrend.R
+\name{predict.detrend}
+\alias{predict.detrend}
+\title{Predict method for trend fits on idframe objects}
+\usage{
+\method{predict}{detrend}(object, newdata = NULL, ...)
+}
+\arguments{
+\item{object}{an object of class \code{idframe}}
+
+\item{newdata}{An optional idframe object in which to look for variables with
+which to predict. If ommited, the original detrended idframe object is used}
+}
+\value{
+an \code{idframe} object
+}
+\description{
+Detrended \code{idframe} object based on linear trend fit
+}
+\examples{
+data(distill)
+train <- dataSlice(distill,end=60) # subset the first 60 indices
+test <- dataSlice(distill,start=61) # subset from index 61 till the end
+fit <- detrend(train)
+Ztrain <- predict(fit)
+Ztest <- predict(fit,test)
+}
+