diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..cc116df Binary files /dev/null and b/.DS_Store differ diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e43b0f9 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.DS_Store diff --git a/Data 400 Project Proposal 1.pdf b/Data 400 Project Proposal 1.pdf new file mode 100644 index 0000000..13dfa3f Binary files /dev/null and b/Data 400 Project Proposal 1.pdf differ diff --git a/Data_400_Project_Proposal_1.md b/Data_400_Project_Proposal_1.md new file mode 100644 index 0000000..7880a45 --- /dev/null +++ b/Data_400_Project_Proposal_1.md @@ -0,0 +1,25 @@ + +# Data 400 Project Proposal 1 +### Exploring the Relationship Between Remittances and Economic Stability in Nepal + +### Research Question: Can remittance inflows help predict changes in household consumption and inflation in Nepal? +### +### Motivation +Nepal is one of the most remittance dependent economies in the world with 25% of its total GDP coming from remittance. Since a large share of household income comes from citizens working abroad, remittances are important for consumption and functioning of households and for stabilizing the economy. Remittances are studied in development economics in Nepal but are usually studied by describing trends rather than making predictions. I want to use this project to examine whether remittance inflows can help predict changes in household consumption and inflation in Nepal. +### +### Data Sources +For this project I will use publicly available macroeconomic time-series data. Data on remittance inflows can be obtained from the Nepal Rastra Bank and the World Bank datasets. I will source household consumption, gross domestic product (GDP), and inflation data from the World Bank and the International Monetary Fund. All datasets are aggregated, numeric, and reported at monthly or yearly frequencies which makes them suitable for exploratory analysis and predictive modeling. +#### +### Methodology +I will begin this project with exploratory data analysis (EDA) to examine trends/relationships between remittance inflows, household consumption, and inflation. This will include summary statistics and visualizations such as time-series plots and correlation matrices. If time allows I will also consider economic shock periods like the 2015 earthquake and the COVID-19 pandemic to observe how these variables behaved during times of stress. For the predictive modelling, I will use models such as linear regression to assess whether remittance inflows can help predict changes in consumption and inflation. + +### Implications for Stakeholders +The findings from this project would be useful for policymakers and central bank officials in Nepal who are interested in economic forecasting and planning. Development organizations and researchers would benefit from understanding whether remittance flows provide signals of changes in economic conditions. The project highlights the economic role of migrant workers and the importance of external income flows in shaping domestic outcomes. +### +### Ethical Considerations +This project relies on aggregated and publicly available data which does not involve personal or sensitive information. However, the analysis acknowledges societal issues related to labor migration, including household separation and unequal access to migration opportunities. I will avoid causal claims and state its limitations to ensure the interpretation of predictive results is clear. +#### +### Challenges +I may face challenges in aligning data from different sources which are reported at different time intervals or contain missing values. I will clearly document data limitations and modeling assumtions so that results can be interpreted with caution. + + diff --git a/Data_400_Project_Proposal_1.md (3).html b/Data_400_Project_Proposal_1.md (3).html new file mode 100644 index 0000000..be2cfeb --- /dev/null +++ b/Data_400_Project_Proposal_1.md (3).html @@ -0,0 +1,23 @@ +Data 400 Project Proposal 1.md +

Data 400 Project Proposal 1

+

Exploring the Relationship Between Remittances and Economic Stability in Nepal

+

Research Question: Can remittance inflows help predict changes in household consumption and inflation in Nepal?

+

+

Motivation

+

Nepal is one of the most remittance dependent economies in the world with 25% of its total GDP coming from remittance. Since a large share of household income comes from citizens working abroad, remittances are important for consumption and functioning of households and for stabilizing the economy. Remittances are studied in development economics in Nepal but are usually studied by describing trends rather than making predictions. I want to use this project to examine whether remittance inflows can help predict changes in household consumption and inflation in Nepal.

+

+

Data Sources

+

For this project I will use publicly available macroeconomic time-series data. Data on remittance inflows can be obtained from the Nepal Rastra Bank and the World Bank datasets. I will source household consumption, gross domestic product (GDP), and inflation data from the World Bank and the International Monetary Fund. All datasets are aggregated, numeric, and reported at monthly or yearly frequencies which makes them suitable for exploratory analysis and predictive modeling.

+

+

Methodology

+

I will begin this project with exploratory data analysis (EDA) to examine trends/relationships between remittance inflows, household consumption, and inflation. This will include summary statistics and visualizations such as time-series plots and correlation matrices. If time allows I will also consider economic shock periods like the 2015 earthquake and the COVID-19 pandemic to observe how these variables behaved during times of stress. For the predictive modelling, I will use models such as linear regression to assess whether remittance inflows can help predict changes in consumption and inflation.

+

Implications for Stakeholders

+

The findings from this project would be useful for policymakers and central bank officials in Nepal who are interested in economic forecasting and planning. Development organizations and researchers would benefit from understanding whether remittance flows provide signals of changes in economic conditions. The project highlights the economic role of migrant workers and the importance of external income flows in shaping domestic outcomes.

+

+

Ethical Considerations

+

This project relies on aggregated and publicly available data which does not involve personal or sensitive information. However, the analysis acknowledges societal issues related to labor migration, including household separation and unequal access to migration opportunities. I will avoid causal claims and state its limitations to ensure the interpretation of predictive results is clear.

+

+

Challenges

+

I may face challenges in aligning data from different sources which are reported at different time intervals or contain missing values. I will clearly document data limitations and modeling assumtions so that results can be interpreted with caution.

