Processing math: 44%
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

R interpreter $ with forecasts

Hi,

I'm trying to use the R interpreter in sage for a script I'm running that makes use of both sage and R.

I'm coming across a problem in the sagemath R interpreter where I am trying to perform the following (R script):

library(forecast) data <- AirPassengers data <- log(data) ARIMA <- arima(data, order = c(1, 0, 1), list(order = c(12,0, 12), period = 1)) fc<-forecast(ARIMA,h=24) fcmean<exp(fcmean) fcupper<exp(fcupper) fclower<exp(fclower) fcx<exp(fcx)

Namely, I am trying to "unlog" an R forecast and then plot it. I'm finding I cannot perform the last step in sage. I don't think the "" operator works in sage, so I am using the other reference method fc['"x"'] = r.exp(fc['"x"']) but I get an error saying this value is not able to be assigned to. Anyone know how to get around this, or what the equivalent to the "" operator would be in the sage r interpreter?

click to hide/show revision 2
No.2 Revision

R interpreter $ with forecasts

Hi,

I'm trying to use the R interpreter in sage for a script I'm running that makes use of both sage and R.

I'm coming across a problem in the sagemath R interpreter where I am trying to perform the following (R script):

library(forecast) data <- AirPassengers data <- log(data) ARIMA <- arima(data, order = c(1, 0, 1), list(order = c(12,0, 12), period = 1)) fc<-forecast(ARIMA,h=24) fcmean<-exp(fcmean) fcupper<-exp(fcupper) fclower<-exp(fclower) fcx<-exp(fcx)fc\$mean<-exp(fc\$mean) fc\$upper<-exp(fc\$upper) fc\$lower<-exp(fc\$lower) fc\$x<-exp(fc\$x)

Namely, I am trying to "unlog" an R forecast and then plot it. I'm finding I cannot perform the last step in sage. I don't think the "$" "\$" operator works in sage, so I am using the other reference method fc['"x"'] = r.exp(fc['"x"']) but I get an error saying this value is not able to be assigned to. Anyone know how to get around this, or what the equivalent to the "$" "\$" operator would be in the sage r interpreter?

click to hide/show revision 3
No.3 Revision

updated 10 years ago

kcrisman gravatar image

R interpreter $ with forecasts

Hi,

I'm trying to use the R interpreter in sage for a script I'm running that makes use of both sage and R.

I'm coming across a problem in the sagemath R interpreter where I am trying to perform the following (R script):

library(forecast)
data <- AirPassengers
data <- log(data)
ARIMA <- arima(data, order = c(1, 0, 1), list(order = c(12,0, 12), period = 1)) 
fc<-forecast(ARIMA,h=24)
fc\$mean<-exp(fc\$mean)
fc\$upper<-exp(fc\$upper)
fc\$lower<-exp(fc\$lower)
fc\$x<-exp(fc\$x)

fc\$x<-exp(fc\$x)

Namely, I am trying to "unlog" an R forecast and then plot it. I'm finding I cannot perform the last step in sage. I don't think the "\$" operator works in sage, so I am using the other reference method fc['"x"'] = r.exp(fc['"x"']) but I get an error saying this value is not able to be assigned to. Anyone know how to get around this, or what the equivalent to the "\$" operator would be in the sage r interpreter?