Lecture 4 Slides (Jan 31)
Download
Report
Transcript Lecture 4 Slides (Jan 31)
Today - Messages
• Additional shared lab hours in A-269
– M, W, F 2:30-4:25
– T, Th 4:00-5:15
First priority is for PH5452. No TA or instructor
• Handouts
– Unix commands
– How to run saturn from home
This Week
• Review of estimation and hypothesis testing
• Reading Le (review)
– Chapter 4: Sections 4.1 – 4.3
– Chapter 5: Sections 5:1 and 5:4
– Chapter 7: Sections 7:1 – 7.3
• Reading C &S
– Chapter 2:A-E
– Chapter 6: A,B,F
Steps in Creating and Running a SAS Program on Saturn
1.
Create or edit SAS program (fn is name of program)
> pico fn.sas
2.
(cntr x to exit)
Run the SAS program
> sas fn.sas
3.
List the files in directory - look for .log and .lst files
> ls (or ls fn*)
4.
View the .log file - look for errors and notes
> less fn.log
(type q to exit)
5.
If errors go back to step 1 and repeat 1-4
6.
When no errors view .lst to view output
> less fn.lst
Some Definitions
• Statistics: The art and science of collecting, analyzing, presenting,
and interpreting data.
• Data: facts and figures that are collected
• Dataset: All the data collected for a study
• Elements: Units in which data is collected
– People, companies, schools, households
• Variables: Characteristics measured on elements
–
–
–
–
People (height, weight)
Company (number of employees)
Schools (percentage of students who graduate in 5 years)
Households (number of computers owned)
Some Definitions
• Population: set of all elements of interest in a particular
study
–
–
–
–
–
–
All persons in Minnesota 18-years or older
All Fortune 500 companies
All persons with hypertension
All persons who have colon cancer
All persons who could ever have colon cancer
All lab samples that could ever be analyzed
• Sample: a subset of the population
A major contribution of statistics is that data from a sample can be
used to make estimates and test hypothesis about the characteristics of
a population. This process is referred to as statistical inference.
Informal Definition
• Statistics:
In a scientific way gaining information about
something you do not know
Start With Research Question
• What is the proportion of persons without health insurance
in Minnesota?
• Do newer BP medications prevent heart disease compared
to older medications?
• What is the relationship between grade point average and
SAT scores
• Do persons who eat more F&V have lower risk of
developing colon cancer.
• Does the program DARE reduce the risk of young persons
trying drugs?
What is the populations for each of these?
Statistics
Start With
Question
Make Conclusions
(Inference)
Design Study
And
Collect Data
Perform Analyses of
Data to Assess
Question.
Statistical Inference
• Estimation (Chapter 4)
• Hypothesis Testing (Chapter 5)
– Comparing population proportions (Chap 6)
– Comparing population means (Chap 7)
Parameter: Numeric Characteristic of a Population
Parameter Parameter Description
m
Mean of population
p
Proportion with a certain trait
r
Correlation between 2 variables
m1 - m2
Difference between 2 means
p1 - p2
Difference between 2 proportions
s
Population standard deviation
Sampling
• Sample: a subset of target population
(usually a simple random sample - each sample
has equal probability of occurring)
• Different samples yield different estimates
• Trying to estimate the population parameter (the
“true value”)
– It’s usually not possible to measure the population
value
Point Estimate
Parameter
Point Estimate
m
Sample mean
p
Sample proportion
r
Sample correlation
m1 - m2
Difference between 2 sample means
p1 - p2
Difference between 2 sample
proportions
Sample standard deviation
s
Sampling error: True value – estimate (unknown)
Statistical Inference
Population
with mean
m=?
The value of x is used to
make inferences about
the value of m.
A simple random sample
of n elements is selected
from the population.
The sample data
provide a value for
the sample mean x.
Interval Estimation
In general, confidence intervals are of the form:
estimate 1.96SE
Estimate = mean, proportion, regression
coefficient, odds ratio...
SE = standard error of your estimate
1.96 = for 95% CI based on normal distribution
Estimation
“What is the average total cholesterol level for MN
residents?”
Random sample of cholesterol levels
sample mean = sum of values / number of observations
X
n
X
Estimates the
population mean:
X m
Estimation
“What is the average total cholesterol level for MN
residents?”
sample standard deviation:
estimates the
population
standard deviation:
s
2
(
X
X
)
s s
n -1
Confidence Interval Example
Suppose sample of 100
mean = 215 mg/dL, standard deviation = 20
95% CI =
X 1.96s / n
s/ n
= standard error of mean
= (215 - 1.96*20/10, 215 + 1.96*20/10)
approximately = (211, 219)
Properties of Confidence Intervals
• As sample size increases, CI gets smaller
– If you could sample the whole population;
X m
• Can use different levels of confidence
– 90, 95, 99% common
– More confidence means larger interval; so a 90% CI is
smaller than a 99% CI
• Changes with population standard deviation
– More variable population means larger interval
Caution with Confidence Intervals
– Data should be from random sample
– More complicated sampling requires different
methods
• Example - multistage or stratified sampling
– Outliers can cause problems
– Non-normal data can change confidence level
• Skewed data a big problem
– Bias not accounted for
• Non-responders
• Target and sampled population different
95% Confidence Intervals with SAS
1) Construct from output
estimate +/- 1.96*SE
2) Provided automatically by some procedures
PROC MEANS DATA = STUDENTS LCLM UCLM;
VAR AGE;
Our Sample of 25 Replicates of n=10, p 0.5
True Sampling Distribution, n=10, p 0.5