The SURVEYREG Procedure |
This example uses the stratified sample from the section Getting Started: SURVEYREG Procedure to illustrate how to estimate the variances with replication methods.
As shown in the section Stratified Sampling, the sample is saved in the SAS data set IceCream. The variable Grade that indicates a student’s grade is the stratification variable. The variable Spending contains the dollar amount of each student’s average weekly spending for ice cream. The variable Income specifies the household income, in thousands of dollars. The variable Kids indicates how many children are in a student’s family. The variable Weight contains sampling weights.
In this example, we use the jackknife method to estimate the variance, saving the replicate weights generated by the procedure into a SAS data set:
title1 'Ice Cream Spending Analysis'; title2 'Use the Jackknife Method to Estimate the Variance'; proc surveyreg data=IceCream varmethod=JACKKNIFE(outweights=JKWeights); strata Grade; class Kids; model Spending = Income Kids / solution; weight Weight; run;
The VARMETHOD=JACKKNIFE option requests the procedure to estimate the variance by using the jackknife method. The OUTWEIGHTS=JKWeights option provides a SAS data set named JKWeights that contains the replicate weights used in the computation.
Output 88.9.1 shows the summary of the data and the variance estimation method. There are a total of 40 replicates generated by the procedure.
Output 88.9.2 displays the parameter estimates and their standard errors, as well as the tests of model effects that use the jackknife method.
Tests of Model Effects | |||
---|---|---|---|
Effect | Num DF | F Value | Pr > F |
Model | 4 | 110.48 | <.0001 |
Intercept | 1 | 133.30 | <.0001 |
Income | 1 | 289.16 | <.0001 |
Kids | 3 | 0.90 | 0.4525 |
Note: | The denominator degrees of freedom for the F tests is 37. |
Estimated Regression Coefficients | ||||
---|---|---|---|---|
Parameter | Estimate | Standard Error | t Value | Pr > |t| |
Intercept | -26.086882 | 2.58771182 | -10.08 | <.0001 |
Income | 0.776699 | 0.04567521 | 17.00 | <.0001 |
Kids 1 | 0.888631 | 1.12799263 | 0.79 | 0.4358 |
Kids 2 | 1.545726 | 1.25598146 | 1.23 | 0.2262 |
Kids 3 | -0.526817 | 1.42555453 | -0.37 | 0.7138 |
Kids 4 | 0.000000 | 0.00000000 | . | . |
Note: | The denominator degrees of freedom for the t tests is 37. Matrix X'WX is singular and a generalized inverse was used to solve the normal equations. Estimates are not unique. |
Output 88.9.3 prints the first 6 observation in the output data set JKWeights, which contains the replicate weights.
The data set JKWeights contains all the variable in the data set IceCream, in addition to the replicate weights variables named RepWt_1, RepWt_2, ..., RepWt_40.
For example, the first observation (student) from stratum Grade=7 is deleted to create the first replicate. Therefore, stratum Grade=7 is the donor stratum for the first replicate, and the corresponding replicate weights are saved in the variable RepWt_1.
Because the first observation is deleted in the first replicate, RepWt_1=0 for the first observation. For observations from strata other than the donor stratum Grade=7, their replicate weights remain the same as in the variable Weight, while the rest of the observations in stratum Grade=7 are multiplied by the reciprocal of the corresponding jackknife coefficient, for the first replicate.
The Jackknife Weights for the First 6 Obs |
Obs | Grade | Spending | Income | Kids | Prob | Weight | RepWt_1 | RepWt_2 | RepWt_3 | RepWt_4 | RepWt_5 | RepWt_6 | RepWt_7 | RepWt_8 | RepWt_9 | RepWt_10 | RepWt_11 | RepWt_12 | RepWt_13 | RepWt_14 | RepWt_15 | RepWt_16 | RepWt_17 | RepWt_18 | RepWt_19 | RepWt_20 | RepWt_21 | RepWt_22 | RepWt_23 | RepWt_24 | RepWt_25 | RepWt_26 | RepWt_27 | RepWt_28 | RepWt_29 | RepWt_30 | RepWt_31 | RepWt_32 | RepWt_33 | RepWt_34 | RepWt_35 | RepWt_36 | RepWt_37 | RepWt_38 | RepWt_39 | RepWt_40 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | 7 | 7 | 39 | 2 | 0.010965 | 91.200 | 0.000 | 96.000 | 91.200 | 91.200 | 96.000 | 96.000 | 96.000 | 91.200 | 91.200 | 96.000 | 96.000 | 91.200 | 91.200 | 96.000 | 96.000 | 96.000 | 91.200 | 91.200 | 91.200 | 91.200 | 91.200 | 91.200 | 96.000 | 96.000 | 96.000 | 91.200 | 91.200 | 91.200 | 96.000 | 96.000 | 96.000 | 96.000 | 91.200 | 91.200 | 91.200 | 96.000 | 91.200 | 91.200 | 96.000 | 96.000 |
2 | 7 | 7 | 38 | 1 | 0.010965 | 91.200 | 96.000 | 0.000 | 91.200 | 91.200 | 96.000 | 96.000 | 96.000 | 91.200 | 91.200 | 96.000 | 96.000 | 91.200 | 91.200 | 96.000 | 96.000 | 96.000 | 91.200 | 91.200 | 91.200 | 91.200 | 91.200 | 91.200 | 96.000 | 96.000 | 96.000 | 91.200 | 91.200 | 91.200 | 96.000 | 96.000 | 96.000 | 96.000 | 91.200 | 91.200 | 91.200 | 96.000 | 91.200 | 91.200 | 96.000 | 96.000 |
3 | 8 | 12 | 47 | 1 | 0.008780 | 113.889 | 113.889 | 113.889 | 0.000 | 113.889 | 113.889 | 113.889 | 113.889 | 128.125 | 128.125 | 113.889 | 113.889 | 113.889 | 128.125 | 113.889 | 113.889 | 113.889 | 113.889 | 128.125 | 128.125 | 113.889 | 113.889 | 113.889 | 113.889 | 113.889 | 113.889 | 113.889 | 128.125 | 113.889 | 113.889 | 113.889 | 113.889 | 113.889 | 113.889 | 128.125 | 128.125 | 113.889 | 113.889 | 113.889 | 113.889 | 113.889 |
4 | 9 | 10 | 47 | 4 | 0.009557 | 104.636 | 104.636 | 104.636 | 104.636 | 0.000 | 104.636 | 104.636 | 104.636 | 104.636 | 104.636 | 104.636 | 104.636 | 115.100 | 104.636 | 104.636 | 104.636 | 104.636 | 115.100 | 104.636 | 104.636 | 115.100 | 115.100 | 115.100 | 104.636 | 104.636 | 104.636 | 115.100 | 104.636 | 115.100 | 104.636 | 104.636 | 104.636 | 104.636 | 115.100 | 104.636 | 104.636 | 104.636 | 115.100 | 115.100 | 104.636 | 104.636 |
5 | 7 | 1 | 34 | 4 | 0.010965 | 91.200 | 96.000 | 96.000 | 91.200 | 91.200 | 0.000 | 96.000 | 96.000 | 91.200 | 91.200 | 96.000 | 96.000 | 91.200 | 91.200 | 96.000 | 96.000 | 96.000 | 91.200 | 91.200 | 91.200 | 91.200 | 91.200 | 91.200 | 96.000 | 96.000 | 96.000 | 91.200 | 91.200 | 91.200 | 96.000 | 96.000 | 96.000 | 96.000 | 91.200 | 91.200 | 91.200 | 96.000 | 91.200 | 91.200 | 96.000 | 96.000 |
6 | 7 | 10 | 43 | 2 | 0.010965 | 91.200 | 96.000 | 96.000 | 91.200 | 91.200 | 96.000 | 0.000 | 96.000 | 91.200 | 91.200 | 96.000 | 96.000 | 91.200 | 91.200 | 96.000 | 96.000 | 96.000 | 91.200 | 91.200 | 91.200 | 91.200 | 91.200 | 91.200 | 96.000 | 96.000 | 96.000 | 91.200 | 91.200 | 91.200 | 96.000 | 96.000 | 96.000 | 96.000 | 91.200 | 91.200 | 91.200 | 96.000 | 91.200 | 91.200 | 96.000 | 96.000 |
Copyright © SAS Institute, Inc. All Rights Reserved.