ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Tue, 13 Sep 2011 05:45:57 +0200tseriesChaos package for R from Sage Notebookhttps://ask.sagemath.org/question/8129/tserieschaos-package-for-r-from-sage-notebook/Hello!
I need some nonlinear time series analysis functionality, which, as I've learnt from Internet, is provided by the 'tseriesChaos' package for R. I tried to use it from inside the Sage Notebook (one of the public servers) like this:
r.library('tseriesChaos')
and got the following error message:
Traceback (click to the left of this block for traceback)
...
there is no package called 'tseriesChaos'
This variant:
%r
library(tseriesChaos)
gave almost the same:
Error in library(tseriesChaos) :
there is no package called 'tseriesChaos'
So it looks like there is no 'tseriesChaos' package in a default Sage installation. So, how is it possible to use it? And how is it probable for the 'tseriesChaos' package to be included into Sage by default?
Thanks.Wed, 25 May 2011 13:12:51 +0200https://ask.sagemath.org/question/8129/tserieschaos-package-for-r-from-sage-notebook/Answer by Joaquim Puig for <p>Hello!
I need some nonlinear time series analysis functionality, which, as I've learnt from Internet, is provided by the 'tseriesChaos' package for R. I tried to use it from inside the Sage Notebook (one of the public servers) like this:</p>
<pre><code>r.library('tseriesChaos')
</code></pre>
<p>and got the following error message:</p>
<pre><code>Traceback (click to the left of this block for traceback)
...
there is no package called 'tseriesChaos'
</code></pre>
<p>This variant:</p>
<pre><code>%r
library(tseriesChaos)
</code></pre>
<p>gave almost the same:</p>
<pre><code>Error in library(tseriesChaos) :
there is no package called 'tseriesChaos'
</code></pre>
<p>So it looks like there is no 'tseriesChaos' package in a default Sage installation. So, how is it possible to use it? And how is it probable for the 'tseriesChaos' package to be included into Sage by default?</p>
<p>Thanks.</p>
https://ask.sagemath.org/question/8129/tserieschaos-package-for-r-from-sage-notebook/?answer=12387#post-id-12387First of all you have to install the package tseriesChaos, which is a R package and not a regular Sage package.
As far as I know, to install R packages you need to have compiled version of sage. You go to Sage website, download source, follow the instructions, wait for a while (depending on your hardware) and that's all. Then type:
sage: r.install_packages('tseriesChaos')
and the package will install downloading and compiling packages automatically. The final message will be
Please restart Sage in order to use 'tseriesChaos'.
so restart Sage. After that load the library
sage: r.library('tseriesChaos')
and it should load without problems.
In my opinion, if you just want to use the 'tseriesChaos' package it might be easier to use R directly. With the steps above you, after doing "sage -R" from the shell you can do the following example from tseriesChaos package:
annaquim@aljibe:~$ sage -R
> require(tseriesChaos)
Loading required package: tseriesChaos
Loading required package: odesolve
> output <-lyap_k(lorenz.ts, m=3, d=2, s=200, t=40, ref=1700, k=2, eps=4)
Finding nearests
Keeping 1700 reference points
Following points
> plot(output)
> lyap(output, 0.73, 2.47)
(Intercept) lambda
0.1185032 0.7123131
You can also consider reprogramming the routines using sage or the included numpy/scipy.
Wed, 01 Jun 2011 05:18:00 +0200https://ask.sagemath.org/question/8129/tserieschaos-package-for-r-from-sage-notebook/?answer=12387#post-id-12387Comment by Joaquim Puig for <p>First of all you have to install the package tseriesChaos, which is a R package and not a regular Sage package.</p>
<p>As far as I know, to install R packages you need to have compiled version of sage. You go to Sage website, download source, follow the instructions, wait for a while (depending on your hardware) and that's all. Then type:</p>
<pre><code>sage: r.install_packages('tseriesChaos')
</code></pre>
<p>and the package will install downloading and compiling packages automatically. The final message will be</p>
<pre><code>Please restart Sage in order to use 'tseriesChaos'.
</code></pre>
<p>so restart Sage. After that load the library</p>
<pre><code>sage: r.library('tseriesChaos')
</code></pre>
<p>and it should load without problems. </p>
<p>In my opinion, if you just want to use the 'tseriesChaos' package it might be easier to use R directly. With the steps above you, after doing "sage -R" from the shell you can do the following example from tseriesChaos package:</p>
<p>annaquim@aljibe:~$ sage -R</p>
<pre><code>> require(tseriesChaos)
Loading required package: tseriesChaos
Loading required package: odesolve
> output <-lyap_k(lorenz.ts, m=3, d=2, s=200, t=40, ref=1700, k=2, eps=4)
Finding nearests
Keeping 1700 reference points
Following points
> plot(output)
> lyap(output, 0.73, 2.47)
(Intercept) lambda
0.1185032 0.7123131
</code></pre>
<p>You can also consider reprogramming the routines using sage or the included numpy/scipy.</p>
https://ask.sagemath.org/question/8129/tserieschaos-package-for-r-from-sage-notebook/?comment=21260#post-id-21260I have now noticed that after version 4.7.1 (maybe before) it is not necessary to recompile SAGE.Tue, 13 Sep 2011 05:45:57 +0200https://ask.sagemath.org/question/8129/tserieschaos-package-for-r-from-sage-notebook/?comment=21260#post-id-21260