# Defining a multilinear non-stationary parameter (GEV for IDF curves)

Hi there,

I’m having trouble defining a non-stationary parameters in a hierarchical model.

The scale parameter of the gev (duration depedent, used for constructing IDF curves), which is stationary, is defined as:
\sigma(d) = \sigma_0 (d+\theta)^{-\eta}

Usually the duration dependent location parameter is defined as:
\mu(d) = \tilde\mu \times \sigma_0 (d + \theta)^{-\eta}

However, I have made the location parameter non-stationary and it is defined as:
\mu_0(d) + COV_1\mu_1(d) + COV_{2} \mu_2(d) = \tilde\mu \times \sigma_0 (d + \theta)^{-\eta}

So far, I have this code:

data {
int<lower=1> N;    //observation and duration vector length
int<lower=1> J;    //number of weather stations
int<lower=1> D;    //number of durations
vector[N] y[J,D];  //data matrix
vector[D] d;       //duration vector
vector[J] COV1;    //covariate altitude
vector[J] COV2;    //covariate temperature
}

parameters {
real mut[J];
real sigma0[J];
real theta[J];
real eta[J];
}

transformed parameters {
real mu0[D];
real mu1[D];
real mu2[D];
for (dd in 1:D) {
for (j in 1:J) {
mu0[dd] + (mu1[dd] *COV1[j]) + (mu2[dd]*COV2[j]) = mut[j]*sigma0[j]*(d[dd]+theta[j])**(-eta[j]);
}
}
}


Obviously, this won’t work (see error):

SYNTAX ERROR, MESSAGE(S) FROM PARSER:
Illegal statement beginning with non-void expression parsed as
mu0[dd] + mu1[dd] * COV1[j] + mu2[dd] * COV2[j]


Is there another way of fomulating this?

The error is here:

To be a legal Stan assignment statement, the left hand side of the equality has to be a variable with optional indexes. It can’t be a general arithmetic expression like you have here. Not being sure what you were trying to do, I’m not sure what to suggest as a fix.