⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 lag.src

📁 没有说明
💻 SRC
字号:
/*
** lag.src -- Lagged value of given time series.
** (C) Copyright 1992-1998 by Aptech Systems, Inc.
** All Rights Reserved.
**
** This Software Product is PROPRIETARY SOURCE CODE OF APTECH
** SYSTEMS, INC.    This File Header must accompany all files using
** any portion, in whole or in part, of this Source Code.   In
** addition, the right to create such files is strictly limited by
** Section 2.A. of the GAUSS Applications License Agreement
** accompanying this Software Product.
**
** If you wish to distribute any portion of the proprietary Source
** Code, in whole or in part, you must first obtain written
** permission from Aptech Systems.
**
**  Format           Purpose                                    Line
**  ---------------------------------------------------------------------------
**  y = LAG1(x);     Lags a matrix by one time period.          24
**  y = LAGN(x,t);   Lags a matrix by t time periods.           53
*/

/*
**> lag1
**
**  Purpose:    Lags a matrix by one time period for time series analysis.
**
**  Format:     y = lag1(x);
**
**  Input:      x    NxK matrix.
**
**  Output:     y    NxK matrix, x lagged one period.
**
**  Remarks:    lag1 lags x by one period, so the first observations of
**              y are missing.
**
**  See Also:   lagn
*/

proc lag1(x);
    local y;
    y = shiftr(x', 1, (miss(0, 0))');
    retp(y');
endp;

proc lag(x);
    local y;
    y = shiftr(x', 1, (miss(0, 0))');
    retp(y');
endp;

/*
**> lagn
**
**  Purpose:    Lags a matrix a specified number of time periods for
**              time series analysis.
**
**  Format:     y = lagn(x,t);
**
**  Input:      x    NxK matrix.
**
**              t    scalar, number of time periods.
**
**  Output:     y    NxK matrix, x lagged t periods.
**
**  Remarks:    If t is positive, lagn lags x back by t time periods, so
**              the first t observations of y are missing.
**              If t is negative, lagn lags x forward by t time periods, so
**              the last t observations of y are missing.
**
**  See Also:   lag1
*/

proc lagn(x,n);
    local y;
    y = shiftr(x', n, (miss(0, 0))');
    retp(y');
endp;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -