movt: movt

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/reb.R

Description

This function analyzes ordered data series to identify regional biases using an moving (running) approximated t-test.

Usage

1
movt(v,span=NULL,summarize=mean)

Arguments

v

data vector

span

numeric vector. Each element is used to define the number of points to include when the approximated binomial test is applied to v. While mixed for the defaults, the span can be specified as fraction of the observation or actual sizes, but not a mixture - defaults to: seq(25,length(v)*.3,by=5)

summarize

function that is used to summarize the results from multiple spans. if NULL, a matrix with length(span) rows and length(v) columns is returned.

Details

movt acts very similar to movbin

Value

Either a matrix or a vector containing the summarized z-scores from the applied t-test.

Author(s)

Kyle A. Furge, Ph.D., kyle.furge@vai.org and Karl J. Dykema, karl.dykema@vai.org

See Also

movbin

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
x <- c(rnorm(50,mean=1),rnorm(50,mean=-1),rnorm(100))
layout(1:2)
plot(x,type="h",ylim=c(-5,5))

## apply the approximated binomial with a single span
mb <- movbin(x,span=25,summarize=NULL)
lines(mb[1,])

## try a few different span ranges
mb <- movt(x,span=c(10,25,50),summarize=NULL)
lines(mb[1,])  ## span of 10
lines(mb[2,])  ## span of 25
lines(mb[3,])  ## span of 50

## average the results from the different spans
plot(x,type="h",ylim=c(-5,5))

mb <- movt(x,span=c(10,25,50),summarize=mean)
lines(mb,col="blue")

mb <- movt(x,span=c(10,25,50),summarize=median)
lines(mb,col="red")  

mb <- movt(x,span=c(10,25,50),summarize=max)
lines(mb,col="green")  

reb documentation built on April 28, 2020, 8:35 p.m.