how to integrate / link R and Computer Algebra Systems (CAS) - math

I'm looking for a possibility to use different 'higher' math operations in combination with R. A link or integration between R and a CAS would be the perfect solution.
Which integration of R and other (math & statistic related) systems or vice verse are out there? How well do they work? What would you suggest? How expansive (in time, money and frustration) are they?
(FOSS is of course preferred :)

Have you looked at the Ryacas package which brings Yacas to R?
The SAGE project has a focus on CAS and offers an R integration.

There is also rsympy (CRAN):
rSymPy is an R package giving R users access to the SymPy computer algebra system running on Jython from within R.

Sadly there is only a link to matlab and not maxima...

Related

How to calculate in R with variables

I'm a R newbie.
is there a way i can calculate
(x+x^2+x^3)^2
in R?
so i will get the result:
x^6+2 x^5+3 x^4+2 x^3+x^2
I get an Error: object 'x' not found.
Thanks!
R isn't well suited for this. Some interface packages to languages and libraries that are better at this do exist, such as rSymPy, which allows you to access the SymPy Python library for symbolic mathematics (you'll need to install both). In a similar vein, Ryacas links to the yacas algebra system.
Those interfaces are useful if you need symbolic manipulation as part of an R workflow. Otherwise, consider using the original tools. The ones above are open source and freely available, while other free use alternatives also exist, such as the proprietary web based Wolfram Alpha (for limited use).

Symbolic Math in Julia?

I use Mathematica for symbolic math calculations. I am planning to switch to another language. Matlab (which I use for standard computation stuff) includes this feature but I am looking at the possibility of using Julia, since it seems to be the future. Yet, there seems to be no symbolic tool available (no mention in official documentation). Apparently the only package available (SymPy) says "Test Failed" in the official website (http://pkg.julialang.org/).
Has anyone been able to do this in Julia?
Now, looking at http://pkg.julialang.org/ one could find more candidates to perform symbolic mathematics in julia:
SymEngine.jl
Julia Wrappers for SymEngine, a fast symbolic manipulation library, written in C++.
Symata.jl
a language for symbolic computations and mathematics, where, for the most part, "mathematics" means what it typically does for a scientist or engineer.
SymPy.jl
Julia interface to SymPy via PyCall
Also:
LinearExpressions.jl
Linear symbolic expressions for the Julia language
SymPy Package works fine, it brings Python's Sympy functionality into Julia via PyCall.
SymPy is a Python library for symbolic mathematics. It aims to
become a full-featured computer algebra system (CAS) while keeping the
code as simple as possible in order to be comprehensible and easily
extensible. SymPy is written entirely in Python and does not require
any external libraries.
Also, consider the Nemo.jl library which they claim is faster than alternatives like SageMath.

machine learning libraries in s+ (or R)?

have been searching around the internet and stackoverflow, but haven't been able to find any information on libraries for machine learning in s-plus or R. does anyone know of any or could perhaps point me in the right direction? thank you!
You should probably start at the CRAN Task View on Machine Learning & Statistical Learning which covers the R side.
this one maybe helpful:machine learning open source software Filter by Programming Language
If your interest in ML on R includes classification and regression algorithms, then you will want to explore CARET. Be advised that, in a recent evaluation, I found the R offerings quite underwhelming when compared to the other ML OSS.

Mathematical Programming Languages

Given my previous questions about the the usage of AMPL.
Are there any other programming/scripting languages that are strictly meant for mathmatical processing?
For example: Matlab (it does deviate a bit from a mathematical structure, but its close enough), Mathematica, and AMPL
R / S+ for statistical computing
Other stat languages: SAS, SPSS, STATA, GAUSS, etc.
Octave, an open source clone of Matlab
Fortress, "a language for high-performance computation that provides abstraction and type safety on par with modern programming language principles."
Maple
Maxima
There's always APL, with its builtin matrix operators. Modern APL even supports .NET.
R, Numpy/scipy for Python, Maple, Yacas, even Fortran.
This may be only of historical significance, but Fortan (The IBM Mathematical Formula Translating System) is especially suited to numeric computation and scientific computing.
OPL (Optimization Programming Language) is one of the most comprehensive modelling languages for Mathematical Programming. You can do Linear Programming (LP), Mixed Integer Programming (MIP), Quadratic Programming (QP), Constraint Programming (CP), MIQP, etc.
IBM-ILOG CPLEX Optimization Studio uses this language.
Maple for symbolic math (similar to Mathematica).
SAS, SPSS, R for statistics.
The Operation Research / Management Science magazine has a yearly survey of Simulation Software, and while I can't find the link I believe they have one yearly survey on optimization packages, such as AMPL you are quoting.
Sage is basically Python with a load of packages and a few language extensions put into a "notebook" interface like that of Mathematica. It has interfaces to all sorts of computer algebra systems. And with Numpy and Scipy (which are included) it's a fine replacement for Matlab. And it's open source and actively developed.
Given your previous question, I assume you are looking for an alternative to commercial mathematics packages. If so, you should try Sage, it is open source and is a unified front end for almost all of the open source mathematics/sci.calc. packages out there (list).
The way it works, is that it uses your web browser as a graphical front end for displaying, editing and evaluating Mathematica style notebooks (it is also possible to just use the command line). All the dirty work, such as selecting the appropriate package for the situation, is done transparently in the background.
Sage uses Python as it's main language / syntax, so it's fairly easy to learn, and if you have old Python scripts, they should work straight out of the box. If I didn't have access to a Mathematica license, I would definitely use this.
Interactive Data Language (IDL) is a proprietary language used in astronomy, medicine and other sciences at least in part because of its built-in array operations and mathematical library.
As this question is still open and well indexed in Google, I would definitively add to the list the Julia language.
Aside the technical aspects that make shine this high level/high performance new language, an important consideration is that the community of developers/users is clearly biased toward mathematicians.

Step-by-Step How-to on Mediation Analysis in R

I'd like to know if anybody can provide a step-by-step how to on how to use mediation analysis using Keele, Tingley, Yamamoto and Imai's mediation package. I think there are two approaches to this - the classic Baron and Kenny (1986) and the new one by Preacher, Rucker and Hayes (2007) - I'd like to know how to do both approaches in R
In case you not familiar with R and packages, start with
install.packages(mediation)
to download and install the package from CRAN. Then do
library(help=mediation)
for a high-level view of the package, and available help files. Then use
library(mediation)
help(mediate)
to load the package and read the help page. The example can be run via
example(mediate)
and you can run the other example for sensitivity analysis via
example(medsens)
This vignette is what you are looking for, if the above answer isn't enough.
It's about as hand-holdy as you can get with this sort of thing.

Resources