93 lines
2.5 KiB
Python
93 lines
2.5 KiB
Python
#!/usr/bin/env python3
|
|
# -*- coding: utf-8 -*-
|
|
"""
|
|
Simulation assignment 2024 - 2025
|
|
|
|
STARTER FILE
|
|
|
|
"""
|
|
|
|
import os
|
|
|
|
import matplotlib.pyplot as plt
|
|
import numpy as np
|
|
import numpy.linalg as la
|
|
import pandas as pd
|
|
import scipy.stats as stats
|
|
import statsmodels.api as sm
|
|
#import varplot as vpl
|
|
|
|
#plt.style.use("finthabo")
|
|
|
|
# this imports all functions from the helper file
|
|
from helper import data_frame_to_latex_table_file, print_question
|
|
|
|
#colors = vpl.color_list()
|
|
|
|
# -----------------------------------------------------------------------------
|
|
# -----------------------------------------------------------------------------
|
|
# Start of Script for Simulation assignment Econometrics
|
|
# -----------------------------------------------------------------------------
|
|
# -----------------------------------------------------------------------------
|
|
|
|
# -----------------------------------------------------------------------------
|
|
# Set the folders for output of graphs and tables
|
|
# -----------------------------------------------------------------------------
|
|
|
|
# for the figures
|
|
FIGURE_DIR = "../figures/"
|
|
if not os.path.exists(FIGURE_DIR):
|
|
os.makedirs(FIGURE_DIR)
|
|
# for the latex document
|
|
REPORT_DIR = "../report/"
|
|
if not os.path.exists(REPORT_DIR):
|
|
os.makedirs(REPORT_DIR)
|
|
|
|
# -----------------------------------------------------------------------------
|
|
# Here we set the seed for our group to your group number
|
|
# -----------------------------------------------------------------------------
|
|
|
|
|
|
# first birthday
|
|
bd_1 = 3112
|
|
# second birthday
|
|
bd_2 = 3112
|
|
|
|
group_seed = bd_1 * bd_2
|
|
|
|
# set the seed
|
|
np.random.seed(group_seed)
|
|
|
|
# -----------------------------------------------------------------------------
|
|
# set the random number generator and seed
|
|
# -----------------------------------------------------------------------------
|
|
|
|
# setting for output printing
|
|
print_line_length = 90
|
|
print_line_start = 5
|
|
|
|
# the number of data sets that we will simulate
|
|
num_obs = 2**10
|
|
|
|
# set the seed and the random number generator for reproducible results
|
|
# this ensures that every time you run this code you get exactly the same random numbers.
|
|
# changing the seed would change the random numbers.
|
|
rng = np.random.default_rng(group_seed)
|
|
|
|
# the true value of the parameters.
|
|
# Known in your role as creator, unknown to the modeller.
|
|
beta = np.array([3.0, -4.0, 2.0])
|
|
|
|
# standard deviation of the error terms
|
|
u = rng.normal(0, 3, (num_obs,))
|
|
|
|
x1 = rng.normal(3, 6, (num_obs,))
|
|
x2 = rng.normal(2, 5, (num_obs,))
|
|
|
|
# y = TODO
|
|
|
|
# X = TODO
|
|
|
|
# m = TODO
|
|
# results = #TODO
|
|
|