在哪里可以找到ARMAtoMA()的代码

在哪里可以找到ARMAtoMA()的代码,r,R,如何查找函数ARMAtoMA中发生的情况?我得到了以下结果 ARMAtoMA #function (ar = numeric(), ma = numeric(), lag.max) #.Call(C_ARMAtoMA, as.double(ar), as.double(ma), as.integer(lag.max)) #<bytecode: 0x000000001a5f5700> #<environment: namespace:stats> ARMAtoMA #函

如何查找函数
ARMAtoMA
中发生的情况?我得到了以下结果

ARMAtoMA
#function (ar = numeric(), ma = numeric(), lag.max) 
#.Call(C_ARMAtoMA, as.double(ar), as.double(ma), as.integer(lag.max))
#<bytecode: 0x000000001a5f5700>
#<environment: namespace:stats>
ARMAtoMA
#函数(ar=numeric(),ma=numeric(),lag.max)
#.Call(C_ARMAtoMA,as.double(ar),as.double(ma),as.integer(lag.max))
#
#

您可以在R的源文件中找到它:

R-<version>/src/library/stats/src/pacf.c
SEXP ARMAtoMA(SEXP ar, SEXP ma, SEXP lag_max)
  {
    int i, j, p = LENGTH(ar), q = LENGTH(ma), m = asInteger(lag_max);
    double *phi = REAL(ar), *theta = REAL(ma), *psi, tmp;
    SEXP res;

    if(m <= 0 || m == NA_INTEGER)
    error(_("invalid value of lag.max"));
    PROTECT(res = allocVector(REALSXP, m));
    psi = REAL(res);
    for(i = 0; i < m; i++) {
    tmp = (i < q) ? theta[i] : 0.0;
    for(j = 0; j < min(i+1, p); j++)
        tmp += phi[j] * ((i-j-1 >= 0) ? psi[i-j-1] : 1.0);
    psi[i] = tmp;
    }
    UNPROTECT(1);
    return res;
}