This file contains hidden or 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
####################### | |
# | |
# short investigation of id'ing breakpoints in data | |
# | |
# [email protected] | |
library("bcp") | |
library("ggplot2") | |
library("changepoint") | |
library("reshape") |
This file contains hidden or 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
# improved list of objects | |
.ls.objects <- function (pos = 1, pattern, order.by, | |
decreasing=FALSE, head=FALSE, n=5) { | |
napply <- function(names, fn) sapply(names, function(x) | |
fn(get(x, pos = pos))) | |
names <- ls(pos = pos, pattern = pattern) | |
obj.class <- napply(names, function(x) as.character(class(x))[1]) | |
obj.mode <- napply(names, mode) | |
obj.type <- ifelse(is.na(obj.class), obj.mode, obj.class) | |
obj.size <- napply(names, object.size) |
This file contains hidden or 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
arch_test <- function (x, order=10){ | |
# AutoRegressive Conditional Heteroskedasticity (ARCH) estimator | |
xsq <- x^2 | |
nobs <- length(x) | |
inds <- outer(0:(nobs - order - 1), order:1, "+") | |
xmat <- xsq[inds] | |
dim(xmat) <- dim(inds) | |
xreg <- lm(xsq[-1:-order] ~ xmat) | |
summary(xreg)$r.squared * (nobs - order) | |
} |
This file contains hidden or 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 washer.AV in R-language | |
## Original Author : Andrea Venturini ([email protected]) | |
## Venturini, A. (2011). Time Series Outlier Detection: A New Non Parametric Methodology | |
## (Washer). Statistica 71: 329-344. | |
################################################################################################ | |
washer.AV = function( dati ) # p t i y | |
{ # dati structure: phenom./date/series/values/... other | |
# example: Phenomenon Time Zone Value ... | |
# ----------- -------- -- ----- -------- |
This file contains hidden or 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
cria.tau <- function(data){ | |
# Giolo, Suely Ruiz. "Turnbull's nonparametric estimator for interval-censored data'." | |
# Department of Statistics, Federal University of Paraná (2004): 1-10. | |
l <- data$left | |
r <- data$right | |
tau <- sort(unique(c(l,r[is.finite(r)]))) | |
return(tau) | |
} |
This file contains hidden or 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
# Copyright 2012 Felix Schönbrodt | |
# All rights reserved. | |
# | |
# FreeBSD License | |
# | |
# Redistribution and use in source and binary forms, with or without | |
# modification, are permitted provided that the following conditions are | |
# met: | |
# | |
# 1. Redistributions of source code must retain the above copyright |
This file contains hidden or 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
gastwirth <- function(x,...){ | |
# gastwirth's location estimator | |
# discussed in Ronald Pearson's Exploring Data in Engineering, the Sciences, and Medicine | |
# and at http://exploringdatablog.blogspot.com/2012/03/gastwirths-location-estimator.html | |
ordstats = quantile(x, probs=c(1/3,1/2,2/3),...) | |
weights = c(0.3,0.4,0.3) | |
sum(weights*ordstats) | |
# | |
} |
This file contains hidden or 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
# minor changes from script by dsparks | |
# Letting plyr do the work for us. | |
# | |
# Install and load needed packages | |
doInstall <- TRUE # Change to FALSE if you don't want packages installed. | |
toInstall <- c("foreign", "plyr", "Hmisc", "ggplot2") | |
toInstall <- toInstall[!toInstall%in%library()$results[,1]] #check if present | |
if(doInstall&length(toInstall)!=0) | |
{install.packages(toInstall, repos = "http://cran.r-project.org")} |
NewerOlder