All posts by ad

Confidence Intervals R Code Part 1

The following code produces confidence intervals in R using the normal distribution and confidence intervals using the t-distribution.

The code reproduces the figure 1 presented in this post.

Continue reading Confidence Intervals R Code Part 1

Linear Regression in Julia 1.0

Julia presents various ways to carry out linear regressions. In this previous post, I explained how to run linear regression in Julia using the function linreg(). Unfortunately, linreg() is deprecated and no longer exists in Julia v1.0.

In this post I will present how to use the native function of Julia to run OLS on the following model

y = \alpha + \beta_{1} x_{1}

Continue reading Linear Regression in Julia 1.0

What is the difference between using the t-distribution and the Normal distribution when constructing confidence intervals?

This blog post explains the difference between confidence intervals that use the t-distribution and confidence intervals that use the Normal distribution. Thereby, the post will not focus on the theoretical/mathematical differences of the two distributions, but rather compare the two types of confidence intervals using simulation studies. Furthermore, in case you are interested in replicating the presented results or simply play around with it yourself, I provide the R code to conduct the simulation exercises and to replicate the figures.

Continue reading What is the difference between using the t-distribution and the Normal distribution when constructing confidence intervals?

Confidence Intervals in R

In this post, I will show how one can easily construct confidence intervals in R. Assume you have a vector of numbers and you want to construct a confidence interval around the mean of this vector. The subsequent R code shows one easy way to calculate the confidence interval around the mean of this vector. The following code loads a function that allows you to pass on the vector and returns the confidence intervals. Per default the function returns the 95% confidence interval. However, the parameter ‘conf_level’ allows you to specify the interval you want.

Continue reading Confidence Intervals in R

WordAds Review 2018

One year ago, my blog reached the minimum traffic requirement of WordAds and the advertising platform added my blog to their program. Starting October 2017, I was able to display ads on my blog and earn part of the generated income. At the beginning, I was very excited. However, after few enthusiastic months, I soon realized that I will not be able to earn lots of money using WordAds. Sure, displaying adds earns some money, but compared to my regular salary, it is negligible.

Continue reading WordAds Review 2018

Generate Gamma Distributed Numbers in Julia

In Julia, one can generate random numbers that follow a Gamma distribution by using the Distribution package. Thereby one can use the rand() function that draws random numbers and specify the Gamma distribution by using the Gamma(a,b) command. The parameters a and b define the shape parameters of the Gamma distribution. This article provides a more generic overview of how to generate random numbers in Julia.

Continue reading Generate Gamma Distributed Numbers in Julia

Aggregate Demand

What is aggregate demand? Aggregate demand refers to total expenditure in an economy in a certain period. That is, aggregate demand comprises everything that is spend in an economy in one period. One can split aggregate demand into different subcomponents. Formally, one can describe aggregate demand (Y) as

Y = C + I + G + NX

As one can see from the equation above, aggregate demand (Y) is equal consumption (C) plus investment (I) plus government spending (G) plus net exports (NX), i.e. how much we are selling abroad to other countries on net.

According to Keynesian theory, aggregate demand determines the amount of available expenditure in an economy. Now, why should one care about available expenditure? Well, in Keynesian economics, available expenditure determines the amount of means available in an economy in order to sustain labor hires in a given period. That is, in the Keynesian model, the available expenditures is what keeps people at work. Boldly speaking, the amount of expenditure defines the amount of available money to pay the wages of workers. This concept is particularly important during a recession. Assume for instance, that a shock hits the economy and aggregate demand decreases. This implies that demand for firms’ products drops and firms will sell less products and earn less money. Hence, at the end of the month firms have less money available to pay their employees. Meaning that firms will be forced to lay off some workers and unemployment increases. Hence, in a Keynesian setting, a drop in aggregate demand implies a decrease in the means available in an economy, leading to less jobs and higher unemployment.

Continue reading Aggregate Demand