predict

Production of a BSTS Mean Absolute Percentage Error (MAPE) Plot from a Bayesian Time Series Analysis with MCMC using ggplot() and bsts() packages

岁酱吖の 提交于 2021-01-07 03:11:54
问题 Problem: I have a data frame called FID (see below) that contains two columns for Year & Month, and Sighting_Frequency (counts of birds). The data frame contains 3 years of observations between 2015-2017 , indicating I have 36 months of data. I have run a Bayesian time series analysis with MCMC using the bsts() function in the bsts package (see the R-code below) by following the tutorial below. I want to produce a holdout Mean Absolute Percentage Error (MAPE) Plot as seen in the diagram below

mgcv: How to use 'exclude' argument in predict.gam?

微笑、不失礼 提交于 2020-11-28 08:26:19
问题 I have a model structured as follows, and I would like to extract the predicted values while ignoring the random effect. As specified in ?predict.gam and here, I am using the exclude argument, but I am getting an error. Where is my mistake? dt <- data.frame(n1 = runif(500, min=0, max=1), n2 = rep(1:10,50), n3 = runif(500, min=0, max=2), n4 = runif(500, min=0, max=2), c1 = factor(rep(c("X","Y"),250)), c2 = factor(rep(c("a", "b", "c", "d", "e"), 100))) mod = gam(n1 ~ s(n2, n3, n4, by=c1) + s(c2

mgcv: How to use 'exclude' argument in predict.gam?

北战南征 提交于 2020-11-28 08:23:37
问题 I have a model structured as follows, and I would like to extract the predicted values while ignoring the random effect. As specified in ?predict.gam and here, I am using the exclude argument, but I am getting an error. Where is my mistake? dt <- data.frame(n1 = runif(500, min=0, max=1), n2 = rep(1:10,50), n3 = runif(500, min=0, max=2), n4 = runif(500, min=0, max=2), c1 = factor(rep(c("X","Y"),250)), c2 = factor(rep(c("a", "b", "c", "d", "e"), 100))) mod = gam(n1 ~ s(n2, n3, n4, by=c1) + s(c2