plotAcc: Plots accelerometer data

Description Usage Arguments Value Author(s) Examples

View source: R/plotAcc.R

Description

Plots accelerometer data. This function receives summary object from function accsummary.

Usage

1
plotAcc(object,markbouts)

Arguments

object

An object returned from either the function accsummary.

markbouts

Whether to mark bouts. If markbout='TRUE' a bar along the time axis will indicate whether the epoch was counted as in bout or not. Default is false.

Value

A plot is returned.

Author(s)

Jaejoon Song <jjsong2@mdanderson.org>

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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
## Not run: 
##
## Example: Simulate a dataset for two days, for an individual with low MVPA level.
##
mvpaLowData <- simAcc(timelength=(60*24*2),paLevel='low')
summary <- accSummary(data=mvpaLowData)
summary$validDates
plotAcc(summary,markbouts='FALSE')

##
## Example: Simulate a dataset for two days, for an individual with moderate MVPA level.
##
mvpaModData <- simAcc(timelength=(60*24*2),paLevel='moderate')
summary <- accSummary(data=mvpaModData, tri='FALSE', axis=NULL,
             spuriousDef=20, nonwearDef=60, minWear=600, 
             patype='MVPA',pacut=c(1952,Inf), boutsize=10, 
             tolerance='TRUE', returnbout='TRUE')
summary$validDates
plotAcc(summary,markbouts='FALSE')

##
## Example: Simulate a dataset for two days, for an individual with high MVPA level.
##
mvpaHighData <- simAcc(timelength=(60*24*2),paLevel='high')
summary <- accSummary(data=mvpaHighData, tri='FALSE', axis=NULL,
             spuriousDef=20, nonwearDef=60, minWear=600, 
             patype='MVPA',pacut=c(1952,Inf), boutsize=10, 
             tolerance='TRUE', returnbout='TRUE')
summary$validDates
plotAcc(summary,markbouts='FALSE')


##
## Example: Simulate a tri-axial dataset for five days.
##
  library(acc)
  library(mhsmm)
  seedset=1234
  minutes=(60*24*5)
  randomTime <- seq(ISOdate(2015,1,1),ISOdate(2020,1,1),"min")
  J <- 3; initial <- rep(1/J, J)
  P <- matrix(rep(NA,9),byrow='TRUE',nrow=J)

  P1 <- matrix(c(0.95, 0.04, 0.01, 
                  0.09, 0.9, 0.01, 
                  0.1, 0.2, 0.7), byrow='TRUE',nrow = J)

  b <- list(mu = c(0, 30, 2500), sigma = c(0, 30, 1000))
  model1 <- hmmspec(init = initial, trans = P1, parms.emis = b,dens.emis = dnorm.hsmm)
  x <- simulate.hmmspec(model1, nsim = (minutes), seed = seedset, rand.emis = rnorm.hsmm)

  seedset=12345
  P2 <- matrix(c(0.95, 0.04, 0.01, 
                  0.09, 0.8, 0.11, 
                  0.1, 0.1, 0.8), byrow='TRUE',nrow = J)
  model2 <- hmmspec(init = initial, trans = P2, parms.emis = b,dens.emis = dnorm.hsmm)
  y <- simulate.hmmspec(model2, nsim = (minutes), seed = seedset, rand.emis = rnorm.hsmm)

  seedset=123456
  P3 <- matrix(c(0.95, 0.04, 0.01, 
                  0.09, 0.8, 0.11, 
                  0.1, 0.1, 0.8), byrow='TRUE',nrow = J)
  model3 <- hmmspec(init = initial, trans = P3, parms.emis = b,dens.emis = dnorm.hsmm)
  z <- simulate.hmmspec(model3, nsim = (minutes), seed = seedset, rand.emis = rnorm.hsmm)

  counts <- data.frame(TimeStamp = randomTime[1:minutes], x=x$x, y=y$x, z=z$x)
  summary <- accSummary(data=counts, tri='TRUE', axis='vm',
                        spuriousDef=20, nonwearDef=60, minWear=600, 
                        patype='MVPA',pacut=c(1952,Inf), boutsize=10, tolerance='TRUE',
                        returnbout='TRUE')
summary$validDates

plotAcc(summary,markbouts='FALSE')

## End(Not run)

acc documentation built on May 1, 2019, 9:26 p.m.

Related to plotAcc in acc...