# Plugin Design - Regressions

Description | Attributes | Coefficient Names | Statistics | See Also

## Description

Draco includes a specialized class to aid in creating regression plugins. The class, Plugin::RegressionPluginSkeleton, is meant to simplify the generation of results for regressions which conform to the simple regression attributes:

- Coefficients with standard errors and t-scores are calculated
- A covariance matrix is computed
- Coefficient names are based on variable names

For example, the results would be applicable for oridinary least squares or probit MLE calculations.

## Necessary Attributes

Regression plugins are expected to assign values to attributes during calculations for results generation. The attributes are defined as follows:

Attribute | Expected Type | Description
@coef_names | array of strings | An array of strings that define the display names for each calculated coefficient (see below)
@covariance | Matrix | A matrix representing the covariance matrix resulting from the regression
@failure | string or nil | A string if the regression failed containing the reason, or nil otherwise
@statistics | array of arrays | An array of two-element arrays containing a statictic name and a value (see below)
@stderr | Vector | A vector representing the standard error of the coefficients
@tscores | Vector | A vector representing the t-scores for each coefficient
@x | Vector | A vector containing the estimates of the coefficients

## Assigning Coefficient Names

Coefficient names can be automatically generated using a call to the generate_coef_names method. The method accepts an array of strings, presumably independent variable names, and generates appropriate coefficient names. The method also calls the method has_constant? to determine if a coefficient name of "Constant" should be included; the has_constant? method should be overridden appropriately to return a boolean.

## Assigning Statistics

Statistics can be added to results via calls to the statistic method. The method is used as follows:
`statistic name, value`
The name should be the plain text name of the statistic to display, and value should be a numeric result.

## See Also

Plugin Design - Necessities
Plugin System Technical

Copyright © 2008 Approximatrix, LLC
Text licensed under the Creative Commons Attribution-Share Alike 3.0 License
DracoTM and the Approximatrix logo are trademarks of Approximatrix, LLC
Other trademarks are property of their respective owners