Learn R Programming

MHDA (version 2.0)

Steps.analysis: Stepwise analysis of a series of numeric observations on multiple levels of rhythms

Description

It's a function to conduct stepwise analysis on a series of numeric observations, specifically stepwisely computing the mean of observations on each rhythm. Missing observations are allowed. Neither the number of rhythms nor the number of steps on any rhythm is of limit.

Usage

Steps.analysis(ID, Tag, S, Rhythms, Start, plot, pick.plot)

Value

A list. The first element of the list is the series of the mean values along the whole periodic rhythms. The second element of the list shows the total mean on each rhythm.

Arguments

ID

Character String. Label for the data.

Tag

Character String. Label for the data.

S

Numeric. A series of numeric numbers. Missing observations are allowed in the series.

Rhythms

Integer vector. Each element of the vector is the number of steps on the corresponding rhythm. For example, Rhythms=c(7,5,3,2,4) means there are five rhythms with the number of steps on each being 7,5,3,2,4, respectively.

Start

Character String. Description for the initial number with format "a+b", where a and b are integers. For example, Start="2+3" means that the initial observation in S is the third step in the second rhythm.

plot

Logical. TRUE for stepwise plotting of the whole periodic rhythms. FALSE for not plotting.

pick.plot

Integer vector. Each element of the vector is the index of a rhythms to be plotted isolatedly. For example, pick.plot=1 is meant to be plotting only the first rhythm and pick.plot=c(4,2) is meant to be plotting the fourth rhythm and then plotting the second rhythm.

Author

Yarong Yang

References

Yarong Yang and Jacob Zhang.(2025) MHDA: Massive Hierarchically Data Analysis. manuscript in preparation

Examples

Run this code

data1<-abs(rnorm(150,0,1))
data2<-rep(NA,150)
data<-sample(c(data1,data2),300,replace=FALSE)
T<-paste("Rhythm",1:5,"=",c(7,5,3,2,4),sep="")
tag<-NULL
for(i in 1:length(T)) tag<-paste(tag,T[i])
Res<-Steps.analysis(ID="300 Abs Normal with Missing",Tag=tag,S=data,Rhythms=c(7,5,3,2,4),
Start="3+1",plot=TRUE,pick.plot=NULL) 
Res<-Steps.analysis(ID="300 Abs Normal with Missing",Tag=tag,S=data,Rhythms=c(7,5,3,2,4),
Start="3+1",plot=FALSE,pick.plot=c(3,5,2)) 

 

Run the code above in your browser using DataLab