Simulation of experimental data

Files and parameters

(* number of time steps in the trajectory*)
nSteps=2000;

(* transition matrix*)
T ={{0.92, 0.08,0}, {0.05, 0.9, 0.05},{0.01, 0.95, 0.04}};

(* emission probabilities -> Gaussian distribution -> mu, sigma*)
EParam={{1,0.4},{2,0.6},{3, 0.5}};

State trajectory

stateTraj = ConstantArray[0,nSteps];
stateTraj[[1]]=1;

Do[{
currentState=stateTraj[[i]];
stateTraj[[i+1]]=RandomChoice[T[[All,currentState]]->{1,2,3}];
},{i,1,nSteps-1}]

ListPlot[stateTraj]

Observed trajectory

obsTraj = ConstantArray[0,nSteps];

Do[{
mu=EParam[[stateTraj[[i]],1]];
sigma=EParam[[stateTraj[[i]],2]];
obsTraj[[i]]=RandomVariate[NormalDistribution[mu,sigma]];
},{i,1,nSteps}]

ListPlot[obsTraj, BaseStyle->FontSize->22, AspectRatio->0.2, PlotStyle->PointSize[0.003]
]