Docsity

Estimation and Sampling: Understanding Statistical Inference with R - Prof. Kobi Abayomi, Study notes of Data Analysis & Statistical Methods

Toggle sidebar
bg1
ISYE 2028 A and B
Lecture 9
Estimation and Sampling
Dr. Kobi Abayomi
March 25, 2009
1 Sampling
When we sample we draw observations from a population with a distribution. Our samples
are our observations. We often, almost always really, say that our samples are independent
and identically distributed. From our samples, we generate estimates for our population
parameters.
In general, our estimates are statistics: quantities whose value can be calculated from sample
data. Prior to obtaining data, there is uncertainty as to what value of any particular statistic
will result. There, a statistic is a random variable and will be denoted by an uppercase letter;
a lowercase letter is used to represent the calculated or observed value of the statistic.
As a random variable, a statistic has a probability distribution - we call it the sampling
distribution. The sampling distribution depends upon the population distribution (normal,
uniform, etc) and the sample size, n, and on the method of sampling.
We say that the rv’s (random variables) X1, ..., Xnare a (simple) random sample of size n
if:
1. The Xi’s are independent rv’s.
2. Every Xihas the same probability distribution (i.e. identical).
1
pf3
pf4
pf5
pf8
pf9
pfa

Partial preview of the text

Download Estimation and Sampling: Understanding Statistical Inference with R - Prof. Kobi Abayomi and more Study notes Data Analysis & Statistical Methods in PDF only on Docsity!

ISYE 2028 A and B

Lecture 9

Estimation and Sampling

Dr. Kobi Abayomi

March 25, 2009

1 Sampling

When we sample we draw observations from a population with a distribution. Our samples are our observations. We often, almost always really, say that our samples are independent and identically distributed. From our samples, we generate estimates for our population parameters.

In general, our estimates are statistics: quantities whose value can be calculated from sample data. Prior to obtaining data, there is uncertainty as to what value of any particular statistic will result. There, a statistic is a random variable and will be denoted by an uppercase letter; a lowercase letter is used to represent the calculated or observed value of the statistic.

As a random variable, a statistic has a probability distribution - we call it the sampling distribution. The sampling distribution depends upon the population distribution (normal, uniform, etc) and the sample size, n, and on the method of sampling.

We say that the rv’s (random variables) X 1 , ..., Xn are a (simple) random sample of size n if:

  1. The Xi’s are independent rv’s.
  2. Every Xi has the same probability distribution (i.e. identical ).

1.1 An example in R

X<-c(40,40,45,45,45,50,50,50,50,50) n<- x<-sample(X,n,replace=TRUE)

Here X is our population from which we’ll draw and x is our representative sample Remember that help(sample) will give you help).

This little function will allow us to get the probability of a sample from a population:

jointp<-function(smple,pop) { k<-length(smple) lpop<-length(pop) p<-rep(0,k) for(i in 1:k){ h<-smple[i] t<-pop==h tts<-sum(t) p[i]<-tts/lpop } pp<-prod(p) print(pp) }

We can calculate the true likelihood for this simple example using this information.

print(jointp(x,X))

In general, the likelihood for observed data is the probability under the model

L(θ) = f (x; θ)

and for a simple random sample, usually looks like:

∏^ n

i=

f (xi; θ)

We can look at the sample distributions of these quantities

h<-smeenvar(100,50,X) hist(h[,1]) hist(h[,2])

2 Remember the first sampling distribution and esti-

mators

Remember that we observe data only, not values of the population (parameters). We can use, though, our assumptions (or beliefs) about the population, and facts about random variables, to draw very powerful conclusions about our data. The facts are about the sampling distribution, or the distribution of the observed data.

One very powerful fact concerns the distribution of estimates (or averages) from the data. Succinctly, when we take many samples, we believe our estimates are normally distributed.

2.1 The sampling distribution

Let’s make this assumption.

We have sampled some data, x 1 , ..., xn from a population that (we believe) is distributed X ∼ μ, σ^2.

Remember that x =

∑ (^) xi n =^

1 n

xi.

So, using what we know about expectations:

