Description Usage Arguments Value Examples
Generate a vector of random effects that follow AR(1) correlation structure with rho=exp(-1/m) and variances sigmaj being given or andomly generated from uniform distribution on (1.2, 1.4).
1 |
m |
the length of the vector of the random effects |
sigmaj |
standard deviations for the random effect vector. Default is a vector from U(1.2, 1.4). |
the random effect vector of length m
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | m=50; raneff=NorRanGen(m)
# Note: If X ~ N(0, I), then tran X ~ N(0, A) with
# A being the cov matrix of AR(1), which contains the standard deviations sigma and the
# correlation coeff rho=exp(-1/m).
# i.e. corr= (1 rho rho^2 ... rho^(m-1)
# rho 1 rho ... rho^(m-2)
# ...................
# rho^(m-1) rho^(m-2) ... rho )
#
# To see the correlation values, run the following example
# j1=seq(25); cv=numeric()
# for (j in 1:25){
# lag=abs(j1-j)/25; cv=rbind(cv, exp(-lag))
#}
# row.names(cv)=j1; colnames(cv)=j1; cv[1,]
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.