R Markdown

This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.

When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:

summary(cars)
##      speed           dist       
##  Min.   : 4.0   Min.   :  2.00  
##  1st Qu.:12.0   1st Qu.: 26.00  
##  Median :15.0   Median : 36.00  
##  Mean   :15.4   Mean   : 42.98  
##  3rd Qu.:19.0   3rd Qu.: 56.00  
##  Max.   :25.0   Max.   :120.00

Including Plots

You can also embed plots, for example:

Note that the echo = FALSE parameter was added to the code chunk to prevent printing of the R code that generated the plot.

1° passo: Carregar as bibliotecas

library(ggplot2) library(zoo) library(data.table) library(dplyr)
library(naivebayes)
library(neuralnet)
library(quantmod)
library(fpp)
library(fpp2)
library(fpp3)
library(forecast)
library(DMwR2) library(stats)
library(plogr) library(psych) #estatística - correlações

library(forecast) library(fpp) library(fpp2)
library(tseries) library(patchwork) library(mFilter) library(xts)
library(zoo)

Criando tabela de Vendas Mensais

vendas_mes <- vendas %>% group_by(ano, mes)%>% summarise(venda_mensal = sum(venda_diaria)) %>% arrange(ano, mes)

plot(vendas_mes$venda_mensal)

vendas_mes_ts <- ts (vendas_mes$venda_mensal, start = c(2018,1), frequency = 12)

#Criando gráfico

plot(vendas_mes_ts)

decomp_vendas_mes <- decompose(vendas_mes_ts, type = “additive”) plot(decomp_vendas_mes)

forecast(vendas_mes_ts, 6, 90) forecast(vendas_mes_ts, 6, 95)

         Point Forecast    Lo 90    Hi 90 Apr 2024       592128.1 508364.8 675891.4 May 2024       677756.0 563531.7 791980.3 Jun 2024       626941.9 488818.4 765065.3 Jul 2024       546903.3 388445.2 705361.4 Aug 2024       546792.1 370327.1 723257.0 Sep 2024       543842.9 351045.7 736640.1
         
                  Point Forecast    Lo 95    Hi 95
Apr 2024       592128.1 492318.0 691938.2
May 2024       677756.0 541649.4 813862.6
Jun 2024       626941.9 462357.7 791526.1
Jul 2024       546903.3 358088.8 735717.8
Aug 2024       546792.1 336521.1 757063.0
Sep 2024       543842.9 314110.8 773575.0