-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbasicModels.Rmd
More file actions
51 lines (37 loc) · 897 Bytes
/
basicModels.Rmd
File metadata and controls
51 lines (37 loc) · 897 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
---
title: "DIYMacro"
output: html_document
date: "2024-03-07"
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
```{r}
rm(list=ls(all=TRUE))
# Set number of parameterisations that will be considered
S=2
# Set fixed parameter values
c0=3
c1=0.8
#Create vector in which equilibrium solutions from different parameterisations will be stored
Y_eq=vector(length=S)
C_eq=vector(length=S)
#Create vector with parameter that will change
I0=vector(length=S)
I0[1]=5
I0[2]=6
# Initialise endogenous variables at arbitrary positive value
Y=C=1
#Solve this system numerically through 500 iterations based on the initialisation
for (i in 1:S){
for (iteration in 1:500){
Y = C + I0[i]
C = c0 + c1*Y
} # close iterations loop
#Save results for different parameterisations in vector
Y_eq[i]=Y
C_eq[i]=C
} # close parameterisations loop
# Display solutions
Y_eq
```