function [CI_low, CI_up] = Intervalo_de_Confianza(X,pp)
% Input: X vector samples, level of confidence Ex: pp=95 for 95%
N = length(X);
mu = mean(X); % sample mean (normally distributed)
sig = std(X)/sqrt(N); % sample standard deviation of the mean
alphao2 = (1-pp/100)/2; % alpha over 2
CI_low = mu + norminv(alphao2)*sig; % confidence interval lower bound
CI_up = mu - norminv(alphao2)*sig; % confidence interval upper bound
--
% Input: X vector samples, level of confidence Ex: pp=95 for 95%
N = length(X);
mu = mean(X); % sample mean (normally distributed)
sig = std(X)/sqrt(N); % sample standard deviation of the mean
alphao2 = (1-pp/100)/2; % alpha over 2
CI_low = mu + norminv(alphao2)*sig; % confidence interval lower bound
CI_up = mu - norminv(alphao2)*sig; % confidence interval upper bound
--
Juan Gabriel Colonna
No comments:
Post a Comment