0

I am trying to generate monthly stock data using a one-factor model:

$$R_{a,t} = \alpha + B*R_{b,t}+\epsilon_{t}$$

The description says:

$R_{a,t}$ is the excess asset returns vector, $\alpha$ is the mispricing coefficients vector, $B$ is the factor loadings matrix, $R_{b,t}$ is the vector of excess returns on the factor portfolios, $R_{b}-N(\mu_{b},\sigma_{b})$, and $\epsilon_{t}$ is the vector of noise, $\epsilon - N(0,\sum_{e})$, which is independent with respect to the factor portfolios.

For our simulations, we assume that the risk-free rate follows a normal distribution, with an annual average of 2% and a standard deviation of 2%. We assume that there is only one factor (K=1), whose annual excess return has an annual average of 8% and a standard deviation of 16%. The mispricing $\alpha$ is set to zero and the factor loadings, B, are evenly spread between 0.5 and 1.5. Finally, the variance-covariance matrix of noise, $\sum_{\epsilon}$, is assumed to be diagonal, with elements drawn from a uniform distribution with support [0.10,0.30], so that the cross-sectional average annual idiosyncratic volatility is 20%.

Using the information provided here I try to generate the data:

alpha <- 0 #mispricing index is set to 0

B <- matrix(runif(1000,min=0.5,max=1),100,10) #factor loadings matrix is evenly spread between 0.5 and 1.5

R <- rnorm(100,mean=8/12,sd=16/sqrt(12)) #factor with annual excess return of 8% and standard deviation of 16%

epsilon <- rnorm(100, mean=0,sd=runif(10,min=0.1,max=0.30)) #error term with mean 0 and standard deviation drawn from a uniform distribtion

Then I generate the data:

data <- alpha + B*R + epsilon

My question is: am I interpreting this description correctly?

IRTFM
  • 258,963
  • 21
  • 364
  • 487
user3742038
  • 77
  • 1
  • 8
  • I doubt that is correct. The equation at the top implies that after the initial `R_{a, 0)` value is set that the `R_{a,t}` vector is entirely determined by the `alpha`, `B` , and noise vectors. – IRTFM Jan 14 '16 at 00:21
  • That's my understanding as well. In my setup data = R_{a,t}. Do you have a hint what I'm doing wrong? I generate R_{a,t} from alpha, B, the initial R_{a,0} values and the noise vector. – user3742038 Jan 14 '16 at 20:17
  • No. You generated "R" as an instance of a random draw from a normal distribution. You should use a for-loop because you do not have a recurrence equation that lets you use a vectorized calculation. I have no way of knowing whether your construction of the factor loadings matrix or noise vector is correct. – IRTFM Jan 14 '16 at 22:05
  • Thank you for your help. I constructed the factor loadings matrix by randomly filling the matrix with values between 0.5 and 1. I'm not sure if I understand the process correctly. Can you explain in words the steps involved or can you point me to a good source that describes how the data should be generated? I haven't been able to find such a step by step source. – user3742038 Jan 14 '16 at 22:14
  • I don't think you are ready for coding advice. You do not seem to have a conceptual grasp on the process. This appears to be homework, so the appropriate response would be to take this to your academic instructor or teaching assistant. (Or find a help site that is focussed on modeling financial processes. Have you searched the StackExchange websites? Perhaps: http://quant.stackexchange.com/) – IRTFM Jan 14 '16 at 22:21
  • Hi. This is not homework and I tried quant.stackexchange but I haven't received any help. I agree that I don't fully understand the process. For example the description does not explain what the subscripts 'a' and 'b' stand for. The text also doesn't mention anything about an iterative process. If you do understand the process it would be really great if you could describe it in words. I can then modify the code above in light of that and we can see if I can get there. – user3742038 Jan 15 '16 at 11:15
  • You got a useful comment on your question but you made no edits of the code to remedy the error that was identified. Why should further potential respondents pitch in if you are not making changes? – IRTFM Jan 15 '16 at 17:04

0 Answers0