New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

linearcorrelation

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

linearcorrelation

JavaScript library that performs linear regression and recovers residuals and normalized residuals

latest
Source
npmnpm
Version
0.1.0
Version published
Weekly downloads
5
66.67%
Maintainers
1
Weekly downloads
 
Created
Source

linearcorrelation

npm jsdeliver license code size

linearcorrelation is a tiny JavaScript library that performs linear regression and recovers residuals and normalized residuals.

1. Installation

In browser

<script src="https://cdn.jsdelivr.net/npm/linearcorrelation" charset="utf-8"></script>

In Observable

Last version

corr = require("linearcorrelation")

2. Functions

test()

the test function calculates indicators to measure the degree of association between two quantitative variables. The test returns the linear correlation (Pearson), the rank correlation (Spearman) and the number of missing data not taken into account in the calculations.

test(data, {x: "gdp", y:"co2" })

It is also possible to calculate the relation with the log of the variables

test(data, {x: "gdp", y:"co2", logx: true, logy: false })

lm()

The lm function calculates linear regression. It returns the regression line function and the coefficient of determination (rsquared). It also returns data with residuals and normalized residuals. As before, the parameters logx and logy can be used to transform variables into log.

lm(data, {x: "gdp", y:"co2", logx: true, logy: false })

3. Demo

A live demo is available on this Observable notebook: https://observablehq.com/@neocartocnrs/corr

Keywords

statistics

FAQs

Package last updated on 06 Jul 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts