pregression

package module
v0.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 17, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AIC

func AIC(_n, _k int, rss float64, correction bool) float64

AIC is function to calculate Akaike Information Criterion of model n is number of observation k is number of model parameter, in this case, degree of polynomial model rss is residual sum of square. this can be retreived by RssSst function correction is whether to apply correction for small number of observation

func Auto

func Auto(x []float64, y []float64) ([]float64, float64, error)

Auto is to conduct polynomial regression and return optimal model based on AICc(Akaike Information Criterion) x is slice of input, y is slice of observation output is (slice of coefficient, R squared, error) slice of coefficient will have length of d + 1 if length of x and y unmatches, it will return err

func BIC

func BIC(_n, _k int, rss float64) float64

BIC is function to calculate Bayesian Information Criterion of model n is number of observation k is number of model parameter, in this case, degree of polynomial model rss is residual sum of square. this can be retreived by RssSst function

func Calculate

func Calculate(x []float64, w []float64) []float64

Calculate is function to calculate model value of input x is input vector, w is coefficient of polynomial regression model.

func FixedDegree

func FixedDegree(x []float64, y []float64, d int) ([]float64, error)

FixedDegree is to conduct polynomial regression with fixed degree x is slice of input, y is slice of observation, d is degree of polynomial equation output is (slice of coefficient, error) slice of coefficient will have length of d + 1 if length of x and y unmatches, it will return err

func SseSstSsr

func SseSstSsr(x []float64, y []float64, w []float64) (float64, float64, float64)

RssSst is function to calculate Residual Sum of Squared (RSS) and Total Sum of Squared(SST) R squared can be calculated by dividing RSS by SST

func Vandermonde

func Vandermonde(x []float64, d int) *mat.Dense

Vandermonde is function to create vandermonde matrix. There is two parameters which are x and d x is inputs d is degree of Vandermonde matrix if d is 3, first row of matrix will be [1, x, x^2, x^3]

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL