|The TRANSREG Procedure|
The OUT= output data set can contain a great deal of information; however, in most cases, the output data set contains a small portion of the entire range of available information and is organized for direct input into the %PLOTIT macro or graphical or analysis procedures. For information on the %PLOTIT macro, see Appendix B, "Using the %PLOTIT Macro."
The first example shows the output data set from a two-way ANOVA model. The following statements produce Figure 65.12:
title 'ANOVA Output Data Set Example'; data ReferenceCell; input Y X1 $ X2 $; datalines; 11 a a 12 a a 10 a a 4 a b 5 a b 3 a b 5 b a 6 b a 4 b a 2 b b 3 b b 1 b b ; *---Fit Reference Cell Two-Way ANOVA Model---; proc transreg data=ReferenceCell; model identity(Y) = class(X1 | X2); output coefficients replace predicted residuals; run; *---Print the Results---; proc print; run; proc contents position; ods select position; run;
The _TYPE_ variable indicates observation type: score, multiple regression coefficient (parameter estimates), and marginal means. The _NAME_ variable contains the default observation labels, "ROW1", "ROW2", and so on, and contains the dependent variable name (Y) for the remaining observations. If you specify an ID statement, _NAME_ contains the values of the first ID variable for score observations. The Y variable is the dependent variable, PY contains the predicted values, RY contains the residuals, and the variables Intercept through X1aX2a contain the design matrix. The X1 and X2 variables are the original CLASS variables.
The next example shows the contents of the output data set from fitting a curve through a scatter plot.
title 'Output Data Set for Curve Fitting Example'; data A; do X = 1 to 100; Y = log(x) + sin(x / 10) + normal(7); output; end; run; proc transreg; model identity(Y) = spline(X / nknots=9); output predicted out=B; run; proc contents position; ods select position; run;
These statements produce Figure 65.13.
The OUT= data set contains _TYPE_ and _NAME_ variables. Since no coefficients or coordinates are requested, all observations are _TYPE_='SCORE'. The Y variable is the original dependent variable, TY is the transformed dependent variable, PY contains the predicted values, X is the original independent variable, and TX is the transformed independent variable. The data set also contains an Intercept and transformed intercept TIntercept variable. (In this case, the transformed intercept is the same as the intercept. However, if you specify the TSTANDARD= and ADDITIVE options, these are not always the same.)
The next example shows the results from specifying METHOD=MORALS when there is more than one dependent variable.
title 'METHOD=MORALS Output Data Set Example'; data x; input Y1 Y2 X1 $ X2 $; datalines; 11 1 a a 10 4 b a 5 2 a b 5 9 b b 4 3 c c 3 6 b a 1 8 a b ; *---Fit Reference Cell Two-Way ANOVA Model---; proc transreg data=x noprint dummy; model spline(Y1 Y2) = opscore(X1 X2 / name=(N1 N2)); output coefficients predicted residuals; id x1 x2; run; *---Print the Results---; proc print; run; proc contents position; ods select position; run;
These statements produce Figure 65.14.
If you specify METHOD=MORALS with multiple dependent variables, PROC TRANSREG performs separate univariate analyses and stacks the results in the OUT= data set. For this example, the results of the first analysis are in the partition designated by _DEPVAR_='Spline(Y1)' and the results of the first analysis are in the partition designated by _DEPVAR_='Spline(Y2)', which are the transformation and dependent variable names. Each partition has _TYPE_='SCORE' observations for the variables and a _TYPE_='M COEFFI' observation for the coefficients. In this example, an ID variable is specified, so the _NAME_ variable contains the formatted values of the first ID variable. Since both dependent variables have to go into the same column, the dependent variable is given a new name, _DEPEND_. The dependent variable transformation is named T_DEPEND_, the predicted values variable is named P_DEPEND_, and the residuals variable is named R_DEPEND_.
The independent variables are character OPSCORE variables. By default, PROC TRANSREG replaces character OPSCORE variables with category numbers and discards the original character variables. To avoid this, the input variables are renamed from X1 and X2 to N1 and N2 and the original X1 and X2 are added to the data set as ID variables. The N1 and N2 variables contain the initial values for the OPSCORE transformations, and the TN1 and TN2 variables contain optimal scores. The data set also contains an Intercept and transformed intercept TIntercept variable. The regression coefficients are in the transformation columns, which also contain the variables to which they apply.
Table 65.6: PROC TRANSREG OUT= Data Set Contents
|_TYPE_||Contents||Options, Default Prefix|
|SCORE||dependent variables||DREPLACE not specified|
|SCORE||independent variables||IREPLACE not specified|
|SCORE||transformed dependent variables||default, TDPREFIX=T|
|SCORE||transformed independent variables||default, TIPREFIX=T|
|SCORE||predicted values||PREDICTED, PPREFIX=P|
|SCORE||lower individual confidence limits||CLI, LILPREFIX=LIL,|
|SCORE||upper individual confidence limits||CLI, LIUPREFIX=LIU,|
|SCORE||lower mean confidence limits||CLM, LMLPREFIX=LML,|
|SCORE||upper mean confidence limits||CLM, LMUPREFIX=LMU,|
|SCORE||dependent canonical variables||CANONICAL, CDPREFIX=Cand|
|SCORE||independent canonical variables||CANONICAL, CIPREFIX=Cani|
|SCORE||redundancy variables||REDUNDANCY, RPREFIX=Red|
|SCORE||ID, CLASS, BSPLINE variables||ID, CLASS, BSPLINE,|
|SCORE||independent variables approximations||IAPPROXIMATIONS, IAPREFIX=A|
|M COEFFI||multiple regression coefficients||COEFFICIENTS, MRC|
|C COEFFI||canonical coefficients||COEFFICIENTS, CCC|
|MEAN||marginal means||COEFFICIENTS, MEANS|
|M REDUND||multiple redundancy coefficients||MREDUNDANCY|
|R REDUND||multiple redundancy coefficients||MREDUNDANCY|
|M POINT||point coordinates||COORDINATES or MPC, POINT|
|M EPOINT||elliptical point coordinates||COORDINATES or MEC, EPOINT|
|M QPOINT||quadratic point coordinates||COORDINATES or MQC, QPOINT|
|C POINT||canonical point coordinates||COORDINATES or CPC, POINT|
|C EPOINT||canonical elliptical point coordinates||COORDINATES or CEC, EPOINT|
|C QPOINT||canonical quadratic point coordinates||COORDINATES or CQC, QPOINT|
The independent and dependent variables are created from the original input data. Several potential differences exist between these variables and the actual input data. An intercept variable can be added, new variables can be added for POINT, EPOINT, QPOINT, CLASS, IDENTITY, PSPLINE, and BSPLINE variables, and category numbers are substituted for character OPSCORE variables. These matrices are not always what is input to the first iteration. After the expanded data set is stored for inclusion in the output data set, several things happen to the data before they are input to the first iteration: column means are substituted for missing values; zero degree SPLINE and MSPLINE variables are transformed so that the iterative algorithms get step function data as input, which conform to the zero degree transformation family restrictions; and the nonoptimal transformations are performed.
When you specify METHOD=UNIVARIATE (in the MODEL or PROC TRANSREG statement), PROC TRANSREG can perform several analyses, one for each dependent variable. While each dependent variable can be transformed, their independent variables are not transformed. The OUT= data set optionally contains all of the _TYPE_='SCORE' observations, optionally followed by coefficients or coordinates.
When you specify METHOD=MORALS (in the MODEL or PROC TRANSREG statement), successive analyses are performed, one for each dependent variable. Each analysis transforms one dependent variable and the entire set of the independent variables. All information for the first dependent variable (scores then, optionally, coefficients) appear first. Then all information for the second dependent variable (scores then, optionally, coefficients) appear next. This arrangement is repeated for all dependent variables.
For METHOD=CANALS and METHOD=REDUNDANCY (specified in either the MODEL or PROC TRANSREG statement), one analysis is performed that simultaneously transforms all dependent and independent variables. The OUT= data set optionally contains all of the _TYPE_='SCORE' observations, optionally followed by coefficients or coordinates.
The names of the POINT, QPOINT, and EPOINT expansion variables are also left unchanged, but new variables are created. When independent POINT variables are present, the sum-of-squares variable _ISSQ_ is added to the output data set. For each EPOINT and QPOINT variable, a new squared variable is created by appending "_2". For example, Dim1 and Dim2 are expanded into Dim1, Dim2, Dim1_2, and Dim2_2. In addition, for each pair of QPOINT variables, a new crossproduct variable is created by combining the two names, for example, Dim1Dim2.
The names of the CLASS variables are constructed from original variable names and levels. Lengths are controlled by the CPREFIX= a-option. For example, when X1 and X2 both have values of 'a' and 'b', CLASS(X1 | X2 / ZERO=NONE) creates X1 main effect variable names X1a X1b, X2 main effect variable names X2a X2b, and interaction variable names X1aX2a X1aX2b X1bX2a X1bX2b.
PROC TRANSREG then uses these variable names when creating the transformed, predicted, and residual variable names by affixing the relevant prefix and possibly dropping extra characters.
When you specify METHOD=MORALS and only one dependent variable is present, the output data set is structured exactly as if METHOD=REDUNDANCY (see the section "Details for the CANALS and REDUNDANCY Methods"). When more than one dependent variable is present, the dependent variables are output in the variable _DEPEND_, transformed dependent variables are output in the variable T_DEPEND_, predicted values are output in the variable P_DEPEND_, and residuals are output in the variable R_DEPEND_. You can partition the data set into BY groups, one per dependent variable, by referring to the character variable _DEPVAR_, which contains the original dependent variable names and transformations.
When the same name is generated from multiple variables in the OUT= data set, new names are created by appending "2", "3", or "4", and so on, until a unique name is created. For 32-character names, the last character is replaced with a numeric suffix until a unique name is created. For example, if there are two output variables that otherwise would be named X, then X and X2 are created instead. If there are two output variables that otherwise would be named ThisIsAThirtyTwoCharacterVarName, then ThisIsAThirtyTwoCharacterVarName and ThisIsAThirtyTwoCharacterVarNam2 are created instead.
Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.