# [R-SIG-Finance] Generating Data for Portfolio Simulation

Tom Smythe ts3665 at gmail.com
Tue Feb 17 20:24:27 CET 2009

```Hi All,

I am looking for a way to generate generate M snapshots of return data
for all securities in an N security universe.  The return for the n-th
security at the m-th snapshot should come from a simple factor model
such that
r[n,m] = alpha[n] + beta[n] * rm[m] + epsilon[n,m],
where rm[m] is the market return, and epsilon[n,m] is noise with zero
mean and given covariance (more on this below).

The issue that I am facing is that I want the market return to be the
weighted sum of the individual security returns.  That is
rm[m] = sum_n b[n] r[n,m]
where b[n] is the ratio of the n-th security's market capitalization
to the total market capitalization, and rm[m] has a given (time
series) mean and variance.

Some other constraints of the problem are that the weighted alpha is zero
sum_n b[n] alpha[n] = 0
and the weighted beta is one
sum_n b[n] beta[n] = 1.
It would be nice if the noise term epsilon[n,m] had zero column (i.e.,
cross-sectional) mean and zero row (i.e., time series) mean; but both
of these requirements cannot be met simultaneously because they force
the covariance matrix to be singular.  For simplicity, I'd like to
assume that the covariance is non-singular and diagonal, with known
constant diagonal elements.

This appears to be a circular problem.  I seem to be unable to specify
r[n,m] without rm[m], and vice versa.

Can anybody advise me how to generate such factor-model data that is
compatible with the given market return statistics and given noise
covariance matrix?  Unless I'm missing something silly, this seems to
be an under-determined problem (if M >> N), with no unique solution.
However, in my case, any non-trivial but internally consistent
solution will do.

Thanks.

```