# cogSlope: Compute Slope of Linear Fit Cognostic In trelliscope: Create and Navigate Large Multi-Panel Visual Displays

## Description

Compute the slope of a linear fit as a cognostic to be used in a trelliscope display.

## Usage

 ```1 2 3``` ```cogSlope(..., desc = "Slope of fitted line", group = "common", defLabel = FALSE, defActive = TRUE, filterable = TRUE, sortable = TRUE, log = FALSE) ```

## Arguments

 `desc, group, defLabel, defActive, filterable, sortable, log` arguments passed to `cog` `...` arguments to be passed to `link{loess}`, such as the formula, data, smoothing parameters, etc.

`cog`
 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33``` ```d <- stack(data.frame(EuStockMarkets)) d\$time <- rep(as.numeric(time(EuStockMarkets)), 4) d\$year <- floor(d\$time) byIndexYear <- divide(d, by = c("ind", "year")) cogFn <- function(x) list(lormse = cogLoessRMSE(values ~ time, data = x, span = 0.3, degree = 2), slope = cogSlope(values ~ time, data = x), range = cogRange(x\$values), mean = cogMean(x\$values), max = cog(max(x\$values, na.rm = TRUE), desc = "max value")) applyCogFn(cogFn, byIndexYear[[1]]) library(lattice) panelFn <- function(x) xyplot(values ~ time, data = x, panel = function(x, y, ...) { panel.xyplot(x, y, ...) panel.loess(x, y, span = 0.3, degree = 2, evaluation = 200, col = "black") }) vdbConn(tempfile(), autoYes = TRUE) makeDisplay(byIndexYear, name = "ts_index_year", cogFn = cogFn, panelFn = panelFn) ## Not run: # sort and fiter the index/year panels by slope and loess RMSE view(name = "ts_index_year") ## End(Not run) ```