# getFeatures: Compute the quadratic, linear, and/or discrete features of... In pnnl/qFeature: Extract Features from Continuous or Discrete Time Series

## Description

Fits the moving window quadratic (or linear) regression model for each continuous variable in a data frame, and calculates summary statistics of the parameters. Also calculates the duration and transition features of discrete variables.

## Usage

 ```1 2 3``` ```getFeatures(y, cont = NULL, disc = NULL, centerScale = TRUE, stats = c("min", "q1", "mean", "med", "q3", "max", "sd", "count"), fitQargs = NULL) ```

## Arguments

 `y` Data frame, each row containing a vector of measurements for a particular point in time, with columns indicating the discrete and/or continuous measured variables (and possibly other descriptive variables). The data processed presuming the rows are orderd chronologically. `cont` Vector of integers or a character vector indicating the columns of `x` that correspond to continuous variables. These are the variables from which features will be extracted by fitting the moving regression model using `fitQ`. `disc` Vector of integers or character vector indicating the columns of `x` that correspond to variables that will be treated as discrete. These are the variables from which features will be extracted using `discFeatures`. `centerScale` Logical indicating whether the continuous variables (indicate by `cont`) should be centered and scaled by the global mean and standard deviation of that variable. By 'global', we mean all the values of a continuous variable, say `x`, in `y` are used to compute the mean and standard deviation. The resulting value for the continuous variable, `x`, is equivalent to `y\$x <- (y\$x - mean(y\$x)) / sd(y\$x)`. `stats` This argument defines the summary statistics that will be calculated for each of the regression parameters. It can be a character vector of summary statistics, which are passed to `summaryStats`. Or the function object returned by `summaryStats` may be supplied. `fitQargs` Named list of arguments for `fitQ`. If `NULL`, the default arguments of `fitQ` are used. Any argument for `fitQ` may be included except `y`.

## Details

A least one of `cont` or `disc` must be specified.

Instead of a data frame, the `y` argument can be a `valid_getFeatures_args` object (returned by `check_getFeatures_args`), in which case all the subsequent arguments to `getFeature` are ignored (because the `valid_getFeatures_args` object contains all those arguments). This is useful if `getFeatures` is called repeatedly over the same set of argument values (which occurs in `ddply_getFeatures`.

## Value

A named vector containing the features for each of the variables requested in `cont` and `disc`. The names follow the form [varname].[description], where the [varname] is specified in `cont` and `disc`, and [description] follows the naming convention produced by `summary.fitQ` and `discFeatures`.

Landon Sego

## References

Amidan BG, Ferryman TA. 2005. "Atypical Event and Typical Pattern Detection within Complex Systems." IEEE Aerospace Conference Proceedings, March 2005.

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21``` ```# Load the data data(demoData) # Select a subset of thedata d <- demoData[demoData\$subject == 3 & demoData\$phase == "f",] colnames(d) # Run over that subset features <- getFeatures(d, cont = 3:4, disc = 8:11, stats = c("mean", "sd"), fitQargs = list(x1 = -5:5, start = 2)) str(features) features # We can also call the function by validating the arguments before hand: validated <- check_getFeatures_args(d, cont = 3:4, disc = 8:11, stats = c("mean", "sd"), fitQargs = list(x1 = -5:5, start = 2)) features1 <- getFeatures(validated) # We get the same result identical(features1, features) ```

pnnl/qFeature documentation built on May 25, 2019, 10:22 a.m.