Giter VIP home page Giter VIP logo

ccharter's Introduction

NOTE: This repository is no longer maintained.

ccharter

Control Charts made easy. ccharter focus on calculating control systems in a series and plotting them as an overlay to it.

Installation

  • You can install from github with:

    if ( !("devtools" %in% installed.packages()) ) {
       install.packages("devtools")
    }
    devtools::install_github("jbaxx/ccharter")

Using ccharter

The ccharter package comes with two main functions:

  • ccpoints to calculate Control Systems points from a series data frame
  • cc2plot to plot the Control Systems points (Control Chart)

Loading the package

library(ccharter)

Calculating the Control Systems points

  • An example usage of ccpoints:
# Create a random time series
set.seed(154)
time.series <- data.frame(t.dates = seq.Date(as.Date("2014-02-01"), as.Date("2016-08-01"), "month"),
               t.values = c(
               seq(0.1, 0.8, by = 0.1) * runif(8) + 3,
               seq(0.1, 0.7, by = 0.1) * runif(7) + 4,
               seq(0.1, 0.7, by = 0.1) * runif(7) + 5,
               seq(0.1, 0.4, by = 0.1) * runif(4) + 4,
               seq(0.1, 0.5, by = 0.1) * runif(5) + 4)
               )

# Execute function
control.chart.data <- ccpoints(time.series, "t.dates", "t.values")

If we inspect the object we may find it's a list consisting in the following elements:

  1. The input time series along with the calculated mean and sd for each system
  2. The name of the dates column
  3. The name of the values column
  4. The count of systems result
  5. The summary of missing values removed
  6. The reference point of last break
  7. The weeks since last break (if date values were provided)
  8. The next break expectation, above or below of current system
  9. The points remaining for a new system break
# Inspecting cchart object content
lapply(control.chart.data, head)
#> $data
#>      t.dates t.values data.mean  data.ll  data.ul
#> 1 2014-02-01 3.071129  3.217276 2.996493 3.438059
#> 2 2014-03-01 3.140564  3.217276 2.996493 3.438059
#> 3 2014-04-01 3.008430  3.217276 2.996493 3.438059
#> 4 2014-05-01 3.243547  3.217276 2.996493 3.438059
#> 5 2014-06-01 3.442773  3.217276 2.996493 3.438059
#> 6 2014-07-01 3.029862  3.217276 2.996493 3.438059
#> 
#> $dates.name
#> [1] "t.dates"
#> 
#> $values.name
#> [1] "t.values"
#> 
#> $systems_count
#> [1] 4
#> 
#> $missing_values
#> [1] NA
#> 
#> $point_last_break
#> [1] "2015-12-01"
#> 
#> $weeks_since_last_break
#> Time difference of 57 weeks
#> 
#> $next_break
#> [1] "Next system expected to break negative"
#> 
#> $next_break_values
#> Continous points vs mean:  
#>                          6

To extract the data frame, we can access it from the list in the following way:

control.chart.data[["data"]]

Plotting the Control Systems points

This is how the example series looks like:

  • An example usage of cc2plot:
# Passing the cchart object to the cc2plot function
cc2plot(control.chart.data)

For detailed functions documentation you can access the help files in R with ?ccpoints and ?cc2plot.

Integration with KNIME: ccharter

Here you may find a brief guide on how to integrate the package in a KNIME workflow.

ccharter's People

Contributors

jbaxx avatar

Stargazers

Mariah avatar

Watchers

James Cloos avatar  avatar Cesar Espana avatar

Forkers

cesarespana

ccharter's Issues

Bug: missing dates

Function: ccpoints
If input data frame has missing dates values (NA). Upon ordering data frame (time series) by date, those rows are sent to the end.

Proposed solution:
Since an ordered time series needs to be forced.

  1. Remove points from data frame
  2. Print a warning message stating that points have been removed

Handle datasets without date fields

If no date field or the user wants to force a different set of columns to be plotted (e.g.: volume drop (Y) vs. price index (X)), let them. A different variable will let the user decide if the dataset is to be assumed as sorted or needs to be sorted based on a column

Feature: Deal with most date formats

For function ccpoints, currently the date values needs to be entered in an specific format ("mm-dd-yyy"), regardles of data type (date or character). If provided in other format, throws a warning and all dates are set to NA.

To: introduce a way to accept more commons date formats in order to make it more user friendly and avoid this type of issues.

Feature: bot metadata

Add to the ccpoints function as metadata:

  • Date of last break
  • Days since last break
  • Next break projected to be positive or negative?
  • Future points required above/below average to break the system
  • Future points above/below sd to break the system

Bug: missing data point values

If input data frame for ccpoints has missing data points values (NA), throws an error and halts execution.
Error due to mean and sd not knowing how to deal with NA values.

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.