npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ctsa

v0.2.0

Published

Univariate ARIMA model

Downloads

206

Readme

ctsa

Univariate ARIMA (Autoregressive Integrated Moving Average)

Emscripten port of the native C package ctsa for univariate time series analysis and prediction.

API

Interface of ctsa consists of four functions that all take a 1D vector with observations over time.

const ctsa = require('ctsa')
const diff = ctsa.diff(ts, 1, 1) // lag, differences
const acf = ctsa.acf(ts, 20, {
  method: 0 // ACF method Default
})
const pacf = ctsa.pacf(ts, 20, {
  method: 0 // PACF method Yule-Walker Default
})
const [pred, errors] = ctsa.arima(ts, 20, {
  method: 0, // ARIMA method (Default: 0)
  optimizer: 6, // Optimization method (Default: 6)
  p: 1, // Number of Autoregressive coefficients
  d: 0, // Number of times the series needs to be differenced
  q: 1, // Number of Moving Average Coefficients
  verbose: true // Output model analysis to console
})
const [pred, errors] = ctsa.sarima(ts, 20, {
  method: 0, // ARIMA method (Default: 0)
  optimizer: 6, // Optimization method (Default: 6)
  p: 1, // Number of Autoregressive coefficients
  d: 0, // Number of times the series needs to be differenced
  q: 1, // Number of Moving Average Coefficients
  s: 12, // Seasonal lag
  P: 0, // Number of seasonal Autoregressive coefficients
  D: 1, // Number of seasonal times the series needs to be differenced
  Q: 1, // Number of seasonal Moving Average Coefficients
  verbose: true // Output model analysis to console
})

ARIMA Method (method)

0 - Exact Maximum Likelihood Method (Default)
1 - Conditional Method - Sum Of Squares
2 - Box-Jenkins Method

Optimization Method (optimizer)

0 - Nelder-Mead
1 - Newton Line Search
2 - Newton Trust Region - Hook Step
3 - Newton Trust Region - Double Dog-Leg
4 - Conjugate Gradient
5 - BFGS
6 - Limited Memory BFGS (Default)
7 - BFGS Using More Thuente Method

ACF Method

0 - Default Method
1 - FFT Based method

PACF Method

0 - Yule-Walker
1 - Burg
2 - Conditional MLE (Box-Jenkins)

Web demo

You can try ARIMA online in the Forecast app: https://statsim.com/forecast/. It uses the original arima package under the hood and applies random search method to find the best values of p, d and q.