This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pacman::p_load( | |
arcgis, | |
geodata, | |
sf, dots, | |
tidyverse, | |
elevatr, terra, | |
rayshader | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
title: "Life Expectancy Report" | |
format: html | |
execute: | |
echo: false | |
warning: false | |
message: false | |
params: | |
country: "Pakistan" | |
editor_options: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(tidyverse) | |
library(readxl) | |
wide_df <- read_excel("wide_data.xlsx") | |
wide_df |> View() | |
wide_df <- wide_df |> mutate(Dec=as.numeric(Dec)) |> na.omit() | |
wide_df |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(zoo) # for time series~ data | |
library(xts) # for time series data | |
library(tidyverse) # Umbrella package for data manipulation | |
library(readxl) # for read_excel function | |
library(forecast) # for ggAcf and ggPacf functions | |
library(urca) # for ADF test | |
library(tseries) # for ADF test | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set.seed(33) | |
library(fpp2) | |
library(fpp3) | |
y<-tsibble(sample=1:100,wn=rnorm(100),index=sample) | |
y %>% autoplot(wn)+ggtitle("White Noise") | |
y %>% ACF(wn) %>% autoplot() | |
T<-100 | |
theta <- 0.8 | |
nsim <- 10 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(tidyverse) | |
library(forecast) # for time series models and auto.arima | |
library(stats) | |
library(ggplot2) | |
phi <- 0.8 # Autoregressive coefficient | |
n <- 200 # Number of time points | |
# Simulate data from the AR(1) model | |
set.seed(123) # For reproducibility | |
ar1_data <- arima.sim(model = list(ar = phi), n = n) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Load libraries | |
#install.packages("prophet") # for forecasting if not already installed | |
library(prophet) # for forecasting | |
library(dplyr) # for data manipulation~ | |
# Load data |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
~ | |
## Simple Exponential Smoothing | |
## Holt's method | |
## Holt-Winters method~ | |
## ARIMA method | |
## ETS method (Error, Trend, Seasonality) | |
# Load libraries |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
y z w | |
-1.80156 -0.49695003 -1.79957 | |
-2.27002 -0.1490799 -2.36988 | |
-2.21743 0.11816769 -2.12782 | |
-2.36609 0.22603459 -2.30212 | |
-2.06364 0.18290678 -1.93444 | |
-2.17761 0.17545464 -1.62233 | |
-1.62946 -0.26589438 -1.67908 | |
-1.93948 0.20289823 -1.66649 | |
-1.88108 0.40078534 -1.71245 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Load relevant libraries | |
```{r} | |
#|warning: false | |
#|message: false | |
library(readxl) # to read excel data | |
library(tidyverse) |
NewerOlder