This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Function to cross-validate a time series. | |
cv.ts <- function(x, FUN, tsControl, xreg=NULL, ...) { | |
#Load required packages | |
stopifnot(is.ts(x)) | |
stopifnot(is.data.frame(xreg) | is.matrix(xreg) | is.null(xreg)) | |
stopifnot(require(forecast)) | |
stopifnot(require(foreach)) | |
stopifnot(require(plyr)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Mathieu Blondel, February 2012 | |
# License: BSD 3 clause | |
# Port to Python of examples in chapter 5 of | |
# "Introductory Statistics with R" by Peter Dalgaard | |
import numpy as np | |
from scipy.stats import ttest_1samp, wilcoxon, ttest_ind, mannwhitneyu | |
# daily intake of energy in kJ for 11 women |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
vioplot2 <- function (x, ..., range = 1.5, h = NULL, ylim = NULL, names = NULL, | |
horizontal = FALSE, col = "magenta", border = "black", lty = 1, | |
lwd = 1, rectCol = "black", colMed = "white", pchMed = 19, | |
at, add = FALSE, wex = 1, drawRect = TRUE, side="both") | |
{ | |
datas <- list(x, ...) | |
n <- length(datas) | |
if (missing(at)) | |
at <- 1:n | |
upper <- vector(mode = "numeric", length = n) |