REGWGT Subcommand (REGRESSION command)
The only specification on REGWGT is the name of the variable containing the weights
to be used in estimating a weighted least-squares model. With REGWGT, the default display is the usual REGRESSION display.
-
REGWGTis a global subcommand. - If more than one
REGWGTsubcommand is specified on aREGRESSIONprocedure, only the last one is in effect. -
REGWGTcan be used withMATRIX OUTbut not withMATRIX IN. - Residuals saved from equations using the
REGWGTcommand are not weighted. To obtain weighted residuals, multiply the residuals created withSAVEby the square root of the weighting variable in aCOMPUTEstatement. -
REGWGTis in effect for all equations and affects the way the correlation matrix is built. Thus, ifREGWGTis specified on aREGRESSIONprocedure that writes matrix materials to a matrix data file, subsequentREGRESSIONprocedures using that file will be automatically weighted.
Example
REGRESSION VARIABLES=GRADE GPA STARTLEV TREATMNT
/DEPENDENT=GRADE
/METHOD=ENTER
/SAVE PRED(P).
COMPUTE WEIGHT=1/(P*(1-P)).
REGRESSION VAR=GRADE GPA STARTLEV TREATMNT
/REGWGT=WEIGHT
/DEP=GRADE
/METHOD=ENTER.
-
VARIABLESbuilds a correlation matrix that includes GRADE, GPA, STARTLEV, and TREATMNT. -
DEPENDENTidentifies GRADE as the dependent variable. -
METHODregresses GRADE on GPA, STARTLEV, and TREATMNT. -
SAVEsaves the predicted values from the regression equation as variable P in the active dataset. See the topic SAVE Subcommand (REGRESSION command) for more information. -
COMPUTEcreates the variable WEIGHT as a transformation of P. - The second
REGRESSIONprocedure performs a weighted regression analysis on the same set of variables using WEIGHT as the weighting variable.
Example
REGRESSION VAR=GRADE GPA STARTLEV TREATMNT
/REGWGT=WEIGHT
/DEP=GRADE
/METHOD=ENTER
/SAVE RESID(RGRADE).
COMPUTE WRGRADE=RGRADE * SQRT(WEIGHT).
- This example illustrates the use of
COMPUTEwithSAVEto weight residuals. -
REGRESSIONperforms a weighted regression analysis of GRADE on GPA, STARTLEV, and TREATMNT, using WEIGHT as the weighting variable. -
SAVEsaves the residuals as RGRADE. These residuals are not weighted. -
COMPUTEcreates variable WRGRADE, which contains the weighted residuals.