# library trend

## Analyze data and try to find a significant trend ### revisor/trend

Analyze data and try to find a significant trend

• Friday, February 3, 2017
• by Revisor
• Repository
• 2 Watchers
• 2 Stars
• 25 Installations
• PHP
• 1 Dependents
• 0 Suggesters
• 0 Forks
• 1 Open issues
• 3 Versions
• 0 % Grown

# Trend Calculator

Analyze data and try to find a significant trend., (*2)

## Introduction

Imagine you're looking at points in a graph and you want to draw a single line through the points that represents their change. This is what Trend Calculator does. It tells you if there is a line through the points and how steep it is., (*3) , (*4)

This class takes as an input a series of data points in time, performs regression, determines its statistical significance and returns a trend., (*5)

Time is the independent/explanatory variable, values are the dependent/outcome/target variable. In simplest terms:, (*6)

"How does value change in time?", (*7)

## Installation

Install Trend Calculator with the PHP package manager, Composer:, (*8)

``` bash composer require revisor/trend, (*9)

```## Usage

``` php
\$trendCalculator = new TrendCalculator();

/**
* \$data is an array of arrays
* In the inner arrays, keys are a time value in any unit (seconds, ie.
* timestamp, microseconds, days, weeks...), the values are data values.
* Multiple values for one point in time are allowed - maybe two events
* occurred at one time.
*/
\$data = [
[1 => 9],
[1 => 5],
[2 => 12],
[4 => 7]
];

/**
* The resulting trend is a negative or positive float, or zero.
*
* Values other than zero mean that there is a significant trend in the provided
* data, and the trend goes down (for a negative number) or up (for a positive number).
*
* If the value is zero, it means that there is no significant trend.
*/
\$trend = \$trendCalculator->calculateTrend(\$data);
```

The slope of the trend is calculated by `mcordingley/Regression`. You can access more information about your data by asking the regression itself., (*10)

```php \$regression = \$trendCalculator->getRegression(); var_dump(\$regression->getStandardErrorCoefficients());```, (*11)

## Contributing

Please see CONTRIBUTING for details., (*13)

## Credits

03/02 2017

### dev-regression-v1

dev-regression-v1 https://github.com/Revisor/trend

Analyze data and try to find a significant trend

MIT

#### The Development Requires

###### by Martin Schlemmer

regression trend correlation significance

11/01 2017

### dev-master

9999999-dev https://github.com/Revisor/trend

Analyze data and try to find a significant trend

MIT

#### The Development Requires

###### by Martin Schlemmer

regression trend correlation significance

11/01 2017

### 0.1.0

0.1.0.0 https://github.com/Revisor/trend

Analyze data and try to find a significant trend

MIT

#### The Development Requires

###### by Martin Schlemmer

regression trend correlation significance