-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathplot.dataview.R
More file actions
36 lines (30 loc) · 1.3 KB
/
plot.dataview.R
File metadata and controls
36 lines (30 loc) · 1.3 KB
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
# Sys.setenv(LANG = "en")
library(shellpipes)
rpcall("float.plot.Rout plot.dataview.R float.data.rda")
rpcall("const.plot.Rout plot.dataview.R const.data.rda")
suppressPackageStartupMessages(library(dplyr))
library(tidyr)
library(ggplot2); theme_set(theme_bw())
loadEnvironments()
startGraphics()
model_curve<-(ggplot() + theme_bw()
+ geom_line(data = dat_pall, aes(time,I,color="I(t)"))
+ geom_line(data = dat_pall, aes(time,OT,color="OT(t)"))
+ geom_line(data = dat_pall, aes(time,OP,color="OP(t)"))
+ geom_point(data = dat_fit, aes(time,OT,color="OT(t)",shape="Fitted data"))
+ geom_point(data = dat_fit, aes(time,OP,color="OP(t)",shape="Fitted data"))
+ labs(x="Time t", y="Case Count")
)
print(model_curve)
#ggsave("FloatSIR_ModelCurve.png",plot=model_curve, path = "../pix", width=1800,height=900,units="px")
## Compare true baseline T_B and theoretical likelihood 1-B_lik
Phi <- exp(-h)
neg <- c(dat_pall$OT-dat_pall$OP)
pos <- c(dat_pall$OP)
B_lik <- 1/(2*N*Phi)*(((N-neg)*Phi+N-pos)-sqrt(((N-neg)*Phi+N-pos)^2-4*N*Phi*(N-pos-neg)))
# dat_pall$T_B
TB_Curve<-(ggplot() + theme_bw()
+ geom_line(data = dat_pall, aes(time,T_B,color="T_B"))
+ geom_line(data = dat_pall, aes(time,1-B_lik,color="likelihood B- Sol")) + labs(x="Time t", y="Probability")
)
print(TB_Curve)