MSEplot.fn: Plot the mean and standard error or standard deviation of...

View source: R/MSEplot.fn.R

MSEplot.fnR Documentation

Plot the mean and standard error or standard deviation of multiscale entropy by group

Description

function to plot the mean and standard error or standard deviation of multiscale entropy by group

Usage

MSEplot.fn(Scale, MSE, Name, responseName = NA, timeUnit = "", byGroup = TRUE,
MSEsd = NA, N = NA, stdError = TRUE, xRange = NA, yRange = NA, las = 2, col = NA,
pch = NA, Position = "topleft", cex.legend = 0.75, main = "")

Arguments

Scale

a vector for scale

MSE

matrix for entropy if byGroup=FALSE, and otherwise for average entropy value in a group at a scale. In the matrix, the row is for scale and column for individuals or groups.

Name

vector of names for groups

responseName

name to represent the response to be analyzed, such as 'glucose'

timeUnit

the time unit for scale

byGroup

If byGroup = TRUE, multiscale entropy is plotted by groups; otherwise, by individuals

MSEsd

matrix for standard deviation of entropy value in a group at a scale

N

matrix for number of subjects in a group at a scale

stdError

if it is true, the length of a vertical bar represent 2*standard error; otherwise, the length of a vertical bar represent 2*standard deviation

xRange

range for the x-axis

yRange

range for the y-axis

las

las for the y-axis

col

vector for the colors to indicate groups or individuals

pch

vector for the point types to indicate groups or individuals

Position

position for the legend

cex.legend

cex for the legend

main

main title for title()

Details

function to plot the mean and standard error or standard deviation of multiscale entropy by group

Value

No value returned

Author(s)

Xiaohua Douglas Zhang

References

Zhang XD, Zhang Z, Wang D. 2018. CGManalyzer: an R package for analyzing continuous glucose monitoring studies. Bioinformatics 34(9): 1609-1611 (DOI: 10.1093/bioinformatics/btx826).

Examples

library(CGManalyzer)
package.name <- "CGManalyzer"
source( system.file("SPEC", "SPECexample.R", package = package.name) )
scalesInTime <- Scales*equal.interval
MSE.mat <- read.csv(file=system.file("SPEC", "MSE.csv", package = package.name), row.names=1)
Types <- unique( subjectTypes )
Types <- Types[order(Types)]
nType <-length(Types)
col.vec <- rep(NA, length(subjectTypes) )
for( i in 1:nType ) { col.vec[ subjectTypes == Types[i] ] <- i }
MSEplot.fn(scalesInTime, MSE=t(MSE.mat), Name=Types, responseName="glucose", timeUnit="minute",
          byGroup=FALSE, MSEsd=NA, N=NA, stdError=TRUE, xRange=NA, yRange=NA,
          pch=rep(1, dim(MSE.mat)[1]),las=2, col=col.vec, Position="topleft",
          cex.legend=0.0005, main="A: MSE by individual")
legend("topleft", legend=paste0(Types, "(N=", table( subjectTypes ), ")"),
      col=1:nType, cex=1, lty=1, pch=1)


CGManalyzer documentation built on July 26, 2023, 5:29 p.m.