I tried to fit a simple GARCH model for following data set(which contains weekly prices of a agricultural commodity) using fGarch package. But, after every other variant of model, r gives following error message, implying the function is not running correctly.
"Warning message:
Using formula(x) is deprecated when x is a character vector of length > 1.
Consider formula(paste(x, collapse = " ")) instead."
I do not know how to correct the error and proceed with modelling. Seeking advises to run the model correctly. Thank you very much in advance.
Codes used:
library(fGarch)
garch<-read.csv("crrp.csv",header=T,sep="," )
attach(garch)
head(garch)
tcrrp = ts(garch$crrp, start=c(1997,1),end=c(1998,52), frequency=52)
lcr<-(log(tcrrp))
dlcr<-diff(lcr)
dat<-cbind(dlcr)
car1<-garchFit(dlcr~garch(1, 0), data = dat, trace=FALSE, cond.dist='std')
summary(car1)
"Warning message:
Using formula(x) is deprecated when x is a character vector of length > 1.
Consider formula(paste(x, collapse = " ")) instead"
Data
crrp
35.57
33.89
33.65
32.48
32.5
32.59
34.01
34.35
35.32
35
35
36.5
34.29
33.09
43.59
42.44
43.1
40.38
45.28
47.49
53.57
59.96
60.15
60.16
61.53
57.24
52.24
49.68
47.73
40.95
36
33.67
32.82
32
32
32
31.9
31.67
31.14
31.73
31.87
32.44
33.49
37.5
40.51
45.76
51.16
59.33
67.27
75.72
76.05
84.19
89.33
87.1
88.25
84.86
91.14
90.72
72.84
59.18
59.9
62.2
54.05
47.02
43.86
42.18
44.1
45.67
42.49
43.36
46.93
44.56
66.11
66.76
64.62
65.9
69.86
68.58
63.72
56.46
54.2
56.62
51.3
50.3
42.88
40.14
43.37
38.27
36.29
34.26
33.2
34.1
34.11
34.9
35.93
34.93
33.8
34.1
34.95
35.02
34.64
34.16
38.49
48.13
I had the same question with you,and I solved it by I run the following code at the same time instead of run them separately(taking an example as your code).