R 언어 학습 노트 - Error in ts(x): 대상은 행렬 문제 해결이 아닙니다.

2337 단어

1. 문제


시간 시퀀스를 맞추는 동안 발생: Error in ts(x): 객체는 행렬 오류가 아니라 arima() 함수에서 직접 사용하는 경우 문제가 없습니다.
> sample > sample [1] [1] 0.00 0.00 0.00 0.00 0.00 0.00 0.06 0.09 0.20 0.09 0.08 0.14 0.23 [15] 0.08 0.06 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.09 0.08 0.14 0.14 0.14 0.14 0.11 0.20 0.14 0.11 0.14 0.14 0.11 0.14 0.14 0.14 0.11 0.14 0.14 0.14 0.11 0.14 0.14 0.11 0.14 0.14 0.14 0.11 0.14 0.14 0.14 0.11 0.14 0.14 0.14 0.14 0.14 0.11 0.14 0.14 0.14 0.14 0.14 0.14 0.11 0.14 0.14 0.14 0.14 0.14 0.14 0.14 0.14 0.14 0.14 0.14 0.14 0.14 0.14 0.14 0.14 0.14 0.14 0.14 0.14 0.14 0.14 sample,order=c(4,0,3)Call:arima(x = sample, order = c(4, 0, 3)) Coefficients:          ar1     ar2      ar3     ar4      ma1     ma2     ma3  intercept       0.6740  0.0666  -0.4026  0.4924  -0.6160  0.2129  0.3564     0.1097 s.e.  0.2761  0.3073   0.2510  0.1724   0.3005  0.3112  0.2361     0.0380 sigma^2 estimated as 0.002756:  log likelihood = 67.68,  aic = -117.37 >

2. 원인 분석


원본: 데이터의 변수 이름은 기본 패키지의 Sample 함수와 동명이기 때문에fitted () 함수에서 정확하게 처리되지 않았습니다.
R 언어에서sample은 기본 패키지의 함수입니다. R 프로그램에서 변수 이름은 같은 이름의 이름을 사용하지 않도록 주의하십시오.그렇지 않으면 정확한 결과를 얻지 못할 것이다.

3. 해결


해결 방법은 함수와 동명하지 않는 것이다. 왜 fitted () 함수에서 Sample () 함수가 정확하게 처리되지 않았는지, fitted () 함수 자체와 관련이 있을 수 있다.
주의: 혼동을 일으킬 수 있는 데이터 () 함수도 있습니다.

4、sample 명령 참조


도움말 (Sample) 을 사용하면 Sample () 함수의 사용 도움말을 볼 수 있습니다.
sample {base}
R Documentation

Random Samples and Permutations


Description

sample takes a sample of the specified size from the elementsof x using either with or without replacement.

Usage

sample(x, size, replace = FALSE, prob = NULL)

sample.int(n, size = n, replace = FALSE, prob = NULL)

Arguments

x
Either a vector of one or more elements from which to choose,or a positive integer. See ‘Details.’ n
a positive number, the number of items to choose from. See‘Details.’ size
a non-negative integer giving the number of items to choose. replace
Should sampling be with replacement? prob
A vector of probability weights for obtaining the elementsof the vector being sampled.

좋은 웹페이지 즐겨찾기