I am trying to do some deconvolution of tissue.
I have a tissue sample, which is a combination of normal tissue and cancer.
I am modelling it as a mixture of normal distributions, assuming that the methylation profile of cancer and normal tissue follows relatively narrow normal distributions. That is:
M = \alpha N (\mu_{\text{cancer}}, \sigma_{\text{cancer}}) + (1 - \alpha) N (\mu_{\text{normal}}, \sigma_{\text{normal}})
where \mu_{\text{cancer}}, \sigma_{\text{cancer}} is an unknown mean and standard deviation of the cancer methylation profile, and \mu_{\text{normal}}, \sigma_{\text{normal}} are the known parameters of the normal healthy tissue. The mixture proportion parameter \alpha is unknown.
Note that this is different from the example mixture distribution, where the samples can belong to one or the other distribution. Here the Mixture is a sum of both.
My STAN code is this:
data {
int<lower=1> S; // number of samples
int<lower=1> P; // number of probes
matrix[S, P] mixed_tissue; // mixed tissue
vector[P] mu_lung; // mean of lung, estimated from data
vector[P] sd_lung; // sd of lung, estimated from data
}
parameters {
real<lower=0, upper=1> alpha; // cancer cell fraction
vector[P] mu_cancer; // mean of cancer
vector[P] sd_cancer; // sd of cancer
}
model {
// using for cycle:
for (s in 1:S) {
for(p in 1:P) {
mixed_tissue[s, p] ~ alpha[s] * normal(mu_cancer[p], sd_cancer[p]) + (1 - alpha[s]) * normal(mu_lung[p], sd_lung[p]);
}
}
}
Yet, I get a non-explanatory error “PARSER EXPECTED: ” pointing at mu_lung
. I don’t understand what it means, mu_lung
is a fixed value, nothing interesting, nothing required to sample/estimate. In other examples, fixed values are explicitly passed.
Thanks for help.
ps. first time using STAN. Not yet familiar with the target
notation.