Introduction to statistical data analysis

| categories: statistics | View Comments

basic_statistics

Contents

Introduction to statistical data analysis

John Kitchin

clear all
clc

Problem statement.

Given several measurements of a single quantity, determine the average value of the measurements, the standard deviation of the measurements and the 95% confidence interval for the average.

the data

y = [8.1 8.0 8.1];

the average and standard deviation

ybar = mean(y);
s = std(y);

the confidence interval

This is a recipe for computing the confidence interval. The strategy is:
1. compute the average
2. Compute the standard deviation of your data
3. Define the confidence interval, e.g. 95% = 0.95
4. compute the student-t multiplier. This is a function of the confidence
interval you specify, and the number of data points you have minus 1. You
subtract 1 because one degree of freedom is lost from calculating the
average. The confidence interval is defined as
ybar +- T_multiplier*std/sqrt(n).
ci = 0.95;
alpha = 1 - ci;

n = length(y); %number of elements in the data vector
T_multiplier = tinv(1-alpha/2, n-1);

ci95 = T_multiplier*s/sqrt(n);

% confidence interval
[ybar - ci95, ybar + ci95]

% we can say with 95% confidence that the true mean lies between these two
% values.
ans =

    7.9232    8.2101

% categories: statistics
blog comments powered by Disqus