-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsimRunExample.R
152 lines (136 loc) · 4.51 KB
/
simRunExample.R
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
#' Example Analysis Output of a Simulated Dataset
#'
#' Simulated 30-taxon coalescent tree and simulated character data from a Brownian Motion
#' intrinsic model (\code{\link{brownianIntrinsic}}), with saved generating parameters.
#' Character data was generated under this model using \code{doSimulation}.
#' Also includes results from an example analysis.
#'
#'
#' @name simRunExample
#' @aliases
#' simRunExample
#' simPhyExample simCharExample
#' resultsBMExample resultsBoundExample
#' genRateExample ancStateExample
#simCharOut
#' @docType data
#' @format
#' Loading the \code{simRunExample} example dataset adds seven new
#' objects to the namespace:
#'
#' \describe{
#' \item{\code{simPhyExample}}{A simulated 30-tip coalescent
#' phylogeny in typical \code{phylo} format.}
#' \item{\code{ancStateExample}}{The starting ancestral value,
#' used for generating the simulated continuous trait data.}
#' \item{\code{genRateExample}}{The true rate of trait change under Brownian Motion,
#' used for generating the simulated continuous trait data.}
# \item{\code{simCharOutExample}}{The raw output
# of \code{\link{doSimulation}} on \code{simPhyExample},
# under the model \code{\link{brownianIntrinsic}}.}
#' \item{\code{simCharExample}}{The output of \code{\link{doSimulation}} on \code{simPhyExample},
#' under the model \code{\link{brownianIntrinsic}}. composed of just the simulated
#' trait values as a one-column matrix with row names indicating tip
#' labels, as desired by \code{doRun} functions.}
#' \item{\code{resultsBMExample}}{The results of \code{\link{doRun_prc}},
#' under the generating model of \code{\link{brownianIntrinsic}}}
#' \item{\code{resultsBoundExample}}{The results of
#' \code{\link{doRun_prc}}, under the incorrect model
#' of \code{\link{boundaryMinIntrinsic}}}
#' }
#'
#' The objects \code{resultsBMExample} and \code{resultsBoundExample}
#' are lists composed of a number of elements (see the documentation
#' for the \code{\link{doRun_prc}} function for more detail).
#' @examples
#'
#' data(simRunExample)
#'
#' # ...things to do with this data?
#'
#' ###################
#'
#' # This data was generated using this process:
#'
#' \dontrun{
#'
#' library(TreEvo)
#'
#' set.seed(1)
#' simPhyExample <- rcoal(20)
#' # get realistic edge lengths
#' simPhyExample$edge.length <- simPhyExample$edge.length*20
#'
#' # plot with time axis (root is about ~15 Ma)
#' plot(simPhyExample)
#' axisPhylo()
#'
#' genRateExample <- c(0.001)
#' ancStateExample <- c(10)
#'
#' #Simple Brownian motion
#' simCharExample <- doSimulation(
#' phy = simPhyExample,
#' intrinsicFn = brownianIntrinsic,
#' extrinsicFn = nullExtrinsic,
#' startingValues = ancStateExample, #root state
#' intrinsicValues = genRateExample,
#' extrinsicValues = c(0),
#' generation.time = 10000
#' )
#'
#' resultsBMExample <- doRun_prc(
#' phy = simPhyExample,
#' traits = simCharExample,
#' intrinsicFn = brownianIntrinsic,
#' extrinsicFn = nullExtrinsic,
#' startingPriorsFns = "normal",
#' startingPriorsValues = list(c(mean(simCharExample[, 1]), sd(simCharExample[, 1]))),
#' intrinsicPriorsFns = c("exponential"),
#' intrinsicPriorsValues = list(10),
#' extrinsicPriorsFns = c("fixed"),
#' extrinsicPriorsValues = list(0),
#' generation.time = 10000,
#' nRuns = 2,
#' nStepsPRC = 3,
#' numParticles = 20,
#' nInitialSimsPerParam = 10,
#' jobName = "examplerun_prc",
#' stopRule = FALSE,
#' multicore = FALSE,
#' verboseParticles = TRUE,
#' coreLimit = 1
#' )
#'
#' resultsBoundExample <- doRun_prc(
#' phy = simPhyExample,
#' traits = simCharExample,
#' intrinsicFn = boundaryMinIntrinsic,
#' extrinsicFn = nullExtrinsic,
#' startingPriorsFns = "normal",
#' startingPriorsValues = list(c(mean(simCharExample[, 1]), sd(simCharExample[, 1]))),
#' intrinsicPriorsFns = c("exponential", "normal"),
#' intrinsicPriorsValues = list(10,c(-10,1)),
#' extrinsicPriorsFns = c("fixed"),
#' extrinsicPriorsValues = list(0),
#' generation.time = 10000,
#' nRuns = 2,
#' nStepsPRC = 3,
#' numParticles = 20,
#' nInitialSimsPerParam = 10,
#' jobName = "examplerun_prc_bound",
#' stopRule = FALSE,
#' multicore = FALSE,
#' verboseParticles = TRUE,
#' coreLimit = 1
#' )
#'
#' rm(.Random.seed)
#' save.image(file = "simRunExample.rdata")
#' if(interactive()){savehistory("simRunExample.Rhistory")}
#'
#' }
#'
#'
# @keywords datasets
NULL