Giter Club home page Giter Club logo

jipito's Introduction

Jipito

My personal R package

Software status
Resource: Travis CI
Platform: Linux
R CMD check Build status

Why

Because I want to share pieces of code that are helpful to me.

Kolmogorov-Zurbenko filter (Iterative moving average) : kz.R

I like this filter quite a lot and used it in my recent paper to smooth eigenvectors from several genomic matrices. It's simple (k iterations of a simple moving average), fast and the degree of smoothness can be tuned easily. The two main parameters are:

  • k: number of iterations (k). Should be based on prior information if possible
  • w: smoothing window width (odd integer number).
  • optimal: should the optimality criterion discussed below be used? If set to TRUE, then k does not need to be specified since it will be chosen optimally.

In order to pick a reasonable number of iterations, I implemented an intuitive optimality criterion. Basically, I want the iterative process to stop at k iterations when the difference between the (k+1)-th and the k-th smoothed vectors is less than a specified threshold. I quantify difference as the sums of squares of the difference vector, i.e. SS(x_(k+1)-x_k), divided by the sum of squares of the k-th vector, that is SS(x_k). If the difference is less than the parameter tolerance, set by default to 0.05, then the iterative process stops. Below is an example of a vector before and after smoothing with an optimal number of iterations k=2.

library(jipito)
mybarplot(x)
mybarplot(kz(x, w=3, optimal=TRUE))

alt tag

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.