+ + \ No newline at end of file diff --git a/Untitled_Document.md b/Untitled_Document.md new file mode 100644 index 0000000..fe37bca --- /dev/null +++ b/Untitled_Document.md @@ -0,0 +1,28 @@ +## Data Mini Porject Proposal 2 +### Research Question +Can macroeconomic and climate indicators help predict food price inflation volatility in South Asian countries + +### Motivation +Food prices play a central role in household welfare across South Asia where a large share of income is spent on basic food consumption. While average food inflation is important, sudden increases or fluctuations in food prices can be even more harmful especially for low-income households that have limited ability to smooth consumption. Periods of high food price volatility can increase food insecurity and economic stress, even when overall inflation remains moderate. + +South Asian countries are vulnerable to external shocks such as global price changes, climate variability, and macroeconomic instability. This project aims to examine whether commonly used macroeconomic indicators and climate variables can help predict changes in food price inflation volatility. Understanding these relationships can help identify early warning signals of economic stress and contribute to better policy planning. + +### Data Sources +This project will use publicly available country level panel data for South Asian countries including India, Nepal, Bangladesh, Sri Lanka, and Pakistan. + +Food price data will be obtained from the Food and Agriculture Organization (FAO) food price indices. Macroeconomic indicators such as overall inflation will be sourced from the World Bank. Climate variables, including rainfall anomalies and temperature deviations, will be obtained from publicly available climate datasets. + +### Methodology +The project will begin with exploratory data analysis to examine trends in food price inflation and its volatility across countries and over time. This will include time-series plots, summary statistics, and comparisons across countries to identify periods of unusually high volatility. + +To model food price inflation volatility, I will construct a volatility measure using changes in food price inflation over time. I will then use macroeconomic and climate variables as predictors. + +As a baseline, I will estimate a linear regression model with lagged predictors to examine whether past macroeconomic and climate conditions are associated with future food price volatility. To allow for potential non-linear relationships, I will also estimate a Random Forest regression model and compare its predictive performance to the linear model. + +### Implications for Stakeholders +The findings from this project may be useful for policymakers and central banks in South Asia who monitor inflation and food security risks. Early identification of rising food price volatility could support more timely policy responses such as targeted subsidies or social protection measures. + +International organizations and development agencies may also benefit from understanding how climate and macroeconomic factors interact to influence food price instability. + +### Ethical Considerations +The topic raises important societal concerns related to inequality and food insecurity. Food price volatility disproportionately affects low-income households who spend a larger share of their income on food and have limited ability to adjust consumption. diff --git a/Untitled_Document.md.html b/Untitled_Document.md.html new file mode 100644 index 0000000..684b275 --- /dev/null +++ b/Untitled_Document.md.html @@ -0,0 +1,21 @@ +Untitled Document.md +

Data Mini Porject Proposal 2

+

Research Question

+

Can macroeconomic and climate indicators help predict food price inflation volatility in South Asian countries

+

Motivation

+

Food prices play a central role in household welfare across South Asia where a large share of income is spent on basic food consumption. While average food inflation is important, sudden increases or fluctuations in food prices can be even more harmful especially for low-income households that have limited ability to smooth consumption. Periods of high food price volatility can increase food insecurity and economic stress, even when overall inflation remains moderate.

+

South Asian countries are vulnerable to external shocks such as global price changes, climate variability, and macroeconomic instability. This project aims to examine whether commonly used macroeconomic indicators and climate variables can help predict changes in food price inflation volatility. Understanding these relationships can help identify early warning signals of economic stress and contribute to better policy planning.

+

Data Sources

+

This project will use publicly available country level panel data for South Asian countries including India, Nepal, Bangladesh, Sri Lanka, and Pakistan.

+

Food price data will be obtained from the Food and Agriculture Organization (FAO) food price indices. Macroeconomic indicators such as overall inflation will be sourced from the World Bank. Climate variables, including rainfall anomalies and temperature deviations, will be obtained from publicly available climate datasets.

+

Methodology

+

The project will begin with exploratory data analysis to examine trends in food price inflation and its volatility across countries and over time. This will include time-series plots, summary statistics, and comparisons across countries to identify periods of unusually high volatility.

+

To model food price inflation volatility, I will construct a volatility measure using changes in food price inflation over time. I will then use macroeconomic and climate variables as predictors.

+

As a baseline, I will estimate a linear regression model with lagged predictors to examine whether past macroeconomic and climate conditions are associated with future food price volatility. To allow for potential non-linear relationships, I will also estimate a Random Forest regression model and compare its predictive performance to the linear model.

+

Implications for Stakeholders

+

The findings from this project may be useful for policymakers and central banks in South Asia who monitor inflation and food security risks. Early identification of rising food price volatility could support more timely policy responses such as targeted subsidies or social protection measures.

+

International organizations and development agencies may also benefit from understanding how climate and macroeconomic factors interact to influence food price instability.

+

Ethical Considerations

+

The topic raises important societal concerns related to inequality and food insecurity. Food price volatility disproportionately affects low-income households who spend a larger share of their income on food and have limited ability to adjust consumption.

