2016-07-11 27 views
0

機能に問題があり、私は予測パッケージを使用してRに書きました。これは、関数である:meanf - 未使用引数のエラー

generateARIMAForecasts <- function(inputTSDecompList, inputArimaOrder, fcstHrzn, cnst, drft){ 

    tmpSTL <- NULL; 
    fcasting <- NULL; 
    tsfcastList <- NULL; 
    counter <- 1; 

    while(counter <= length(inputTSDecompList)){ 
    #select the TS decompositions 
    tmpSTL <- inputTSDecompList[counter]$TimeSeriesDecomposition; 
    #add the lattice plot to the list of plots 
    if(cnst == TRUE & drft == TRUE){ 
     fcasting <- forecast(tmpSTL, h=fcstHrzn, 
          forecastfunction=function(x,h,level, ...){ 
          fit <- Arima(x, order=inputArimaOrder, include.constant = TRUE, include.drift = TRUE) 
          return(forecast(fit,h=fcstHrzn,level=level, ...))}); 
    } 
    fcastCoefs <- fcasting$model$coef; 
    fcstValues <- fcasting; 
    fcastSummary <- summary(fcasting); 

    #add the forecast results to the forecast list 
    tsfcastList[[counter]] <- list(FinancialInstitution=LVTSFITimeSeriesList[counter]$LVTSFITimeSeriesList$FinancialInstitution, 
          ForecastCoefficients=fcastCoefs, 
          ForecastedSeries=fcstValues, 
          ForecastSummary=fcastSummary); 
    counter <- counter+1; 
    } 
    return(tsfcastList); 
} 

機能は、シリーズを分解し、入力リスト内の個々のSTL分解の時系列ごとに有馬予測を生成STLのリストを取ります。 私は、個々の要素のハードコーディングによって手動で予測生成を実行しています。 未使用の引数(forecastfunction =:私は機能を使用してそれを実行しようとすると、しかし、私はmeanfで

エラー(オブジェクト、H = H、レベル=レベル、ファン=ファン、ラムダ=ラムダ、次のエラーを取得します{ fit < - Arima(x、order = inputArimaOrder、include.constant = TRUE、include.drift = TRUE) return(予測(フィット、h = fcstHrzn、レベル=レベル、...)) }) さらに:50件の以上の警告があった(使用警告()を参照する最初の50)

誰か助言してもらえますか?手動RStudioコンソールの各ラインをデバッグするいくつかのより多くの時間が、私はそれを考え出した後

答えて

0

こんにちは、問題は、私は2-DリストとしてinputTSDecompListを作成していたので、これはNULLを返さ

tmpSTL <- inputTSDecompList[counter]$TimeSeriesDecomposition; 

私の呼び出しでした

tsDecomList[[counter]] <- list(FinancialInstitution=inputTSList[counter]$LVTSFITimeSeriesList$FinancialInstitution, TimeSeriesDecomposition=tsDecom); 

を使用してだから私は

tmpSTL <- inputTSDecompList[[counter]]$TimeSeriesDecomposition; 
を呼び出すされている必要があります
関連する問題