Lecture 6
- Time schedule:
- 12.30-14.15 : Lectures
- 14.30-16.15 : Exercises
- Topic:
- Estimation, confidence intervals and maximum likelihood
estimation.
- Literature:
- [W] sections 9.1 - 9.5 (skip subsection on "One-sided
Confidence Bounds") and sections 9.8, 9.12 and 9.14.
- Slides:
- PDF
- Exercises:
MATLAB exercises:
- Generate a random sample of size 100 from a standard normal
distribution using x = normrnd(0,1,100,1)
(it
generates a 100 by 1 matrix of independent samples from a
normal distribution with mean 0 and standard deviation
1)
- Create a histogram using hist(x)
or histfit(x)
- Find the sample mean and standard deviation
using mean(x) and std(x)
- Find the size of x using size(x), try
also size(x,1) and size(x,2)
- Find 95% confidence interval for mean and variance
- Download the data set wage1.dat
here (rightclick and Save Page As...)
- In MATLAB import the data using data =
importdata('wage1.dat') (you might need to adjust the
path, alternatively experiment with
the uiimport)
- The variable data contains three
"subvariables":
- data - a 526 x 24 matrix containing the
observed values for 24 different variables for 526 different
people.
- textdata - contains the names of the 24 variables
- colheaders - same as textdata
- We want to test if there is a difference in the (log) wage
between men and women
- Extract the 6th column which contains information about
gender: female = data.data(:,6)
- female is a vector of zeros and ones, where one
indicates that the person is female and zero indicates male.
- Extract the 22nd column which contains the
log-wage: lwage = data.data(:,22)
- Construct lwage_male = lwage(female==0)
and lwage_female =
lwage(female==1).
Then lwage_male contains
the log-wage for males and lwage_female contains the
log-wage for females.
- Make histograms of the log-wage for men and women, and
calculate the sample mean and standard deviation for each
group.
Does there seem to be a difference?
- Test the following hypotheses, at the 5% significance
level:
You should calculate the test statistic and compare it to
critical values and calculate the p-value.
- Verify your results using ttest2.
- English - Danish:
- unbiased = middelrettet/central
- biased = ikke middelrettet/ikke central
Svante