mean: Methods for function 'mean' in Package 'pdmpsim'

Description Usage Arguments Value Note Examples

Description

This method calculates the mean for every time value over all simulations.

Usage

1
2
3
4
5
## S3 method for class 'multSimCsv'
mean(x, ...)

## S3 method for class 'multSim'
mean(x, ...)

Arguments

x

object of class multSim or multSimCsv

...

additional arguments passed to mean

Value

data.frame with calculated mean values

Note

Methods mean.multSim and mean.multSimCsv can lead to slightly different results. The reason for this is that the simulation results created by multSimCsv are stored with a fewer number of digits.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
data(simplePdmp)
sim <- multSim(simplePdmp, seeds = 1:10)
mean(sim)

# handling NA values:
sim$outputList[[1]][1,2] <- NA
sim$outputList <- c(sim$outputList, NA) # will be removed before calculation
head(mean(sim))
head(mean(sim, na.rm = TRUE))

# Methods mean.multSim and mean.multSimCsv
# can lead to slightly different results:
sim2 <- multSimCsv(simplePdmp, seeds = 1:10)
all.equal(mean(sim), mean(sim2))

CharlotteJana/pdmpsim documentation built on July 2, 2019, 5:37 a.m.