Download Pharmacy 2010: Biostatistics Recommended book: Statistics: Data

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Central limit theorem wikipedia , lookup

Transcript
Pharmacy 2010: Biostatistics
Recommended book: Statistics: Data and Models, DeVeaux, Velleman
and Bock
Some Background
Population, sample, random variable, and distribution
• Based on a random sample, we wish to make inferences about the
population.
• We represent the values in the population by a random variable, say
X, and a probability distribution.
– A random variable is just a symbol for the next value we will
get.
– The probability distribution can be represented by a bar graph
or smooth density curve.
– The probability usually depends on some constants, called
parameters.
• Discrete random variables have probability in chunks at separated
values.
– For example the binomial random variable, X, is the number of
successes in n binary trials, and has probability mass function
p(x) =
n!
px(1 − p)n−x
x!(n − x)!
for x = 0, . . . , n
• Continuous random variables can, in theory, take on values in
intervals, and the probability is given by the area under a
probability density curve.
– For example, the normal random variable has a probability
density with a bell shaped density curve.
– Areas under the curve are often obtained using tables.
Problems: If Z has a standard normal density,
1. Find P (Z ≤ 1.96), the probability that Z is less than or equal
to 1.96. Answer: .975
2. Find P (Z > 1.96). Answer: 1-.975=.025
3. Find P (Z ≤ −1.96). Answer: .025 (same as part b, as normal
distribution is symmetric about 0)
4. Find P (−1.96 ≤ Z ≤ 1.96). Answer: .95 (P (−1.96 ≤ Z ≤
1.96) = P (Z ≤ 1.96) − P (Z ≤ −1.96) = .975 − .025 = .95.
• We are usually interested in a characteristic of the population, like
the mean µ.
• The mean is the balance point of the probability distribution, and
equals the median when the distribution is symmetric.
• Another important feature of a distribution is the variance, σ 2,
which is a measure of the spread of the values about the mean.
√
• The standard deviation, σ = σ 2, is in the same units as X.
• If a distribution is symmetric and unimodal (ie looks approximately
like a normal distribution), then
– approximately 66% of the probability is between µ − σ and
µ+σ
– approximately 95% of the probability is between µ − 2σ and
µ + 2σ
– approximately 99.5% of the probability is between µ − 3σ and
µ + 3σ.
Case I: estimation of a population mean
• Denote the values in a random sample as X1, . . . , Xn.
• We estimate the population mean µ using the sample mean
P
Xi
1
X̄ =
= (X1 + . . . + Xn)
n
n
• The Law of Large Numbers is a theoretical result which assures
us that the sample mean X̄ will be close to the population mean µ
in large random samples.
• Before we have data, the sample mean is itself a random variable.
• Its probability distribution is called the sampling distribution different samples give different values of the sample mean.
• The sample mean is an unbiased estimator because its sampling
distribution is centered about the population mean µ.
• A measure of error of estimation of µ by X̄ is the standard error,
which is the standard deviation of the sampling distribution of X̄.
• The standard error is much smaller than the standard deviation of
the population, and is
√
σX̄ = σ/ n
• The larger the sample, the smaller the standard error, and the more
accurate the estimate.
• We estimate the variance of the population using the sample
variance
1 X
s2 =
(Xi − X̄)2
n−1
1 X 2
X
=
Xi − ( Xi)2/n
n−1
1 X 2
=
Xi − nX̄ 2
n−1
• We estimate the standard error of the mean by
√
sX̄ = s/ n.
• If the populaton itself was normally distributed, then he sampling
distribution of the mean has a normal distribution.
• A remarkable fact is that the sampling distribution of X̄ is
approximately normal (i.e. bell shaped) in large samples regardless
of the shape of the probability distribution for the population. If a
sample size of 35 or larger is usually big enough so that the
distribution of the sample mean is approximately normally
distributed. This is the Central Limit Theorem, one of the most
important results in statistical theory.
Case II - estimation of a proportion using binary data
• In clinical trials, we are often interested in whether a therapy is a
success (X = 1) or a failure (X = 0).
• A model of the population is a Bernoulli random variable and
distribution, which says P (X = 1) = p and P (X = 0) = 1 − p.
• The quantity of interest is p, the probability of a success, which
plays the role of the mean µ in this simple case.
• The sample mean (of the 0 or 1 variables) is just the sample
proportion
1
X̄ = p̂ = (X1 + . . . + Xn)
n
• The variance of the Bernoulli random variable is
σ 2 = p(1 − p)
so we estimate the standard error of p̂ using
sp̂ =
v
u
u
u
t
p̂(1 − p̂)
n
• Once again the standard error is inversely proportional to the
square root of the sample size, and so gets smaller as the sample
size gets large.
Confidence intervals - a way to combine the point estimate and its
standard error is using a confidence interval.
Confidence interval for a population proportion.
• Suppose we are trying to estimate an unknown population
proportion p.
• In large samples, the 100(1 − α)% confidence interval for p is
r
r
p̂ − zα/2 p̂(1 − p̂)/n, p̂ + zα/2 p̂(1 − p̂)/n)
!
where zα/2 is that value from the standard normal distribution for
which only α/2 of the probability is above. (For example
z.025 = t∞,.025 = 1.96, z.05 = t∞,.05 = 1.645, z.005 = t∞,.05 = 2.576.
)
• Example: To test the effectiveness of a new pain-relieving drug, 80
(randomly selected?) patients at a clinic were given a pill
containing a drug, and 56 of the patients showed improvement of
their pain symptoms. The estimated probability of showing
improvement is p̂ = 56/80 = .7, and the 90% confidience interval
for the true population proportion showing improvement is
r
.7 ± 1.645 .7(1 − .7)/80
or approximately, (.62,.78).
Confidence interval for a population mean.
• Suppose we are interested in estimating the mean µ of a normal
population whose variance σ 2 is unknown.
• Take a random sample X1, X2, . . . , Xn from the population.
• If the underlying population is approximately normally distributed,
the 100(1 − α)% confidence interval for the mean µ is
√
√ X̄ − tn−1,α/2s/ n, X̄ + tn−1,α/2s/ n
where tn−1,α/2 is that value from the t-distribution with n − 1
degrees of freedom for which only α/2 of the probability lies above.
(For example t12,.025 = 2.179, t40,.025 = 2.021, t∞,.025 = 1.960.)
• Example: To assess the level of iron in the blood of children with
cystic fibrosis, a random sample is selected from the population of
children with CF. There were n = 13 children in the sample, having
an average iron level X̄ = 11.9µmol/l with sample standard
deviation s = 6.3µmol/l.
Based on this sample, the 95% confidence interval for the
population mean µ is
√
11.9 ± 2.179(6.3)/ 13
or approximately (8.09, 15.70).
Interpretation of a confidence interval
• The interpretation of a confidence interval is non-intuitive, but very
important.
• Before the data are collected, the interval above has probability .95
of containing µ.
• Once the data are collected and we have values for X̄ and s, the
interval becomes fixed.
• The true mean is either in the interval or not. We don’t know and
can’t assign probability to the mean being in the interval.
• (The population mean µ is not a random variable, but an unknown
constant which we are trying to estiamte.)
• We say we are 95% confident that a 95% confidence interval
contains the true mean µ, because of the large probability in
advance that such an interval contains the mean.
• Most confidence intervals we encounter are of the form
estimate ± table value × standard error
• Confidence intervals get narrower as the sample size increases.
• eg. A 90% confidence interval for a proportion is narrower than a
95% confidence interval, because z.05 is smaller than z.025
• (To be more confident of containing the true value we must take a
wider interval.)
• Note that a 95% confidence interval does NOT contain 95% of the
data values, or 95% of the values in the population.
Hypothesis testing
• In hypothesis testing we wish to compare one theory to another.
• In this course we will compare the effects of two drugs or
treatments.
• These theories are most often stated in terms of population
parameters.
• For example, where µ is the mean iron concentration in the
population of children with CF, we may wish to compare
H0 : µ ≤ µ 0
to
Ha : µ > µ0
where µ0 is a particular value of interest.
• The alternative hypothesis Ha is usually the theory we want to
prove, and we attempt to do so by showing that the data disagrees
with H0.
• The null hypothesis H0 is the theory we will stick with, unless we
get strong evidence against it. The null hypothesis always includes
the = piece, which is the value being tested for.
• The significance probability, or P value, or “p-value”, is the
probability of getting data as extreme or more extreme than what
was observed if H0 is true.
• A small P value gives evidence against H0 and in favour of Ha.
• Many test statistics we encounter also combine the estimate and its
standard error.
• For example,
X̄ − µ0
√
s/ n
is typically used to test the hypotheses above.
t=
• This test statistic measures the difference between the estimate and
the value specified in the equality in H0, on a standardized scale.
• Before we collect the data, the distribution of the test statistic
assuming H0 is true is called the null distribution.
• Often this distribution is the standard normal (when testing for
proportions), or something close to the normal, like the t
distribution (when testing for means).
• The p-value is the probability of of observing a value of the test
statistic at least as contrary to the null hypothesis, and in favour of
the alternative hypothesis, as the observedvalue of the test
statistic, assuming that the null hypothesis is true. For the
example, in the example of interest the p-value P (t ≥ tobs). It is
obtained from tables or using a suitable computer program.
• The alternative hypotheses can be two-sided, e.g. Ha : µ 6= 0, in
which case the p-value is 2P (t ≥ |tobs|), to allow for values as
extreme in either tail of the distribution.
• The p-value is widely used to quantify the evidence against H0,
generally in medical applications, as follows:
p-value
Amount of evidence
≥ .1
none
.05 ≤ P < .1 weak
.01 ≤ P < .05 strong
very strong
< .01
• These cut-off values arose from the use of tables which gave the
.01, .05 and .1 percentiles of the distribution.
• If p − value < α, where α is a small number (like .05) we can say
that the results are statistically significant at the α (say .05) level
of significance. Some people use phrases like “reject the null
hypothesis at level α”, “reject the null hypothesis at the 5% level”,
etc.
• There are two types of error which can occur with fixed α testing.
• A type I error occurs when we declare statistical significance when
H0 is true.
– This is considered a bad thing, so α (the probability of a type I
error) is chosen to be small.
• A type II error occurs when we fail to declare statistical significance
when H0 is false.
• The power of a test is the probability of correctly declaring
statistical significance when H0 is false.
• The power is increased by increasing the sample size.
• There is an analogy to a court of law.
– We assume the defendant is not guilty, so H0 : not guilty.
– The alternative is that they are guilty, Ha: guilty.
– Evidence is presented and weighed (test statistic).
– If the evidence is overwhelming (P is very small), the
presumption of innocence is overturned (statistical significance
is declared).j
– A type I error is to find defendant guilty when they are not (it
is considered very bad form to hang an innocent person, we
want the evidence to be overwhelming.)
– A type II error is to let a guilty man go free. (This is not
considered to be too bad.)
• Remember that statistical significance doesn’t imply practical
significance. A small difference will always give a small p-value if
the sample is suitably large. For example, suppose that X̄ = 20.1,
H0 : µ = 20, Ha : µ > 20 and σ = 1.
n
9
100
900
t
.3
1
3
p-value
.38
.16
.001
– It is generally advised to also report a confidence interval when
carrying out a hypothesis test.
– The confidence interval shows us how precisely we are
estimating the mean, and gets narrower as the sample size gets
bigger.
• Don’t ignore lack of significance.
– The negative result may be unexpected.
– Was the sample size large enough? i.e. was the study
underpowered?
• Beware of searching for significance.
– Many tests on same data.
– One test on the most extreme difference.
– “Almost any large data set will contain some unusual pattern.”
– The hypotheses must be stated first.
• There is a relationship between two-sided fixed α tests and 1 − α
confidence intervals
– A level (1 − α)100% confidence interval contains all µ0 for
which H0 : µ = µ0 is not statistically significant at level α,
when a two-sided alternative is used.
ie. REJECT the two sided hypothesis at level α if and only if
the 100(1 − α)% confidence interval for µ DOES NOT contain
µ0 .