summaryrefslogtreecommitdiff
path: root/R/seqB.R
diff options
context:
space:
mode:
authorNaeem Model <me@nmode.ca>2023-06-21 06:17:43 +0000
committerNaeem Model <me@nmode.ca>2023-06-21 06:17:43 +0000
commit9d7b542a1eb1eead875ad7f939936e4d8ac83145 (patch)
tree0412b0f36951698aadaa82ef632035397aafdc89 /R/seqB.R
parent9c1a5668803e735f034700c55028ffc0146f1e93 (diff)
Remove input args from output lists
Diffstat (limited to 'R/seqB.R')
-rw-r--r--R/seqB.R13
1 files changed, 6 insertions, 7 deletions
diff --git a/R/seqB.R b/R/seqB.R
index 0f8a1b9..7938311 100644
--- a/R/seqB.R
+++ b/R/seqB.R
@@ -51,17 +51,17 @@
#' ## ============================================================= ##
#'
#' Rpost <- res1$posterior
-#' loc <- which(Rpost$pmf==max(Rpost$pmf))
-#' Rpost$supp[loc] # posterior mode
-#' res1$Rhat # compare with posterior mean
+#' loc <- which(Rpost$pmf == max(Rpost$pmf))
+#' Rpost$supp[loc] # posterior mode
+#' res1$Rhat # compare with posterior mean
#'
-#' par(mfrow=c(2,1), mar=c(2,2,1,1))
+#' par(mfrow=c(2, 1), mar=c(2, 2, 1, 1))
#' plot(Rpost$supp, Rpost$pmf, col="black", type="l", xlab="", ylab="")
#' abline(h=1/(20/0.01+1), col="red")
#' abline(v=res1$Rhat, col="blue")
#' abline(v=Rpost$supp[loc], col="purple")
#' legend("topright", legend=c("prior", "posterior", "posterior mean (Rhat)", "posterior mode"), col=c("red", "black", "blue", "purple"), lty=1)
-#' plot(Rpost$supp, Rpost$pmf, col="black", type="l", xlim=c(0.5,1.5), xlab="", ylab="")
+#' plot(Rpost$supp, Rpost$pmf, col="black", type="l", xlim=c(0.5, 1.5), xlab="", ylab="")
#' abline(h=1/(20/0.01+1), col="red")
#' abline(v=res1$Rhat, col="blue")
#' abline(v=Rpost$supp[loc], col="purple")
@@ -70,7 +70,6 @@
#' ## ========================================================= ##
#' ## Compute Rhat using only the first five weeks of data ##
#' ## ========================================================= ##
-#'
#'
#' res3 <- seqB(NT=NT[1:5], mu=5/7) # serial distribution has mean of five days
#' res3$Rhat
@@ -121,6 +120,6 @@ seqB <- function(NT, mu, kappa=20) {
Rhat <- sum(R * posterior)
- return(list(Rhat=Rhat, posterior=list(supp=R, pmf=posterior), group=group, inputs=list(NT=NT, mu=mu, kappa=kappa)))
+ return(list(Rhat=Rhat, posterior=list(supp=R, pmf=posterior), group=group))
}
}