E(x) = E(

∑ (^) xi n

n

E(

xi) =

n

[E(x 1 ) + · · · + E(xn)]

n

[nμX ]

E(x) = μX (1)

In words: the expectation of the sample mean is the population mean

As well, using what we know about the variance:

V ar(x) = V ar(

∑ (^) xi n

n^2

V ar(

xi) =

n^2

σX 2

V ar(x) =

σX 2 n

In words: the variance of the sample mean is the population variance divided by the size of the sample

These statements, equations (1) and (2) are true for any random variable (X ∼ μ, σ^2 ). These are the mean and variance of the sample mean.

2.1.1 Example

Say X ≡ the number of success in n trials; each success has probability p. Then X has a Binomial distribution with parameters n and p: X ∼ Bin(n, p). We know already that E(X) = np and V ar(X) = np(1 − p).

So, if I have a sample x 1 , ..., xn^1 , that is I have n experiments – each of n trials...

...Then E(x 1 ) = · · · = E(xn) = np, since the expected value of each draw from the population is the same. We also know that V ar(x 1 ) = · · · = V ar(xn) = np(1 − p). Here x ≡ the mean number of successes in n samples of a Binomial (Bin(n, p)) experiment. Thus...

E(x) = np V ar(x) = p(1 − p)

2.1.2 Example

Say we let Y ≡ the proportion of successes in a Binomial experiment, Y = Xn. So

E(Y ) =

n

E(X) =

n

np = p

(^1) So the size of each sample is n and the number of samples is n

3 Estimators and Estimation

In general, point estimation is the procedure of selecting a ”best” value for a parameter, and thusly specifying a probability model.

The setup, using mathematical notation, is like this. Let a random variable X have a pdf f (x; θ). Some Examples we have seen: X ∼ P oi(λ) so f (x; θ = λ) = λ xe−λ x! ;^ X^ ∼^ N^ (μ, σ) so

f (x; θ(μ,σ (^2) )) = (2πσ^2 )−^1 /^2 e−^

(x−μ)^2 2 σ^2 ; etc.

The procedure of point estimation is using a function of the data X = (x 1 ,... , xn), as a statistic which will be a good estimator of the parameter(s) θ.

3.1 Bias

We’ve already introduced some notation. ”Theta hat” or θˆ is our estimator for θ and we call the bias the difference between the expected value of the estimator and the parameter being estimated:

Bias = E(θˆ) − θ (3)

We call an estimator unbiased if the bias is zero.

For example, S^2 = (n − 1)−^1

∑n i (xi^ −^ x)

(^2) is an unbiased estimator for σ (^2) since E(S (^2) ) = σ (^2).

3.2 Methods of Moments Estimation

Say we have an X ∼ Gamma(α, β). We know then that E(X) = μX = αβ and V ar(X) = σ X^2 = αβ^2.

We’ll take a simple random sample: X 1 , ..., Xn, we believe each Xi ∼ Gamma(α, β). Our task is to use the sample Xn to generate estimates for θ = (α, β).

We know immediately E(x) = E(X) = αβ. A ”reasonable” estimate of αβ, using this fact, is ˆα βˆ = x.

This, in general, is called the method of moments for generating point estimates of parame- ters. A moment is an expectation of some power of a random variable.

The kth population moment is the expectation of the random variable, raised to the kth power: E(Xk). The kth sample moment is the arithmetic average of the sample data, raised

to the kth power: Mk =

∑n i X

k i /n. The^ Method of Moments^ estimators for^ θ, when^ θ^ has^ p elements, are generated by:

  • Calculating the population moments E(Xk) for k = 1, .., p.
  • Calculating the sample moments Mk =

∑n i X k i /n.

  • Setting them equal for each k, and then solving for the p parameters.

I finish the X ∼ Gamma(α, β) example. We set x = αβ. We set s^2 = αβ^2. Which yields αˆ = x 2 s^2 and βˆ = s^2 x as the^ method of moments estimators^ for^ α, β

3.3 Maximum Likelihood Estimation

A nother^3 way to estimate parameters involves using ”all” of the distribution, not just the moments.

Say we have a random variable, random process, whatever: X ∼ f (x; θ) and a sample x 1 , ..., xn, simple and random, each xi ∼ f (xi; θ). In words, we have some random process with a pdf (distribution) and a sample where each of the observations has the same pdf – θ is the value of the parameter that specifies the exact distribution from the family f (x).

The probability of observing a particular sample x 1 , ..., xn is the joint probability of x 1 , ..., xn. We call this the likelihood :

lik(θ; xn) = f (xn; θ) (4)

Notice that here we are considering the likelihood as a function of parameter θ: the likelihood is the probability that we would observe a sample at a value of θ.

When we have a simple random sample, we assume each observation in the sample is dis- tributed independently and equivalently: We can rewrite the likelihood:^4

lik(θ; xn) =

∏^ n

i

f (xi; θ) (5)

(^3) ha, ha, is there a word ‘nother’, there should be (^4) Product notation: Remember the summation notation? The product notation is the same, with a ∗

separating each term instead of a +

and

∂σ

loglik =

−n σ

σ^3

∑^ n

i=

(xi − μ)^2

Equating these equal to zero yields the normal or estimating equations.: two equations and two unknowns here.

∑^ n

i=

(xi − μ) = 0

σ^3

∑^ n

i=

(xi − μ)^2 =

n σ

This yields:

The estimator for μ, the mean:

μˆM LE = x =

xi/n

So the sample mean is the maximum likelihood estimate for μ and is also an unbiased estimator.

The estimator for σ^2 , the variance:

σˆ^2 M LE =

(xi − x)^2 /n

So the maximum likelihood estimate differs from S^2 =

(xi − x)^2 /(n − 1) by a factor of n/(n − 1). So the mle for σ^2 is biased (we already know S^2 is unbiased).

The mle θˆ has a nice property. The estimate of a function of θ equivalent to the value of a function at the estimate of θ. In notation, for any function h(θ), the value of the estimate

of the function h(ˆθ) is h(θˆ). That is: h(ˆθ) = h(θˆ). This is the invariance property of the maximum likelihood estimator.

4 Exercises

  • Since you know that the CLT yields x ∼ N (E(X), V ar(X)/n) for any X ∼ E(X), V ar(X)
    • convince yourself of the distribution of the sample mean from:
      1. X ∼ Ber(p)
      2. X ∼ Bin(n, p)
      3. X ∼ P oi(λ)
      4. X ∼ Γ(α, β)
  • Show that the maximum likelihood estimator for σ^2 from a N (μ, σ^2 ) distribution is biased.
  • Derive the maximum likelihood estimators for a Bin(n, p) distribution.
  • Do exercises 9.81 and 9.82 on page 315 in your text. Compute the method of moments estimators as well for each.
  • Do exercises 9.2 and 9.3 on page 285 in your text.