# Modelling multiple correlated variables

I am completley new to pymc3 and really like the api and the flexibility that comes along.

However, I am stuck at modelling something a cash flow model. For sake of simplicity let’s say I want to model the following:

y = \sum_{t=0}^T \dfrac{CF_t}{(1+r)^t}

where all CF and r are normally distributed and CFs are correlated.

How would I best model this assuming the following priors

1. all CFs follow a normal distribution with different mus and stds
2. all CFs are correlated
3. r follows a normal distribution

My main challenges are:

1. how do I best create T parameters with different mus and std. I know that I can pass a shape parameter, but I cannot pass different mus and stds? Is the only way to create individual parameters?
2. how do I model that y is the sum of different parameters?
3. how do I model the correlation part? (this is likely a prob programming question rather than a pymc3 question

My below attempt works but has two pitfalls:

1. if T = 100 I had to model 100 separate variables
2. it does not account for correlations between cf1, cf2 and cf3
T = 3
model = pm.Model()
with model:
# Define priors
cf1 = pm.Normal("cf1",100,10)
cf2 = pm.Normal("cf2",100,15)
cf3 = pm.Normal("cf3",100,20)

i = pm.Normal("i", 0.1,0.04)
t = range(0,T)

# Model output and treat as deterministic to keep track
y = pm.Deterministic("y",cf1/(1+i)**t[0] + cf2/(1+i)**t[1] + cf3/(1+i)**t[2])

trace = pm.sample()


Can anyone point me to the right direction?

cfs = pm.MvNormal("cfs", mu=[100, 100, 100], cov=your_covariance_matrix, shape=3)