Code Monkey home page Code Monkey logo

rolleigen's Introduction

rolleigen

Overview

rolleigen is a package that provides analytical computation of rolling and expanding eigenanalysis for time-series data.

Installation

Install the development version from GitHub:

# install.packages("devtools")
devtools::install_github("jasonjfoster/rolleigen") # roll (>= 1.1.7)

Usage

Load the package and supply a dataset:

library(rolleigen)

n <- 15
m <- 3
x <- matrix(rnorm(n * m), nrow = n, ncol = m)
y <- rnorm(n)
weights <- 0.9 ^ (n:1)

Then, to compute rolling and expanding eigenvalues and eigenvectors, use the roll_eigen function:

# rolling eigenvalues and eigenvectors with complete windows
roll_eigen(x, width = 5)

# rolling eigenvalues and eigenvectors with partial windows
roll_eigen(x, width = 5, min_obs = 1)

# expanding eigenvalues and eigenvectors with partial windows
roll_eigen(x, width = n, min_obs = 1)

# expanding eigenvalues and eigenvectors with partial windows and weights
roll_eigen(x, width = n, min_obs = 1, weights = weights)

Or use the roll_pcr function to compute rolling and expanding principal component regressions:

# rolling regressions with complete windows
roll_pcr(x, y, width = 5, n_comps = 1)

# rolling regressions with partial windows
roll_pcr(x, y, width = 5, n_comps = 1, min_obs = 1)

# expanding regressions with partial windows
roll_pcr(x, y, width = n, n_comps = 1, min_obs = 1)

# expanding regressions with partial windows and weights
roll_pcr(x, y, width = n, n_comps = 1, min_obs = 1, weights = weights)

Note that handling of missing values is supported as well (see the min_obs, complete_obs, and na_restore arguments).

rolleigen's People

Contributors

jasonjfoster avatar

Stargazers

timelyportfolio avatar  avatar

Watchers

timelyportfolio avatar  avatar Kostas Georgiou avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.