In: Statistics and Probability
I need r code for the following:
In each simulation case, 3000 independent Gaussian time series of length n = 20, 50, 200, 800.
Thanks
In each simulation case, 3000 independent Gaussian time series of length n = 20, 50, 200, 800.
The statement means the following:
1. Length of a Time-series refers to the number of days in the the time-series.
2. Gaussian time series means that the observations of the time-series follow Normal distribution.
3. Independent time-series mens that the correlation between the two time-series is zero.
So, overall the statement means that there are 3000 Gaussian time series where in between any two of them the correlation is zero each consisting of 20, 50,200,800 days respectively.
R Code is as follows:
n = c( 20, 50, 200, 800 )
Data1=Data2=Data3=Data4= NA
for( i in 1:4 )
{
for( j in 1:3000 )
{
X=rnorm( n[i],0,1 )
if( i==1 )
{
Data1=cbind( Data1, X )
}
if( i==2 )
{
Data2=cbind( Data2, X )
}
if( i==3 )
{
Data3=cbind( Data3, X )
}
if( i==4 )
{
Data4=cbind( Data4, X )
}
}
}
----------------------------------------------------------------------------------------
Note: The Columns of Data1,Data2,Data3,Data4 are the required Gaussian Time-series.