On cherche à vérifier si la formule de la variance de l'estimateur du modèle marche aléatoire plus bruit est correcte, en la comparant à la variance trouvée par simulation.
devtools::install_github("aminaghoul/ARRW") #devtools::install_github("gtromano/DeCAFS", force = TRUE)
library(DeCAFS) library(ARRW, quietly = TRUE) library(tidyverse, quietly = TRUE) library(gridExtra, quietly = TRUE)
n <- 300 nb_rep <- 100 sigma <- 0.8 sdEta = 0.9 val <- def(sdEta, sdNu = sigma, phi = 0)
res1 <- var1(val, sigma, n) res1 <- data.frame(1:n, res1) colnames(res1) <- c("i", "variance") maxi <- max(res1$variance) vartheo <- ggplot(res1,aes(x = i, y = variance) ) + ggtitle("Variance de l'estimateur théorique") + ylim(0, maxi)+geom_line()+ geom_point(shape=3,size=1,color="darkblue")
res2 <- var_emp(n, nb_rep=400, sigma, sdEta) res2 <- data.frame(1:n, res2) colnames(res2) <- c("i", "variance") maxi <- max(res2$variance) varsimu <- ggplot(res2,aes(x = i, y = variance) ) + ggtitle("Variance de l'estimateur simulée") + ylim(0, maxi)+geom_line()+ geom_point(shape=3,size=1,color="darkblue")
grid.arrange(vartheo, varsimu, ncol=2, nrow = 1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.