Calculating error from parameter distribution

1 visualización (últimos 30 días)
Sam Falzone
Sam Falzone el 24 de Mzo. de 2011
Respondida: the cyclist el 4 de Abr. de 2023
I have a distribution. It is a multi-peaked distribution of signal magnitude over a range of frequencies. This distribution is made up of discrete measurements. I have error associated with each point in the distribution obtained from the covariance matrix of my data.
What I want to do, I've calculated the mean-log frequency for the distribution, and now I want to calculate the error associated with this value. How would I propagate the error from the points of the frequency distribution to the mean-log value.

Respuestas (1)

the cyclist
the cyclist el 4 de Abr. de 2023
I don't know if there is a way to do this analytically, but I believe you should be able to calculate the error using Monte Carlo simulation. (This is a common method for error estimation of statistics that are not analytically tractable.)
You should definitely thoroughly check the following code, which I threw together rather quickly, especially if this is for something important!
% Your measurement
f_meas = [10; 20];
% Covariance array
f_err = [0.1 0.0;
0.0 0.2];
% Number of simulations
NSIM = 10000;
% Generate the Monte Carlo simulations of errored measurements
f_sim = mvnrnd(f_meas,f_err,NSIM);
% Define some function of the inputs that you care about
func = @(x) mean(log(x));
% For each simulation, apply the function.
% (You can probably do this step more efficiently that a loop, but it might depend on the function)
func_val = zeros(NSIM,1);
for ns = 1:NSIM
func_val(ns) = func(f_sim(ns,:));
end
% Take the mean (over the simulations)
mean_func_val = mean(func_val)
mean_func_val = 2.6488
% Error in the statistic is the standard deviation over the simulations
err_func_val = std(func_val)
err_func_val = 0.0194
% Plot histograms of the simulated values, as a sanity check
figure
tiledlayout(3,1)
ax1=nexttile;
histogram(f_sim(:,1))
ax2=nexttile;
histogram(f_sim(:,2))
nexttile
histogram(func_val)
xline(mean_func_val,"Color","red")
xline(mean_func_val-err_func_val,"Color","red","LineStyle","--")
xline(mean_func_val+err_func_val,"Color","red","LineStyle","--")
linkaxes([ax1 ax2],"x")

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by