Hi UQWorld!

Currently I am trying to implement a custom likelihood function, which has the shape of a **uniform distribution**. To have a continuous function which has everywhere non-zero values, the generalized normal distribution was taken, which resembles a uniform distributions for higher k:

PDF = \frac{k}{2 \alpha \Gamma(k^{-1})} e^{-(\frac{x}{\alpha})^k}

(Generalized normal distribution - Wikipedia)

As a first try, I took the provided example “uq_Example_Inversion_06_UserDefinedLikelihood” and mainly worked in the “uq_customLogLikelihood” function to achieve my goal. Furthermore, I want to have **multiple data** in the process, due to that I added a few rows of example measurements.

line 107 in the RunPad:

```
myData.y.meas = Data(1:10:end).*ones(3, ceil(length(Data)/10)).*[0.9; 1; 0.8];
```

My likelihood function looks as follows:

```
.
.
k = 2; % Modifier for generalized gaussian
% Loop through realizations
logL = zeros(nReal,1);
for ii = 1:nReal
% Get the covariance matrix
C = eye(nOut2)*sigma2(ii);
L = chol(C,'lower');
Linv = inv(L);
% Compute inverse of covariance matrix and log determinant
Cinv = Linv'*Linv;
logCdet = 2*trace(log(L));
% evaluation
logLikeli = 0;
for jj = 1:nOut1
logLikeli_val = - 1/2*logCdet - 1/2*sum(abs((measurements(jj,:)-modelRuns(ii,:))*Linv).^k); % modified gaussian
logLikeli = logLikeli + logLikeli_val;
end
% Assign to logL vector
logL(ii) = logLikeli;
end
```

where nOut1 is the number of rows of myData.y.meas.

For k = 2 this corresponds to the classical normal distributions and the code runs as I expect. But as soon as I start to increase k to have an approximate uniform distribution the **chains** are approaching each other very **close**, which I do not understand.

Is there a mistake?

Best,

Marco

PS: I would like to share my entire script, but it seems, that I cannot upload it because I am a new user. I hope you have everything, otherwise please do not hesitate to ask.