YEAR: 2017 117 | COPYRIGHT HOLDER: Thibaut Jombart 118 |119 | 120 |
R/print.projections.R
116 | print.projections.RdThis method prints the content of projections objects.
# S3 method for projections 124 | print(x, ...)125 | 126 |
| x | 131 |A |
132 |
|---|---|
| ... | 135 |further parameters to be passed to other methods (currently not 136 | used) |
137 |
As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
119 |We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion.
120 |Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
121 |Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
122 |Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
123 |This Code of Conduct is adapted from the Contributor Covenant (http:contributor-covenant.org), version 1.0.0, available at http://contributor-covenant.org/version/1/0/0/
124 |These functions convert projections objects into other classes.
# S3 method for projections 124 | as.matrix(x, ...) 125 | 126 | # S3 method for projections 127 | as.data.frame(x, ..., long = FALSE)128 | 129 |
| x | 134 |An |
136 |
|---|---|
| ... | 139 |Further arguments passed to other functions (no used). |
140 |
| long | 143 |A logical indicating if the output data.frame should be 'long', 144 | i.e. where a single column containing 'groups' is added in case of data 145 | computed on several groups. |
146 |
the project function to generate the 'projections' objects.
R/build_projections.R
117 | build_projections.RdThis function builds a valid projections object from some input
122 | simulations and dates.
build_projections(x, dates = NULL, cumulative = FALSE, order_dates = TRUE)126 | 127 |
| x | 132 |A |
134 |
|---|---|
| dates | 137 |A vector of dates containing one value per row in |
141 |
| cumulative | 144 |A logical indicating if data represent cumulative
145 | incidence; defaults to |
146 |
| order_dates | 149 |A logical indicating whether the dates should be ordered, 150 | from the oldest to the most recent one; `TRUE` by default. |
151 |
the project function to generate the 'projections'
157 | objects.
Two functions can be used to subset projections objects. The operator "[" can
123 | be used as for matrices, using the syntax x[i,j] where 'i' is a subset
124 | of dates, and 'j' is a subset of simulations.
# S3 method for projections 128 | [(x, i, j) 129 | 130 | # S3 method for projections 131 | subset(x, ..., from = NULL, to = NULL, sim = TRUE)132 | 133 |
| x | 138 |An projections object, generated by the function
139 | |
140 |
|---|---|
| i | 143 |a subset of dates to retain |
144 |
| j | 147 |a subset of groups to retain |
148 |
| ... | 151 |Further arguments passed to other methods (not used). |
152 |
| from | 155 |The starting date; data strictly before this date are discarded. |
156 |
| to | 159 |The ending date; data strictly after this date are discarded. |
160 |
| sim | 163 |(optional) The simulations to retained, indicated as subsets of 164 | the columns of x. |
165 |
The project function to generate the 'projections'
171 | objects.
This method summarises predicted epidemic trajectories contained in a 123 | `projections` object by days, deriving the mean, standard deviation, and 124 | user-specified quantiles for each day.
125 |# S3 method for projections 128 | summary( 129 | object, 130 | quantiles = c(0.025, 0.25, 0.5, 0.75, 0.975), 131 | mean = TRUE, 132 | sd = TRUE, 133 | min = TRUE, 134 | max = TRUE, 135 | ... 136 | )137 | 138 |
| object | 143 |A `projections` object to summarise |
144 |
|---|---|
| quantiles | 147 |A `numeric` vector indicating which quantiles should be 148 | computed; ignored if `FALSE` or of length 0 |
149 |
| mean | 152 |a `logical` indicating of the mean should be computed |
153 |
| sd | 156 |a `logical` indicating of the standard deviation should be computed |
157 |
| min | 160 |a `logical` indicating of the minimum should be computed |
161 |
| max | 164 |a `logical` indicating of the maximum should be computed |
165 |
| ... | 168 |only preesnt for compatibility with the generic 169 |if (require(incidence)) 170 | i <- incidence::incidence(as.Date('2020-01-23')) 171 | si <- c(0.2, 0.5, 0.2, 0.1) 172 | R0 <- 2 p <- project(x = i, 173 | si = si, 174 | R = R0, 175 | n_sim = 2, 176 | R_fix_within = TRUE, 177 | n_days = 10, 178 | model = "poisson" 179 | ) 180 | summary(p) |
181 |