Assignmnet: Simple Random Sampling With Replacement

advertisement

Assignmnet: Simple Random

Sampling With Replacement

Some Solutions

Question 2: SRSWR

• a. What is the formula to estimate the sample variance s

2  n

1

1 i n 

1

 y i

 y

2

Question 2. (SRSWR)

2c. (a54p10.sas). Do any samples occur where the same patient was selected on each of the selections?

Which ones?

What is the chance (probability) that this will happen?

Is the number of times that the same subject was selected each time equal to what you would expect?

Why or why not.

2c. (a54p10.sas).

Do any samples occur where the same patient was selected on each of the selections?

(Note: sid1, sid2, etc are the subject IDs)

PROC PRINT DATA=d NOOBS SPLIT="*";

VAR sample sid1-sid3 ;

TITLE2 "Table 2. List of &nsamp Simple Random Samples ";

RUN ;

2c. (a54p10.sas).

Table 2. List of 40 Simple Random Samples

1st 2nd 3rd

ID ID ID sample Sel. Sel. Sel.

etc

1 5 6 6

2 3 3 6

3 2 2 3

4 6 3 1

5 3 3 3 Subject 3 selected each time

6 1 1 4

7 6 5 5

8 4 6 4

9 4 3 6

10 1 6 5

11 5 4 4

12 1 6 5

13 4 2 3

14 4 6 6

2c. (a54p10.sas).

Do any samples occur where the same patient was selected on each of the selections? (Add these statements to tabulate distinct samples)

– DATA d1;

– SET d;

– snum= 100 *sid1+ 10 *sid2+sid3;

– RUN ;

– PROC PRINT DATA=d1 NOOBS SPLIT="*";

– VAR sample snum sid1-sid3 ;

– TITLE2 "Table 2a. List of &nsamp Simple Random Samples ";

– RUN ;

– PROC FREQ DATA=d1;

– TABLES snum;

– TITLE2 "Table 2b. Subjects in &nsamp Samples with replacement";

– RUN ;

2c. (a54p10.sas).

Table 2b. Subjects in 40 Samples with replacement

The FREQ Procedure

Cumulative Cumulative snum Frequency Percent Frequency Percent

ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒ

114 1 2.50 1 2.50

121 1 2.50 2 5.00

143 1 2.50 3 7.50

165 3 7.50 6 15.00

166 1 2.50 7 17.50

213 1 2.50 8 20.00

215 1 2.50 9 22.50

223 2 5.00 11 27.50

231 1 2.50 12 30.00

232 1 2.50 13 32.50

233 1 2.50 14 35.00

236 1 2.50 15 37.50

312 1 2.50 16 40.00

324 1 2.50 17 42.50

333 3 7.50 20 50.00 The three selections are subject 3

336 1 2.50 21 52.50

Assignment: SRSWR

2c. (a54p10.sas). What is the chance

(probability) that the same patient was selected on each of the selections?

# of samples:

N

n 

6

3 

216

# of samples with same selection:

111, 222, 333, 444, 555, 666

6

Pr ( subject)=

216

0.0277

Assignment: SRSWR

2c. (a54p10.sas). Is the number of times that the same subject was selected each time equal to what you would expect?

# of samples expected:

  

1.11

No- we observed 3, and only expected 1.11 samples.

This may be because we only took 40 samples.

Question 3: SRSWR

• a. If we count samples as different if either the subjects included are different or if the order of selection of subjects is different, how many different possible sample could we select?

Note that N=6, n=3

Sample

N N N

______ _______ ______

Position 1 Position 2 Position 3

N n

6

3

216

This counts the samples as different for all subjects selected in all orders.

Question 3: SRSWR

3b. How many times would you expect that each sample would occur if 4320 samples were selected?

4320

1

216

 

 

20

Question 3: SRSWR

• g. Suppose that three different subjects are selected. In how many different orders can 3 different subjects be selected (this is the number of permutations).

ID=1, ID=2, ID=3

Sample n n-1 n-2

______ _______ ______

Position 1 Position 2 Position 3 n !

  

1

 n

    

3! 6

When Sampling Without Replacement:

3a. If we count samples as different if either the subjects included are different, or if the order of selection of subjects is different, how many different possible samples could we select?

• N=6, n=3

Sample

N N-1 N-2

______ _______ ______

Position 1 Position 2 Position 3

N !

N

 n

!

     

   

    

120

When Sampling Without Replacement:

3b. How many times would you expect that each sample would occur if 4320 samples were selected?

4320

120

216

 

 

  

2340

When Sampling Without Replacement:

3b. In how many different orders can the same three subjects be selected? (This is the number of permutations.)

     n !

Download