+ + \ No newline at end of file diff --git a/notes/week01/github/test.Rmd b/notes/week01/github/test.Rmd new file mode 100644 index 0000000..b47eb19 --- /dev/null +++ b/notes/week01/github/test.Rmd @@ -0,0 +1,636 @@ +--- +title: "Presentation Ninja" +subtitle: "⚔
with xaringan" +author: "Yihui Xie" +institute: "RStudio, PBC" +date: "2016/12/12 (updated: `r Sys.Date()`)" +output: + xaringan::moon_reader: + lib_dir: libs + nature: + highlightStyle: github + highlightLines: true + countIncrementalSlides: false +--- + +background-image: url(https://upload.wikimedia.org/wikipedia/commons/b/be/Sharingan_triple.svg) + +```{r setup, include=FALSE} +options(htmltools.dir.version = FALSE) +``` + +??? + +Image credit: [Wikimedia Commons](https://commons.wikimedia.org/wiki/File:Sharingan_triple.svg) + +--- +class: center, middle + +# xaringan + +### /ʃaː.'riŋ.ɡan/ + +--- +class: inverse, center, middle + +# Get Started + +--- + +# Hello World + +Install the **xaringan** package from [Github](https://github.com/yihui/xaringan): + +```{r eval=FALSE, tidy=FALSE} +remotes::install_github("yihui/xaringan") +``` + +-- + +You are recommended to use the [RStudio IDE](https://www.rstudio.com/products/rstudio/), but you do not have to. + +- Create a new R Markdown document from the menu `File -> New File -> R Markdown -> From Template -> Ninja Presentation`;1 + +-- + +- Click the `Knit` button to compile it; + +-- + +- or use the [RStudio Addin](https://rstudio.github.io/rstudioaddins/)2 "Infinite Moon Reader" to live preview the slides (every time you update and save the Rmd document, the slides will be automatically reloaded in RStudio Viewer. + +.footnote[ +[1] 中文用户请看[这份教程](https://slides.yihui.org/xaringan/zh-CN.html) + +[2] See [#2](https://github.com/yihui/xaringan/issues/2) if you do not see the template or addin in RStudio. +] + +--- +background-image: url(`r xaringan:::karl`) +background-position: 50% 50% +class: center, bottom, inverse + +# You only live once! + +--- + +# Hello Ninja + +As a presentation ninja, you certainly should not be satisfied by the "Hello World" example. You need to understand more about two things: + +1. The [remark.js](https://remarkjs.com) library; + +1. The **xaringan** package; + +Basically **xaringan** injected the chakra of R Markdown (minus Pandoc) into **remark.js**. The slides are rendered by remark.js in the web browser, and the Markdown source needed by remark.js is generated from R Markdown (**knitr**). + +--- + +# remark.js + +You can see an introduction of remark.js from [its homepage](https://remarkjs.com). You should read the [remark.js Wiki](https://github.com/gnab/remark/wiki) at least once to know how to + +- create a new slide (Markdown syntax* and slide properties); + +- format a slide (e.g. text alignment); + +- configure the slideshow; + +- and use the presentation (keyboard shortcuts). + +It is important to be familiar with remark.js before you can understand the options in **xaringan**. + +.footnote[[*] It is different with Pandoc's Markdown! It is limited but should be enough for presentation purposes. Come on... You do not need a slide for the Table of Contents! Well, the Markdown support in remark.js [may be improved](https://github.com/gnab/remark/issues/142) in the future.] + +--- +background-image: url(`r xaringan:::karl`) +background-size: cover +class: center, bottom, inverse + +# I was so happy to have discovered remark.js! + +--- +class: inverse, middle, center + +# Using xaringan + +--- + +# xaringan + +Provides an R Markdown output format `xaringan::moon_reader` as a wrapper for remark.js, and you can use it in the YAML metadata, e.g. + +```yaml +--- +title: "A Cool Presentation" +output: + xaringan::moon_reader: + yolo: true + nature: + autoplay: 30000 +--- +``` + +See the help page `?xaringan::moon_reader` for all possible options that you can use. + +--- + +# remark.js vs xaringan + +Some differences between using remark.js (left) and using **xaringan** (right): + +.pull-left[ +1. Start with a boilerplate HTML file; + +1. Plain Markdown; + +1. Write JavaScript to autoplay slides; + +1. Manually configure MathJax; + +1. Highlight code with `*`; + +1. Edit Markdown source and refresh browser to see updated slides; +] + +.pull-right[ +1. Start with an R Markdown document; + +1. R Markdown (can embed R/other code chunks); + +1. Provide an option `autoplay`; + +1. MathJax just works;* + +1. Highlight code with `{{}}`; + +1. The RStudio addin "Infinite Moon Reader" automatically refreshes slides on changes; +] + +.footnote[[*] Not really. See next page.] + +--- + +# Math Expressions + +You can write LaTeX math expressions inside a pair of dollar signs, e.g. $\alpha+\beta$ renders $\alpha+\beta$. You can use the display style with double dollar signs: + +``` +$$\bar{X}=\frac{1}{n}\sum_{i=1}^nX_i$$ +``` + +$$\bar{X}=\frac{1}{n}\sum_{i=1}^nX_i$$ + +Limitations: + +1. The source code of a LaTeX math expression must be in one line, unless it is inside a pair of double dollar signs, in which case the starting `$$` must appear in the very beginning of a line, followed immediately by a non-space character, and the ending `$$` must be at the end of a line, led by a non-space character; + +1. There should not be spaces after the opening `$` or before the closing `$`. + +1. Math does not work on the title slide (see [#61](https://github.com/yihui/xaringan/issues/61) for a workaround). + +--- + +# R Code + +```{r comment='#'} +# a boring regression +fit = lm(dist ~ 1 + speed, data = cars) +coef(summary(fit)) +dojutsu = c('地爆天星', '天照', '加具土命', '神威', '須佐能乎', '無限月読') +grep('天', dojutsu, value = TRUE) +``` + +--- + +# R Plots + +```{r cars, fig.height=4, dev='svg'} +par(mar = c(4, 4, 1, .1)) +plot(cars, pch = 19, col = 'darkgray', las = 1) +abline(fit, lwd = 2) +``` + +--- + +# Tables + +If you want to generate a table, make sure it is in the HTML format (instead of Markdown or other formats), e.g., + +```{r} +knitr::kable(head(iris), format = 'html') +``` + +--- + +# HTML Widgets + +I have not thoroughly tested HTML widgets against **xaringan**. Some may work well, and some may not. It is a little tricky. + +Similarly, the Shiny mode (`runtime: shiny`) does not work. I might get these issues fixed in the future, but these are not of high priority to me. I never turn my presentation into a Shiny app. When I need to demonstrate more complicated examples, I just launch them separately. It is convenient to share slides with other people when they are plain HTML/JS applications. + +See the next page for two HTML widgets. + +--- + +```{r out.width='100%', fig.height=6, eval=require('leaflet')} +library(leaflet) +leaflet() %>% addTiles() %>% setView(-93.65, 42.0285, zoom = 17) +``` + +--- + +```{r eval=require('DT'), tidy=FALSE} +DT::datatable( + head(iris, 10), + fillContainer = FALSE, options = list(pageLength = 8) +) +``` + +--- + +# Some Tips + +- Do not forget to try the `yolo` option of `xaringan::moon_reader`. + + ```yaml + output: + xaringan::moon_reader: + yolo: true + ``` + +--- + +# Some Tips + +- Slides can be automatically played if you set the `autoplay` option under `nature`, e.g. go to the next slide every 30 seconds in a lightning talk: + + ```yaml + output: + xaringan::moon_reader: + nature: + autoplay: 30000 + ``` + +- If you want to restart the play after it reaches the last slide, you may set the sub-option `loop` to TRUE, e.g., + + ```yaml + output: + xaringan::moon_reader: + nature: + autoplay: + interval: 30000 + loop: true + ``` + +--- + +# Some Tips + +- A countdown timer can be added to every page of the slides using the `countdown` option under `nature`, e.g. if you want to spend one minute on every page when you give the talk, you can set: + + ```yaml + output: + xaringan::moon_reader: + nature: + countdown: 60000 + ``` + + Then you will see a timer counting down from `01:00`, to `00:59`, `00:58`, ... When the time is out, the timer will continue but the time turns red. + +--- + +# Some Tips + +- The title slide is created automatically by **xaringan**, but it is just another remark.js slide added before your other slides. + + The title slide is set to `class: center, middle, inverse, title-slide` by default. You can change the classes applied to the title slide with the `titleSlideClass` option of `nature` (`title-slide` is always applied). + + ```yaml + output: + xaringan::moon_reader: + nature: + titleSlideClass: [top, left, inverse] + ``` + +-- + +- If you'd like to create your own title slide, disable **xaringan**'s title slide with the `seal = FALSE` option of `moon_reader`. + + ```yaml + output: + xaringan::moon_reader: + seal: false + ``` + +--- + +# Some Tips + +- There are several ways to build incremental slides. See [this presentation](https://slides.yihui.org/xaringan/incremental.html) for examples. + +- The option `highlightLines: true` of `nature` will highlight code lines that start with `*`, or are wrapped in `{{ }}`, or have trailing comments `#<<`; + + ```yaml + output: + xaringan::moon_reader: + nature: + highlightLines: true + ``` + + See examples on the next page. + +--- + +# Some Tips + + +.pull-left[ +An example using a leading `*`: + + ```r + if (TRUE) { + ** message("Very important!") + } + ``` +Output: +```r +if (TRUE) { +* message("Very important!") +} +``` + +This is invalid R code, so it is a plain fenced code block that is not executed. +] + +.pull-right[ +An example using `{{}}`: + +```` +`r ''````{r tidy=FALSE} +if (TRUE) { +*{{ message("Very important!") }} +} +``` +```` +Output: +```{r tidy=FALSE} +if (TRUE) { +{{ message("Very important!") }} +} +``` + +It is valid R code so you can run it. Note that `{{}}` can wrap an R expression of multiple lines. +] + +--- + +# Some Tips + +An example of using the trailing comment `#<<` to highlight lines: + +````markdown +`r ''````{r tidy=FALSE} +library(ggplot2) +ggplot(mtcars) + + aes(mpg, disp) + + geom_point() + #<< + geom_smooth() #<< +``` +```` + +Output: + +```{r tidy=FALSE, eval=FALSE} +library(ggplot2) +ggplot(mtcars) + + aes(mpg, disp) + + geom_point() + #<< + geom_smooth() #<< +``` + +--- + +# Some Tips + +When you enable line-highlighting, you can also use the chunk option `highlight.output` to highlight specific lines of the text output from a code chunk. For example, `highlight.output = TRUE` means highlighting all lines, and `highlight.output = c(1, 3)` means highlighting the first and third line. + +````md +`r ''````{r, highlight.output=c(1, 3)} +head(iris) +``` +```` + +```{r, highlight.output=c(1, 3), echo=FALSE} +head(iris) +``` + +Question: what does `highlight.output = c(TRUE, FALSE)` mean? (Hint: think about R's recycling of vectors) + +--- + +# Some Tips + +- To make slides work offline, you need to download a copy of remark.js in advance, because **xaringan** uses the online version by default (see the help page `?xaringan::moon_reader`). + +- You can use `xaringan::summon_remark()` to download the latest or a specified version of remark.js. By default, it is downloaded to `libs/remark-latest.min.js`. + +- Then change the `chakra` option in YAML to point to this file, e.g. + + ```yaml + output: + xaringan::moon_reader: + chakra: libs/remark-latest.min.js + ``` + +- If you used Google fonts in slides (the default theme uses _Yanone Kaffeesatz_, _Droid Serif_, and _Source Code Pro_), they won't work offline unless you download or install them locally. The Heroku app [google-webfonts-helper](https://google-webfonts-helper.herokuapp.com/fonts) can help you download fonts and generate the necessary CSS. + +--- + +# Macros + +- remark.js [allows users to define custom macros](https://github.com/yihui/xaringan/issues/80) (JS functions) that can be applied to Markdown text using the syntax `![:macroName arg1, arg2, ...]` or `![:macroName arg1, arg2, ...](this)`. For example, before remark.js initializes the slides, you can define a macro named `scale`: + + ```js + remark.macros.scale = function (percentage) { + var url = this; + return ''; + }; + ``` + + Then the Markdown text + + ```markdown + ![:scale 50%](image.jpg) + ``` + + will be translated to + + ```html + + ``` + +--- + +# Macros (continued) + +- To insert macros in **xaringan** slides, you can use the option `beforeInit` under the option `nature`, e.g., + + ```yaml + output: + xaringan::moon_reader: + nature: + beforeInit: "macros.js" + ``` + + You save your remark.js macros in the file `macros.js`. + +- The `beforeInit` option can be used to insert arbitrary JS code before `remark.create()`. Inserting macros is just one of its possible applications. + +--- + +# CSS + +Among all options in `xaringan::moon_reader`, the most challenging but perhaps also the most rewarding one is `css`, because it allows you to customize the appearance of your slides using any CSS rules or hacks you know. + +You can see the default CSS file [here](https://github.com/yihui/xaringan/blob/master/inst/rmarkdown/templates/xaringan/resources/default.css). You can completely replace it with your own CSS files, or define new rules to override the default. See the help page `?xaringan::moon_reader` for more information. + +--- + +# CSS + +For example, suppose you want to change the font for code from the default "Source Code Pro" to "Ubuntu Mono". You can create a CSS file named, say, `ubuntu-mono.css`: + +```css +@import url(https://fonts.googleapis.com/css?family=Ubuntu+Mono:400,700,400italic); + +.remark-code, .remark-inline-code { font-family: 'Ubuntu Mono'; } +``` + +Then set the `css` option in the YAML metadata: + +```yaml +output: + xaringan::moon_reader: + css: ["default", "ubuntu-mono.css"] +``` + +Here I assume `ubuntu-mono.css` is under the same directory as your Rmd. + +See [yihui/xaringan#83](https://github.com/yihui/xaringan/issues/83) for an example of using the [Fira Code](https://github.com/tonsky/FiraCode) font, which supports ligatures in program code. + +--- + +# CSS (with Sass) + +**xaringan** also supports Sass support via **rmarkdown**. Suppose you want to use the same color for different elements, e.g., first heading and bold text. You can create a `.scss` file, say `mytheme.scss`, using the [sass](https://sass-lang.com/) syntax with variables: + +```scss +$mycolor: #ff0000; +.remark-slide-content > h1 { color: $mycolor; } +.remark-slide-content strong { color: $mycolor; } +``` + +Then set the `css` option in the YAML metadata using this file placed under the same directory as your Rmd: + +```yaml +output: + xaringan::moon_reader: + css: ["default", "mytheme.scss"] +``` + +This requires **rmarkdown** >= 2.8 and the [**sass**](https://rstudio.github.io/sass/) package. You can learn more about **rmarkdown** and **sass** support in [this blog post](https://blog.rstudio.com/2021/04/15/2021-spring-rmd-news/#sass-and-scss-support-for-html-based-output) and in [**sass** overview vignette](https://rstudio.github.io/sass/articles/sass.html). + +--- + +# Themes + +Don't want to learn CSS? Okay, you can use some user-contributed themes. A theme typically consists of two CSS files `foo.css` and `foo-fonts.css`, where `foo` is the theme name. Below are some existing themes: + +```{r, R.options=list(width = 70)} +names(xaringan:::list_css()) +``` + +--- + +# Themes + +To use a theme, you can specify the `css` option as an array of CSS filenames (without the `.css` extensions), e.g., + +```yaml +output: + xaringan::moon_reader: + css: [default, metropolis, metropolis-fonts] +``` + +If you want to contribute a theme to **xaringan**, please read [this blog post](https://yihui.org/en/2017/10/xaringan-themes). + +--- +class: inverse, middle, center +background-image: url(https://upload.wikimedia.org/wikipedia/commons/3/39/Naruto_Shiki_Fujin.svg) +background-size: contain + +# Naruto + +--- +background-image: url(https://upload.wikimedia.org/wikipedia/commons/b/be/Sharingan_triple.svg) +background-size: 100px +background-position: 90% 8% + +# Sharingan + +The R package name **xaringan** was derived1 from **Sharingan**, a dōjutsu in the Japanese anime _Naruto_ with two abilities: + +- the "Eye of Insight" + +- the "Eye of Hypnotism" + +I think a presentation is basically a way to communicate insights to the audience, and a great presentation may even "hypnotize" the audience.2,3 + +.footnote[ +[1] In Chinese, the pronounciation of _X_ is _Sh_ /ʃ/ (as in _shrimp_). Now you should have a better idea of how to pronounce my last name _Xie_. + +[2] By comparison, bad presentations only put the audience to sleep. + +[3] Personally I find that setting background images for slides is a killer feature of remark.js. It is an effective way to bring visual impact into your presentations. +] + +--- + +# Naruto terminology + +The **xaringan** package borrowed a few terms from Naruto, such as + +- [Sharingan](https://naruto.fandom.com/wiki/Sharingan) (写輪眼; the package name) + +- The [moon reader](https://naruto.fandom.com/wiki/Moon_Reader) (月読; an attractive R Markdown output format) + +- [Chakra](https://naruto.fandom.com/wiki/Chakra) (查克拉; the path to the remark.js library, which is the power to drive the presentation) + +- [Nature transformation](https://naruto.fandom.com/wiki/Nature_Transformation) (性質変化; transform the chakra by setting different options) + +- The [infinite moon reader](https://naruto.fandom.com/wiki/Infinite_Tsukuyomi) (無限月読; start a local web server to continuously serve your slides) + +- The [summoning technique](https://naruto.fandom.com/wiki/Summoning_Technique) (download remark.js from the web) + +You can click the links to know more about them if you want. The jutsu "Moon Reader" may seem a little evil, but that does not mean your slides are evil. + +--- + +class: center + +# Hand seals (印) + +Press `h` or `?` to see the possible ninjutsu you can use in remark.js. + +![](https://upload.wikimedia.org/wikipedia/commons/7/7e/Mudra-Naruto-KageBunshin.svg) + +--- + +class: center, middle + +# Thanks! + +Slides created via the R package [**xaringan**](https://github.com/yihui/xaringan). + +The chakra comes from [remark.js](https://remarkjs.com), [**knitr**](https://yihui.org/knitr/), and [R Markdown](https://rmarkdown.rstudio.com). diff --git a/presentations/Untitled.Rmd b/presentations/Untitled.Rmd new file mode 100644 index 0000000..c079850 --- /dev/null +++ b/presentations/Untitled.Rmd @@ -0,0 +1,265 @@ + +--- +title: "Do Remittances Predict Inflation and Consumption in Nepal? (2000-2024)" +author: "Sanskriti Rijal" +date: "`r Sys.Date()`" +output: + xaringan::moon_reader: + css: [default, default-fonts] + nature: + highlightStyle: github + highlightLines: true + countIncrementalSlides: false +--- +## Research Question +Can remittance inflows help predict changes in household consumption and inflation in Nepal between 2000–2024, and does this relationship change during major shocks such as the 2015 earthquake and the COVID-19 pandemic? + +## Focus: +1. Short-term vs long-term remittance effects (remittance income may not influence the economy immediately) +2. Major economic shocks (2015 Earthquake, COVID-19) which can disrupt normal patterns +3. Economic stability in a remittance-dependent economy +--- +### Problem & Motivation + +1. Nepal relies heavily on remittances, with over 25% of GDP linked to external labor income. + +2. Policy debates around elections often focus on inflation and household welfare. + +3. At the same time, UN projections suggest Nepal may become an aging society by 2030 as youth migration increases. + +Key Question: +Do remittances provide useful signals about economic stability? + +### Approach + +Time-series analysis using macroeconomic data from 2000–2024. + +Steps: +1. Exploratory data analysis (EDA) +2. Visual trend analysis +3. Regression models with lagged remittances +4. Shock indicators for earthquake and COVID-19 + +Goal: +Evaluate predictive relationships +--- + +# Data + +Sources- Publicly available macroeconomic time-series data from: +1. World Bank: World Development Indicators +2. Nepal Rastra Bank statistics + +Variables: +1. Remittances (USD) +2. Inflation (CPI %) +3. Consumption growth +4. GDP growth + +Why tractable? +1. Public, aggregated, annual data +2. Clean time-series structure which is consistent +3. Suitable for visualization and modeling +--- + +```{r setup, include=FALSE} +options(htmltools.dir.version = FALSE) +options(scipen = 999) + +knitr::opts_chunk$set( + echo = FALSE, message = FALSE, warning = FALSE, + fig.width = 9, fig.height = 5.5, dev = "svg" +) + +library(tidyverse) +library(gt) + + +# saved files live +data_dir <- "/Users/sanskriti/Desktop/remittances nepal" + +# load cleaned outputs +nepal_model <- readr::read_csv(file.path(data_dir, "nepal_model.csv"), show_col_types = FALSE) +model_table <- readr::read_csv(file.path(data_dir, "model_table.csv"), show_col_types = FALSE) +corr_long <- readr::read_csv(file.path(data_dir, "corr_long.csv"), show_col_types = FALSE) + +# global slide theme +theme_set(theme_minimal(base_size = 18)) + +# plot objects +p_remit_trend <- ggplot(nepal_model, aes(year, remittances/1e9)) + + geom_line(linewidth = 1) + + geom_point(size = 2) + + labs( + title = "Remittances in Nepal Over Time (2000–2024)", + x = "Year", y = "Remittances (Billions USD)" + ) + +p_infl_trend <- ggplot(nepal_model, aes(year, inflation)) + + geom_line(linewidth = 1) + + geom_point(size = 2) + + geom_vline(xintercept = 2015, linetype = "dashed") + + geom_vline(xintercept = 2020, linetype = "dashed") + + labs( + title = "Inflation in Nepal with Shock Markers (2000–2024)", + x = "Year", y = "Inflation (CPI annual %)" + ) + +p_scatter <- ggplot(nepal_model, aes(remittances/1e9, inflation)) + + geom_point(size = 2.5, alpha = 0.8) + + geom_smooth(method = "lm", se = FALSE, linewidth = 1) + + labs( + title = "Remittances vs Inflation (2000–2024)", + x = "Remittances (Billions USD)", y = "Inflation (%)" + ) + +p_heatmap <- ggplot(corr_long, aes(Var1, Var2, fill = Correlation)) + + geom_tile(color = "white") + + scale_fill_gradient2(low = "blue", mid = "white", high = "red", midpoint = 0) + + labs(title = "Correlation Heatmap: Nepal Macro Variables (2000–2024)", x = "", y = "") + + theme_minimal(base_size = 14) + + theme(axis.text.x = element_text(angle = 35, hjust = 1)) + +# Combined Shock Plot +nepal_model <- nepal_model %>% + mutate(remit_scaled = as.numeric(scale(remittances/1e9))) + +p_shock_compare <- ggplot(nepal_model, aes(x = year)) + + geom_line(aes(y = inflation, color = "Inflation"), linewidth = 1) + + geom_line(aes(y = remit_scaled, color = "Remittances (scaled)"), linewidth = 1) + + geom_vline(xintercept = 2015, linetype = "dashed") + + geom_vline(xintercept = 2020, linetype = "dashed") + + scale_color_manual(values = c("Inflation" = "black", + "Remittances (scaled)" = "steelblue")) + + labs( + title = "Inflation and Remittances During Economic Shocks", + x = "Year", + y = "Value (Inflation % and Scaled Remittances)", + color = "" + ) + +nepal_scaled <- nepal_model %>% + mutate( + remit_scaled = as.numeric(scale(remittances/1e9)), + cons_scaled = as.numeric(scale(consumption)) + ) + +p_remit_cons_scaled <- ggplot(nepal_scaled, aes(year)) + + geom_line(aes(y = cons_scaled, color = "Consumption (scaled)"), linewidth = 1) + + geom_line(aes(y = remit_scaled, color = "Remittances (scaled)"), linewidth = 1) + + geom_vline(xintercept = 2015, linetype = "dashed") + + geom_vline(xintercept = 2020, linetype = "dashed") + + labs( + title = "Remittances and Consumption (Scaled) During Shocks", + x = "Year", y = "Scaled value (z-score)" + ) + + theme(legend.title = element_blank()) +``` +### Exploratory Data Analysis + +1. Strong growth in remittances after 2000 +2. Reflects increasing labor migration and Nepal’s growing dependence on external income +3. Remittances behave like a long run structural trend rather than a volatile variable. + +```{r, echo=FALSE} +p_remit_trend + +``` +--- +### Finding 1: Remittances vs Inflation + +1. Remittances increase steadily over time, reflecting Nepal’s growing reliance on migration income. +2. However, the relationship between remittances and inflation appears weak and slightly negative, suggesting that inflation is shaped by multiple macroeconomic forces beyond remittance inflows alone. +3. Not strong predictive power +```{r, echo=FALSE} +p_scatter +``` + +--- +#### Finding 2: Remittances and Household Consumption (Trends) +1. Scaled both variables so we can compare movement rather than magnitude. +2. While remittances rise steadily, consumption growth shows sharper fluctuations, especially during shocks. +3.Suggests that remittances may support long-term household stability, but they do not fully determine short-term spending behavior. + + +```{r} +p_remit_cons_scaled +``` + +--- +####Finding 3: Economic Shocks for Inflation +1. Plot overlays inflation and scaled remittances with vertical lines marking the 2015 earthquake and COVID-19 +2. Inflation reacts strongly around shocks, showing clear disruptions. +3. Remittances continue growing even when inflation fluctuates during shocks. +4. Remittances behave like a stabilizing external income stream rather than a shock sensitive macro variable. +```{r, echo=FALSE} +p_shock_compare + +``` +--- +#### Finding 4: Model Comparison (Inflation) +3 regression models: 1. Baseline using only shocked indicators, 2. Model with one year lagged remittances, 3. Model with 3 year lagged remittances + +Including lagged remittances modestly improves model fit: + +Baseline (shocks only): R² ≈ 0.13 + +Lag 1 model: R² ≈ 0.21 + +Lag 3 model: R² ≈ 0.24 + +This suggests remittance effects may operate gradually rather than immediately + +```{r, echo=FALSE} +model_table %>% + mutate(across(where(is.numeric), ~ round(.x, 3))) %>% + gt() +``` + +Explanatory power remains moderate and adds some predictive signal +--- +## Ethical, Legal and Societal Implications +1. This analysis uses aggregated public data, so privacy risks are minimal. +2. Remittances reflect real social pressures like migration, inequality, and family separation so it’s important not to reduce them to just economic numbers. +3. Avoid making causal claims for observational time series data +--- +##Stakeholders + +1. Government of Nepal +-Fiscal planning and migration policy +-Understanding external income dependence +-Preparing for demographic aging and labor shortages + +2. Nepal Rastra Bank (Central Bank) +-Inflation monitoring and macroeconomic forecasting +-Evaluating whether remittances provide early signals of economic change + +3. Migrant Households and Communities +-Household stability and consumption smoothing + +4. Development Organizations (World Bank, UNDP, NGOs) +-Designing policies around migration, remittances, and poverty reduction + +5. Researchers and Data Analysts +-Improving macroeconomic modeling in remittance-dependent economies +-Understanding lagged effects rather than immediate impacts + +--- +## Conclusion and Key Takeaways + + +1. Remittances are not a dominant driver of inflation, but lagged remittances slightly improve prediction. + +2. Remittances may support household stability, but spending decisions respond to many short-term pressures. + +3. Heavy reliance on remittances raises long-term questions about sustainability and demographic change + +3. During economic shocks, remittances behave more like a stabilizing external income source rather than a shock driven variable + + +## Next steps + +1. Add more macroeconomic controls (e.g., trade, exchange rate, fuel prices) + + +3. Extend to ML models for the big project diff --git a/presentations/Untitled.html b/presentations/Untitled.html new file mode 100644 index 0000000..c5f32bf --- /dev/null +++ b/presentations/Untitled.html @@ -0,0 +1,787 @@ + + + + Do Remittances Predict Inflation and Consumption in Nepal? (2000-2024) + + + + + + + + + + + + + + + + + + diff --git a/presentations/Untitled_files/figure-html/unnamed-chunk-1-1.svg b/presentations/Untitled_files/figure-html/unnamed-chunk-1-1.svg new file mode 100644 index 0000000..3c88a8a --- /dev/null +++ b/presentations/Untitled_files/figure-html/unnamed-chunk-1-1.svg @@ -0,0 +1,397 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/presentations/Untitled_files/figure-html/unnamed-chunk-2-1.svg b/presentations/Untitled_files/figure-html/unnamed-chunk-2-1.svg new file mode 100644 index 0000000..b893a85 --- /dev/null +++ b/presentations/Untitled_files/figure-html/unnamed-chunk-2-1.svg @@ -0,0 +1,416 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/presentations/Untitled_files/figure-html/unnamed-chunk-3-1.svg b/presentations/Untitled_files/figure-html/unnamed-chunk-3-1.svg new file mode 100644 index 0000000..9c7c7ff --- /dev/null +++ b/presentations/Untitled_files/figure-html/unnamed-chunk-3-1.svg @@ -0,0 +1,485 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/presentations/Untitled_files/figure-html/unnamed-chunk-4-1.svg b/presentations/Untitled_files/figure-html/unnamed-chunk-4-1.svg new file mode 100644 index 0000000..eed85c7 --- /dev/null +++ b/presentations/Untitled_files/figure-html/unnamed-chunk-4-1.svg @@ -0,0 +1,497 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/presentations/Untitled_files/header-attrs/header-attrs.js b/presentations/Untitled_files/header-attrs/header-attrs.js new file mode 100644 index 0000000..dd57d92 --- /dev/null +++ b/presentations/Untitled_files/header-attrs/header-attrs.js @@ -0,0 +1,12 @@ +// Pandoc 2.9 adds attributes on both header and div. We remove the former (to +// be compatible with the behavior of Pandoc < 2.8). +document.addEventListener('DOMContentLoaded', function(e) { + var hs = document.querySelectorAll("div.section[class*='level'] > :first-child"); + var i, h, a; + for (i = 0; i < hs.length; i++) { + h = hs[i]; + if (!/^h[1-6]$/i.test(h.tagName)) continue; // it should be a header h1-h6 + a = h.attributes; + while (a.length > 0) h.removeAttribute(a[0].name); + } +}); diff --git a/presentations/Untitled_files/remark-css/default-fonts.css b/presentations/Untitled_files/remark-css/default-fonts.css new file mode 100644 index 0000000..8d035fa --- /dev/null +++ b/presentations/Untitled_files/remark-css/default-fonts.css @@ -0,0 +1,10 @@ +@import url(https://fonts.googleapis.com/css?family=Yanone+Kaffeesatz); +@import url(https://fonts.googleapis.com/css?family=Droid+Serif:400,700,400italic); +@import url(https://fonts.googleapis.com/css?family=Source+Code+Pro:400,700); + +body { font-family: 'Droid Serif', 'Palatino Linotype', 'Book Antiqua', Palatino, 'Microsoft YaHei', 'Songti SC', serif; } +h1, h2, h3 { + font-family: 'Yanone Kaffeesatz'; + font-weight: normal; +} +.remark-code, .remark-inline-code { font-family: 'Source Code Pro', 'Lucida Console', Monaco, monospace; } diff --git a/presentations/Untitled_files/remark-css/default.css b/presentations/Untitled_files/remark-css/default.css new file mode 100644 index 0000000..d37bfd2 --- /dev/null +++ b/presentations/Untitled_files/remark-css/default.css @@ -0,0 +1,72 @@ +a, a > code { + color: rgb(249, 38, 114); + text-decoration: none; +} +.footnote { + position: absolute; + bottom: 3em; + padding-right: 4em; + font-size: 90%; +} +.remark-code-line-highlighted { background-color: #ffff88; } + +.inverse { + background-color: #272822; + color: #d6d6d6; + text-shadow: 0 0 20px #333; +} +.inverse h1, .inverse h2, .inverse h3 { + color: #f3f3f3; +} +/* Two-column layout */ +.left-column { + color: #777; + width: 20%; + height: 92%; + float: left; +} +.left-column h2:last-of-type, .left-column h3:last-child { + color: #000; +} +.right-column { + width: 75%; + float: right; + padding-top: 1em; +} +.pull-left { + float: left; + width: 47%; +} +.pull-right { + float: right; + width: 47%; +} +.pull-right + * { + clear: both; +} +img, video, iframe { + max-width: 100%; +} +blockquote { + border-left: solid 5px lightgray; + padding-left: 1em; +} +.remark-slide table { + margin: auto; + border-top: 1px solid #666; + border-bottom: 1px solid #666; +} +.remark-slide table thead th { border-bottom: 1px solid #ddd; } +th, td { padding: 5px; } +.remark-slide thead, .remark-slide tfoot, .remark-slide tr:nth-child(even) { background: #eee } + +@page { margin: 0; } +@media print { + .remark-slide-scaler { + width: 100% !important; + height: 100% !important; + transform: scale(1) !important; + top: 0 !important; + left: 0 !important; + } +}