1. Trang chủ
  2. » Tài Chính - Ngân Hàng

SAS/ETS 9.22 User''''s Guide 170 pptx

10 151 0

Đang tải... (xem toàn văn)

THÔNG TIN TÀI LIỆU

1682 ✦ Chapter 24: The SIMLIN Procedure The actual and predicted values for the variable C are plotted in Output 24.1.11. title2 'Plots of Simulation Results'; proc sgplot data=c; scatter x=year y=c; series x=year y=chat / markers markerattrs=(symbol=plus); refline 1941.5 / axis=x; run; Output 24.1.11 Plot of Actual and Predicted Consumption Example 24.2: Multipliers for a Third-Order System This example shows how to fit and simulate a single equation dynamic model with third-order lags. It then shows how to convert the third-order equation into a three equation system with only first-order lags, so that the SIMLIN procedure can compute multipliers. (See the section "Multipliers for Higher Order Lags" earlier in this chapter for more information.) The input data set TEST is created from simulated data. A partial listing of the data set TEST produced by PROC PRINT is shown in Output 24.2.1. Example 24.2: Multipliers for a Third-Order System ✦ 1683 Output 24.2.1 Partial Listing of Input Data Set Simulate Equation with Third-Order Lags Listing of Simulated Input Data Obs y ylag1 ylag2 ylag3 x n 1 8.2369 8.5191 6.9491 7.8800 -1.2593 1 2 8.6285 8.2369 8.5191 6.9491 -1.6805 2 3 10.2223 8.6285 8.2369 8.5191 -1.9844 3 4 10.1372 10.2223 8.6285 8.2369 -1.7855 4 5 10.0360 10.1372 10.2223 8.6285 -1.8092 5 6 10.3560 10.0360 10.1372 10.2223 -1.3921 6 7 11.4835 10.3560 10.0360 10.1372 -2.0987 7 8 10.8508 11.4835 10.3560 10.0360 -1.8788 8 9 11.2684 10.8508 11.4835 10.3560 -1.7154 9 10 12.6310 11.2684 10.8508 11.4835 -1.8418 10 The REG procedure processes the input data and writes the parameter estimates to the OUTEST= data set A. title2 'Estimated Parameters'; proc reg data=test outest=a; model y=ylag3 x; run; title2 'Listing of OUTEST= Data Set'; proc print data=a; run; Output 24.2.2 shows the printed output produced by the REG procedure, and Output 24.2.3 displays the OUTEST= data set A produced. Output 24.2.2 Estimates and Fit Information from PROC REG Simulate Equation with Third-Order Lags Estimated Parameters The REG Procedure Model: MODEL1 Dependent Variable: y Analysis of Variance Sum of Mean Source DF Squares Square F Value Pr > F Model 2 173.98377 86.99189 1691.98 <.0001 Error 27 1.38818 0.05141 Corrected Total 29 175.37196 Root MSE 0.22675 R-Square 0.9921 Dependent Mean 13.05234 Adj R-Sq 0.9915 Coeff Var 1.73721 1684 ✦ Chapter 24: The SIMLIN Procedure Output 24.2.2 continued Parameter Estimates Parameter Standard Variable DF Estimate Error t Value Pr > |t| Intercept 1 0.14239 0.23657 0.60 0.5523 ylag3 1 0.77121 0.01723 44.77 <.0001 x 1 -1.77668 0.10843 -16.39 <.0001 Output 24.2.3 The OUTEST= Data Set Created by PROC REG Simulate Equation with Third-Order Lags Listing of OUTEST= Data Set Obs _MODEL_ _TYPE_ _DEPVAR_ _RMSE_ Intercept ylag3 x y 1 MODEL1 PARMS y 0.22675 0.14239 0.77121 -1.77668 -1 The SIMLIN procedure processes the TEST data set using the estimates from PROC REG. The following statements perform the simulation and write the results to the OUT= data set OUT2. title2 'Simulation of Equation'; proc simlin est=a data=test nored; endogenous y; exogenous x; lagged ylag3 y 3; id n; output out=out1 predicted=yhat residual=yresid; run; The printed output from the SIMLIN procedure is shown in Output 24.2.4. Output 24.2.4 Output Produced by PROC SIMLIN Simulate Equation with Third-Order Lags Simulation of Equation The SIMLIN Procedure Fit Statistics Mean Mean Pct Mean Abs Mean Abs RMS RMS Pct Variable N Error Error Error Pct Error Error Error y 30 -0.0233 -0.2268 0.2662 2.05684 0.3408 2.6159 The following statements plot the actual and predicted values, as shown in Output 24.2.5. title2 'Plots of Simulation Results'; Example 24.2: Multipliers for a Third-Order System ✦ 1685 proc sgplot data=out1; scatter x=n y=y; series x=n y=yhat / markers markerattrs=(symbol=plus); run; Output 24.2.5 Plot of Predicted and Actual Values Next, the input data set TEST is modified by creating two new variables, YLAG1X and YLAG2X, that are equal to YLAG1 and YLAG2. These variables are used in the SYSLIN procedure. (The estimates produced by PROC SYSLIN are the same as before and are not shown.) A listing of the OUTEST= data set B created by PROC SYSLIN is shown in Output 24.2.6. 1686 ✦ Chapter 24: The SIMLIN Procedure data test2; set test; ylag1x=ylag1; ylag2x=ylag2; run; title2 'Estimation of parameters and definition of identities'; proc syslin data=test2 outest=b; endogenous y ylag1x ylag2x; model y=ylag3 x; identity ylag1x=ylag1; identity ylag2x=ylag2; run; title2 'Listing of OUTEST= data set from PROC SYSLIN'; proc print data=b; run; Output 24.2.6 Listing of OUTEST= Data Set Created from PROC SYSLIN Simulate Equation with Third-Order Lags Listing of OUTEST= data set from PROC SYSLIN I _ _ n S _ D _ t _ T M E S e y y T A O P I r y y y l l Y T D V G c l l l a a O P U E A M e a a a g g b E S L R A p g g g 1 2 s _ _ _ _ _ t 3 x 1 2 y x x 1 OLS 0 Converged y y 0.22675 0.14239 0.77121 -1.77668 . . -1 . . 2 IDENTITY 0 Converged ylag1x . 0.00000 . . 1 . . -1 . 3 IDENTITY 0 Converged ylag2x . 0.00000 . . . 1 . . -1 The SIMLIN procedure is used to compute the reduced form and multipliers. The OUTEST= data set B from PROC SYSLIN is used as the EST= data set for the SIMLIN procedure. The following statements perform the multiplier analysis. title2 'Simulation of transformed first-order equation system'; proc simlin est=b data=test2 total interim=2; endogenous y ylag1x ylag2x; exogenous x; lagged ylag1 y 1 ylag2 ylag1x 1 ylag3 ylag2x 1; id n; output out=out2 predicted=yhat residual=yresid; run; Output 24.2.7 shows the interim 2 and total multipliers printed by the SIMLIN procedure. References ✦ 1687 Output 24.2.7 Interim 2 and Total Multipliers Simulate Equation with Third-Order Lags Simulation of transformed first-order equation system The SIMLIN Procedure Interim Multipliers for Interim 2 Variable x Intercept y 0.000000 0.0000000 ylag1x 0.000000 0.0000000 ylag2x -1.776682 0.1423865 Total Multipliers Variable x Intercept y -7.765556 0.6223455 ylag1x -7.765556 0.6223455 ylag2x -7.765556 0.6223455 References Maddala, G.S (1977), Econometrics, New York: McGraw-Hill Book Co. Pindyck, R.S. and Rubinfeld, D.L. (1991), Econometric Models and Economic Forecasts, Third Edition, New York: McGraw-Hill Book Co. Theil, H. (1971), Principles of Econometrics, New York: John Wiley & Sons, Inc. 1688 Chapter 25 The SPECTRA Procedure Contents Overview: SPECTRA Procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . 1689 Getting Started: SPECTRA Procedure . . . . . . . . . . . . . . . . . . . . . . . . . 1691 Syntax: SPECTRA Procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1692 Functional Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1692 PROC SPECTRA Statement . . . . . . . . . . . . . . . . . . . . . . . . . . 1693 BY Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1694 VAR Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1695 WEIGHTS Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1695 Details: SPECTRA Procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1696 Input Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1696 Missing Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1696 Computational Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1696 Kernels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1697 White Noise Test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1699 Transforming Frequencies . . . . . . . . . . . . . . . . . . . . . . . . . . . 1700 OUT= Data Set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1700 Printed Output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1702 ODS Table Names: SPECTRA procedure . . . . . . . . . . . . . . . . . . . 1702 Examples: SPECTRA Procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . 1703 Example 25.1: Spectral Analysis of Sunspot Activity . . . . . . . . . . . . 1703 Example 25.2: Cross-Spectral Analysis . . . . . . . . . . . . . . . . . . . . 1710 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1713 Overview: SPECTRA Procedure The SPECTRA procedure performs spectral and cross-spectral analysis of time series. You can use spectral analysis techniques to look for periodicities or cyclical patterns in data. The SPECTRA procedure produces estimates of the spectral and cross-spectral densities of a multivariate time series. Estimates of the spectral and cross-spectral densities of a multivariate time series are produced using a finite Fourier transform to obtain periodograms and cross-periodograms. 1690 ✦ Chapter 25: The SPECTRA Procedure The periodogram ordinates are smoothed by a moving average to produce estimated spectral and cross-spectral densities. PROC SPECTRA can also test whether or not the data are white noise. PROC SPECTRA uses the finite Fourier transform to decompose data series into a sum of sine and cosine waves of different amplitudes and wavelengths. The Fourier transform decomposition of the series x t is x t D a 0 2 C m X kD1 Œa k cos.! k t/ C b k si n.! k t/ where t is the time subscript, t D 1; 2; : : : ; n x t are the equally spaced time series data n is the number of observations in the time series m is the number of frequencies in the Fourier decomposition: m D n 2 if n is even; m D n1 2 if n is odd a 0 is the mean term: a 0 D 2x a k are the cosine coefficients b k are the sine coefficients ! k are the Fourier frequencies: ! k D 2k n Functions of the Fourier coefficients a k and b k can be plotted against frequency or against wave length to form periodograms. The amplitude periodogram J k is defined as follows: J k D n 2 .a 2 k C b 2 k / Several definitions of the term periodogram are used in the spectral analysis literature. The following discussion refers to the J k sequence as the periodogram. The periodogram can be interpreted as the contribution of the kth harmonic ! k to the total sum of squares (in an analysis of variance sense) in the decomposition of the process into two-degree-of- freedom components for each of the m frequencies. When n is even, si n.! n 2 / is zero, and thus the last periodogram value is a one-degree-of-freedom component. The periodogram is a volatile and inconsistent estimator of the spectrum. The spectral density estimate is produced by smoothing the periodogram. Smoothing reduces the variance of the estimator but introduces a bias. The weight function used for the smoothing process, W(), often called the kernel or spectral window, is specified with the WEIGHTS statement. It is related to another weight function, w(), the lag window, that is used in other methods to taper the correlogram rather than to smooth the periodogram. Many specific weighting functions have been suggested in the literature (Fuller 1976, Jenkins and Watts 1968, Priestly 1981). Table 25.3 later in this chapter gives the relevant formulas when the WEIGHTS statement is used. Letting i represent the imaginary unit p 1, the cross-periodogram is defined as follows: J xy k D n 2 .a x k a y k C b x k b y k / C i n 2 .a x k b y k  b x k a y k / Getting Started: SPECTRA Procedure ✦ 1691 The cross-spectral density estimate is produced by smoothing the cross-periodogram in the same way as the periodograms are smoothed using the spectral window specified by the WEIGHTS statement. The SPECTRA procedure creates an output SAS data set whose variables contain values of the periodograms, cross-periodograms, estimates of spectral densities, and estimates of cross-spectral densities. The form of the output data set is described in the section “OUT= Data Set” on page 1700. Getting Started: SPECTRA Procedure To use the SPECTRA procedure, specify the input and output data sets and options for the analysis you want in the PROC SPECTRA statement, and list the variables to analyze in the VAR statement. The procedure produces no printed output unless the WHITETEST option is specified in the PROC SPECTRA statement. The periodogram, spectral density, and other results are written to the OUT= data set, depending on the options used. For example, to compute the Fourier transform of a variable X in a data set A, use the following statements: proc spectra data=a out=b coef; var x; run; This PROC SPECTRA step writes the Fourier coefficients a k and b k to the variables COS_01 and SIN_01 in the output data set B. When a WEIGHTS statement is specified, the periodogram is smoothed by a weighted moving average to produce an estimate of the spectral density of the series. The following statements write a spectral density estimate for X to the variable S_01 in the output data set B. proc spectra data=a out=b s; var x; weights 1 2 3 4 3 2 1; run; When the VAR statement specifies more than one variable, you can perform cross-spectral analysis by specifying the CROSS option in the PROC SPECTRA statemnet. The CROSS option by itself produces the cross-periodograms for all two-way combinations of the variables listed in the VAR statement. For example, the following statements write the real and imaginary parts of the cross- periodogram of X and Y to the variables RP_01_02 and IP_01_02 in the output data set B. proc spectra data=a out=b cross; var x y; run; . n 1 8.23 69 8.5 191 6 .94 91 7.8800 -1.2 593 1 2 8.6285 8.23 69 8.5 191 6 .94 91 -1.6805 2 3 10 .222 3 8.6285 8.23 69 8.5 191 -1 .98 44 3 4 10.1372 10 .222 3 8.6285 8.23 69 -1.7855 4 5 10.0360 10.1372 10 .222 3 8.6285. > F Model 2 173 .98 377 86 .99 1 89 1 691 .98 <.0001 Error 27 1.38818 0.05141 Corrected Total 29 175.37 196 Root MSE 0 .226 75 R-Square 0 .99 21 Dependent Mean 13.05234 Adj R-Sq 0 .99 15 Coeff Var 1.73721 1684. 8.6285 -1.8 092 5 6 10.3560 10.0360 10.1372 10 .222 3 -1. 392 1 6 7 11.4835 10.3560 10.0360 10.1372 -2. 098 7 7 8 10.8508 11.4835 10.3560 10.0360 -1.8788 8 9 11.2684 10.8508 11.4835 10.3560 -1.7154 9 10 12.6310

Ngày đăng: 02/07/2014, 15:20

Xem thêm:

TỪ KHÓA LIÊN QUAN

TÀI LIỆU CÙNG NGƯỜI DÙNG

  • Đang cập nhật ...

TÀI LIỆU LIÊN QUAN