2021年1月25日星期一

R ggplot actuals and simulated points

How can I draw a ggplot for simulated predictions and their means with actual points?

For month 1 to 9, one point of the actual(df) is assigned, and month 10 and 11, simulated 5 points and mean point are plotted with a legend?

#actuals for month 1 to 9  month<-1:9  df<-c(0.20, 0.342, 0.710, 0.228, 0.124, 0.203, 0.956, 0.593, 0.195)  actual<-data.frame(month, df)    #simPred for month 10:11  sim1<-c(0.182, 0.235)  sim2<-c(0.165, 0.233)  sim3<-c(0.174, 0.258)  sim4<-c(0.139, 0.393)  sim5<-c(0.201, 0.412)  simPred<-data.frame(sim1, sim2,sim3,sim4,sim5)%>%     add_column(month=seq(from=length(month)+1, to=length(month)+nrow(simPred), by=1),               > simPred     sim1  sim2  sim3  sim4  sim5 month  Means  1 0.182 0.165 0.174 0.139 0.201    10 0.1722  2 0.235 0.233 0.258 0.393 0.412    11 0.3062                                                    
https://stackoverflow.com/questions/65894299/r-ggplot-actuals-and-simulated-points January 26, 2021 at 08:26AM

没有评论:

发表评论