I have an code but it have an error In R, I do not know how to run it.
enter image description here And here should be run out like this enter image description here
library(forecast)
library(itsmr)
tor = readRDS ("/Users/zehaoli/Desktop/TorontoWeather.rds")
row <- 1:length(tor[, 1])
tempMay1.7 <- subset(tor, tor$Date.Time >= "2003-05-01 00:00" &
tor$Date.Time <= "2003-05-07 23:00")$Temp
tempMay8 <- subset(tor, tor$Date.Time >= "2003-05-08 00:00" &
tor$Date.Time <= "2003-05-08 23:00") $Temp
M <-c("season",24,"trend",2)
tesname <-Resid(tempMay1.7,M)
a <-arma(tesname,1,1)
f<-forecast(tempMay1.7,M,a,h=24,opt=0)
Error in match.arg(opt.crit) : 'arg' must be NULL or a character vector
plot(1:192,c(tempMay1.7,rep(NA,24)),
type="l",col="blue",ylim=c(3,22),ylab="Temp(°C)",
xlab="Date",main="Toronto Temperature (May 1 - May 8,2003)",
xaxt="n")
axis(side=1,at=12+(0:7)*24,
labels=c("May1","May2","May3","May4","May5","Мау6","May?","Ma8"))
lines(169:192,f$pred,col="red")
lines(169:192,f$l,lty=2,col="green")
lines(169:192,f$u,lty=2,col="green")
lines(169:192,tempMay8,col="black")
Error in match.arg(opt.crit) : 'arg' must be NULL or a character vector