Andrés Vaca
Andrés Vaca

Reputation: 33

UndefVarError: Normal not defined

At the moment of running the model the "Normal" says that it is not defined. However, the idea is that it is a function that indicates random numbers of normal distribution with specific mean and variance.

The original code was made in Julia V0.5.2 but Julia 1.0.3 mentions that "Normal" does not exist.

n=5000;
t=15000;
lambda=0.8;
sigmae1=0.05;
sigmae2=0.1;
sigmaz= 0.013;
n_lambda= trunc(Int, lambda*n)
eshocks1=rand(Normal(0.0,sigmae1), n_lambda, t);
eshocks2=rand(Normal(0.0,sigmae2), n - n_lambda, t);
zshocks =rand(Normal(0.0, sigmaz),1, t);

UndefVarError: Normal not defined

Stacktrace: [1] top-level scope at In[5]:21

Upvotes: 1

Views: 1216

Answers (1)

Bill
Bill

Reputation: 6086

add Distributions, then put

using Distributions

at the top of the code, for use with newer Julia versions. The later versions of Julia tend to have non-Base functions as optional modules that need to be added to the installation.

Upvotes: 2

Related Questions