examples.ml.example1.example.md Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jstat Show documentation
Show all versions of jstat Show documentation
Java Library for Statistical Analysis.
The newest version!
# Example 1: Linear Regression
## Contents
* [Overview](#overview)
* [Linear Regression](#linear_regression)
* [How Good Is The Fit?](#how_good_is_the_fit)
* [```R^2``` Coefficient](#r2_coefficient)
* [Include files](#include_files)
* [Program structure](#prg_struct)
* [The main function](#m_func)
* [Results](#results)
* [Source Code](#source_code)
## Overview
This example discusses the linear regression model. In Statistics, linear regression is a mathematical approach to model
the relationship between a scalar response (or dependent variable) and one or more explanatory variables (or independent variables).
The case of one explanatory variable is called simple linear regression. For more than one explanatory variable, the process is called multiple linear regression
(checkout the wikipedia article Linear regression).
Contrary to classification that is concerned with
class indexes, the outcome of a linear regression model or more general of a regression model is a real number.
### Linear Regression
![LinearRegression](linear_regression.png)
### How Good Is The Fit?
So we established the linear regression model but how can we measure how good it is?
One metric to do so is the so-called ```R^2``` Coefficient also called the Coefficient of determination
#### ```R^2``` Coefficient
The coefficient is defined as
![R2](r2.gif)
where SSR and SST are defined respectively as
![SSR](ssr.gif)
![SST](sst.gif)
## Import files
```
```
## The main function
```
int main(){
```
## Results
```
```
## Source Code
Example1.java