|
The macro will fill in the observations. You can change the number of observations in a group by adding or subtracting rows and dragging the formulas in C, D, and E as needed. If you add groups, you will have to set the formula for the new groups in column C to get the mean of each new group.
Review the plan above. Make sure you understand what the sheet does.
Choose which column of data you want to work with. The macro below is set up to take data from the fifth column (Interest Income).
The macro will work only with data that does not have missing values. So it wont work with education or year of entry.
Here is the macro that will collect the values in column I (the ninth column).
Sub Sampling()
Randomize Timer
For r = 2 To 55 Set your number of samples by changing 55.
For SampleRow = 2 To 12 Set to your total sample size by changing 12.
dataRow = 2 + Fix(50000 * Rnd)
Worksheets("Data").Rows(dataRow).Copy
Worksheets("Sample").Rows(SampleRow).PasteSpecial
Next SampleRow
Worksheets("Sample").Columns(5).Copy Change 5 to copy your column.
Worksheets("Stats").Columns(2).PasteSpecial
Worksheets("Stats").Cells(r, 9).Value = Cells(2, 8).Value
Next r
End Sub
|
Get the mean and a histogram of the estimated variances. In the Data worksheet, you can get the population variance with =var() .
So far you have estimated the variance from the variation within each group. How did you do?
To get the variance calculated from the variation between groups, insert a column by right-clicking on D and selecting Insert. Then edit the worksheet to fit the following scheme. Note the changes you have to make to column E.
|