Hello Dirk and others,<br>The &quot;explicit print&quot; worked fine! I had read about in other posts, but I didn&#39;t realize my mistake.<br>In the 11th standard example I found that just adding &quot;x11()&quot; and &quot;sleep()&quot; at the beginning and end of plot, I can see the graphics.<br>

Arima function returns an &quot;arima model&quot;, not just a vector, so I don&#39;t know how to get it (but I don&#39;t need it at this time).<br>Thank you very much, you answered really fast!<br><br><div class="gmail_quote">

2011/11/29 Dirk Eddelbuettel <span dir="ltr">&lt;<a href="mailto:edd@debian.org">edd@debian.org</a>&gt;</span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div>

<div></div><div class="h5"><br>
On 29 November 2011 at 11:03, Kowagunga wrote:<br>
| Hello everyone,<br>
| I&#39;m working to get some predictions using ARIMA model in R. This is the code<br>
| I&#39;m using, at it works as expected:<br>
|<br>
|<br>
|     library(TSA)<br>
|     load(&#39; path... /R/i686-pc-linux-gnu-library/2.14/TSA/data/airpass.rda&#39;)<br>
|     show(airpass)<br>
|     m &lt;- arima(airpass,order=c(0,1,12),seasonal=list(order=c(0,1,1),period=24))<br>
|     m<br>
|     plot(m,n.ahead=72,xlab=&#39;Time&#39;,type=&#39;o&#39;,ylab=&#39;Passengers&#39;)<br>
|     abline(h=0)<br>
|<br>
|<br>
| I use example data from the TSA package, and the prediction is plotted well.<br>
| The issue is that what I really want is use it within a bigger C++ project, so<br>
| I need to use RInside package. I&#39;ve tested every example of RInside, and it<br>
| seems perfectly operative in my machine.<br>
| I have programmed it like this:<br>
|<br>
|     //Ejemplo que carga los datos airpass.rda del package TSA y realiza una<br>
|     prediccion ARIMA sobre ellos<br>
|     #include &lt;RInside.h&gt;                           <br>
|     // for the embedded R via RInside<br>
|     int main(int argc, char *argv[]) {<br>
|         RInside R(argc, argv);                      //<br>
|     create an embedded R instance<br>
|         std::string evalstr = &quot;library(TSA); load(&#39; ...path... /R/<br>
|     i686-pc-linux-gnu-library/2.14/TSA/data/airpass.rda&#39;); show(airpass);&quot;; //<br>
|     Cargamos la libreria TSA necesaria y el archivo de datos<br>
|         R.parseEvalQ(evalstr);<br>
|         std::string evalstr2 = &quot;m &lt;- arima(airpass,order=c(0,1,12),seasonal=<br>
|     list(order=c(0,1,1),period=24)); m&quot;; //Calculo de la prediccion sobre los<br>
|     datos. Coeficientes manualmente precalculados<br>
|         R.parseEvalQ(evalstr2);<br>
|         std::string evalstr3 = &quot;plot(m,n.ahead=72,xlab=&#39;Tiempo&#39;,type=<br>
|     &#39;o&#39;,ylab=&#39;Pasajeros&#39;); abline(h=0)&quot;; //Dibujamos los datos y la prediccion.<br>
|         R.parseEvalQ(evalstr3);<br>
|         std::string evalstr4 = &quot;cat(&#39;AIC del modelo:\n&#39;); m$aic&quot;; //Muestra<br>
|     el estimador de bondad AIC<br>
|         R.parseEvalQ(evalstr4);<br>
|<br>
|         exit(0);<br>
|     }<br>
|<br>
| (The comments are in spanish, sorry)<br>
| When I run this code, the output of the first evalstr is the same that in R.<br>
| TSA &amp; airpass are loaded correctly. But the next line seems not to work.<br>
| It tooks several seconds calculating arima model, but it the problem is that<br>
| &quot;m&quot; command to show the model produces no output, the same that &quot;m$aic&quot;. With<br>
| &quot;no output&quot; I mean nothing (including any error).<br>
<br>
</div></div>RInside is by default silent and only prints if you are explicit.<br>
<br>
So try an explicit &#39;print(m)&#39; as in:<br>
<div class="im"><br>
      std::string evalstr2 = &quot;m &lt;- arima(airpass,order=c(0,1,12),&quot;<br>
</div>                             &quot;seasonal=list(order=c(0,1,1),period=24)); print(m)&quot;;<br>
      R.parseEvalQ(evalstr2);<br>
<br>
which will now print m.<br>
<br>
If you want a result returned you must<br>
<br>
   a) use parseEval() and NOT parseEvalQ() which is &#39;quiet&#39;<br>
<br>
   b) assign to some variable -- I don&#39;t know of the top of my head what<br>
      arima() returns, but if it were just a vector you&#39;d do<br>
<div class="im"><br>
      std::string evalstr2 = &quot;m &lt;- arima(airpass,order=c(0,1,12),&quot;<br>
                             &quot;seasonal=list(order=c(0,1,1),period=24)); m&quot;;<br>
</div>      Rcpp::NumericVector myM = R.parseEval(evalstr2);<br>
<br>
This is all relatively basic and I encourage you to study the over ten examples<br>
that come with RInside a little more closely.<br>
<br>
Dirk<br>
<div><div></div><div class="h5"><br>
<br>
| I can&#39;t get the graphic too, but I know that maybe I would have to plot to a<br>
| file to get it work. The problem is that I also get no error. This is the<br>
| output of my code (there are some warning lines at the beginning, but the rest<br>
| of examples always worked with the same lines):<br>
|<br>
|     During startup - Warning messages:<br>
|     1: Setting LC_CTYPE failed, using &quot;C&quot;<br>
|     2: Setting LC_COLLATE failed, using &quot;C&quot;<br>
|     3: Setting LC_TIME failed, using &quot;C&quot;<br>
|     4: Setting LC_MESSAGES failed, using &quot;C&quot;<br>
|     5: Setting LC_PAPER failed, using &quot;C&quot;<br>
|     6: Setting LC_PAPER failed, using &quot;C&quot;<br>
|     7: Setting LC_MEASUREMENT failed, using &quot;C&quot;<br>
|     Loading required package: leaps<br>
|     Loading required package: locfit<br>
|     Loading required package: akima<br>
|     Loading required package: lattice<br>
|     locfit 1.5-6      2010-01-20<br>
|     Loading required package: mgcv<br>
|     This is mgcv 1.7-9. For overview type &#39;help(&quot;mgcv-package&quot;)&#39;.<br>
|     Loading required package: tseries<br>
|     Loading required package: quadprog<br>
|     Loading required package: zoo<br>
|<br>
|     Attaching package: &#39;zoo&#39;<br>
|<br>
|     The following object(s) are masked from &#39;package:base&#39;:<br>
|<br>
|         as.Date, as.Date.numeric<br>
|<br>
|<br>
|     Attaching package: &#39;TSA&#39;<br>
|<br>
|     The following object(s) are masked from &#39;package:stats&#39;:<br>
|<br>
|         acf, arima<br>
|<br>
|     The following object(s) are masked from &#39;package:utils&#39;:<br>
|<br>
|         tar<br>
|<br>
|          Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec<br>
|     1960 112 118 132 129 121 135 148 148 136 119 104 118<br>
|     1961 115 126 141 135 125 149 170 170 158 133 114 140<br>
|     1962 145 150 178 163 172 178 199 199 184 162 146 166<br>
|     1963 171 180 193 181 183 218 230 242 209 191 172 194<br>
|     1964 196 196 236 235 229 243 264 272 237 211 180 201<br>
|     1965 204 188 235 227 234 264 302 293 259 229 203 229<br>
|     1966 242 233 267 269 270 315 364 347 312 274 237 278<br>
|     1967 284 277 317 313 318 374 413 405 355 306 271 306<br>
|     1968 315 301 356 348 355 422 465 467 404 347 305 336<br>
|     1969 340 318 362 348 363 435 491 505 404 359 310 337<br>
|     1970 360 342 406 396 420 472 548 559 463 407 362 405<br>
|     1971 417 391 419 461 472 535 622 606 508 461 390 432<br>
|     AIC del modelo:<br>
|<br>
|  <br>
| I have tried everything that came to my mind, and I have no more ideas! I think<br>
| I have explained my best, hope somebody can help me with this.<br>
| Sorry if I made some language mistake ;) Thank you very much!<br>
|<br>
</div></div>| ----------------------------------------------------------------------<br>
| _______________________________________________<br>
| Rcpp-devel mailing list<br>
| <a href="mailto:Rcpp-devel@lists.r-forge.r-project.org">Rcpp-devel@lists.r-forge.r-project.org</a><br>
| <a href="https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel" target="_blank">https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel</a><br>
<font color="#888888">--<br>
&quot;Outside of a dog, a book is a man&#39;s best friend. Inside of a dog, it is too<br>
dark to read.&quot; -- Groucho Marx<br>
</font></blockquote></div><br>