Research in matrix packages - page 3

 
Alexey Volchanskiy:

Great, it's my first day of learning R, answer my questions please, I want to compare possibilities of R and Matlab. But don't host hostility, be reasonable and calm :).

  1. Is R a language with OOP capabilities?
  2. Can I create in R a 32-bit and 64-bit dll for direct use from MQL4/5? If so, what size package must I install to use such a dll on a user's computer?
  3. Can I connect common dlls for direct access from R?
  4. Is there an analogue of Simulink in R?
  5. Why do all the reviews emphasise that R is a statistics program? I am interested in DSP, does R have packages for digital signal processing?
  6. Does R have a built-in compact format for storing data, similar to .mat files in Matlab?

1. Yes. Comparing different programming languages is not an easy task, as using some tools and not using others is often a matter of programmer's taste.

I am not an expert in R but I will mention this:

R has no concept of a "scalar". It is a vector of length 1. That is, the arithmetic is based on matrix operations. a line of code C= A+B can call a matrix operation

in R the notion of "object" is taken to its logical conclusion: it can be a vector, a matrix, a matrix of programs and in general the environment in which a user program is executed.

In R it is quite easy to write programs that not only load the processors and cores of the execution computer, but also the neighboring computers in the local network

...

2. My knowledge is insufficient for an answer. Apparently you can't. This stems from the specifics of the construction of R itself, which is an interpreter when first encountered. But this is a superficial view. The fact that R is a symbiosis with a well documented interface with C. The main power of R are the packages (over 7000 thousand, containing about 120 000 functions), and these packages are usually references to programs in C or Fortran. The point is that R uses C and Fortran libraries for all computationally intensive operations.

A lot of attention to R is given to APIs, but beyond my qualifications

3. Yes

4. I don't think so. There are a number of tools available (except off-the-shelf) for building GUIs, though that's not it. In this paragraph I want to mention tools widely developed in R, which are absent in usual programming languages: these are methods of statistical model testing. The tools to process the results of statistical tests are very developed and advanced. In R you can easily answer the question: "By how much does the mean differ from the mathematical expectation for a sample of 100 observations?"

5. Statistics, in the broad sense of the word, is a feature of R. Don't forget the graphing tools, which are fundamental when working with statistics. To get an overview of the R tools open the website, there are thematic compilations of packages.

6. Can't make a comparison. But there is "bytecode". But the point is different. A program in R which contains several thousand lines of code is exotic. An ordinary R program is a package function call.

 
Alexey Volchanskiy:
I must try to translate some of my programs in Matlab into R, to compare the speed. If I have time to figure it out over the weekend, I'll do it and report back. Matlab is pretty slow, I do a lot of stuff in C# or C++ and plug it in as a DLL for speed.

R itself is three times retarded. It is an interpreter. No problems with debugging at all, at first I started using the debugger, and then I found out that it's no use.

Speaking of R speed, there are several considerations here.

1. You may translate it into byte-code, but it's a poultice

2. Let's not forget that packages for computationally intensive operations use libraries, which were chosen with speed in mind

3. a library is used for matrix operations

4. Loop operators are not needed for matrix operations

5. Loading of all cores. Standard and very simple wherever the algorithm allows.

Generally, comparing programs simply by rewriting from language to language works if your knowledge of both languages is the same.

 
Alexey Volchanskiy:
I must try to translate some of my programs to R in Matlab, to compare the speed. If I manage to figure it out by the weekend, I'll do it and report back. Matlab is pretty slow, I do a lot of things in C# or C++ and plug it in as a DLL for speed.

You see, if you are going to count something non-trivial, it will be using a package. If the package is written in 'pluses', it will fly. If not, it might crawl.

Tested from my own experience: if you try to loop through the elements of data.frame (which is an array that can contain a mix of data types) and count something on them, it can be Extremely long. R is very slow to do calculations on large arrays, unless special packages are used.

But there's always some library, where the calculation I need is already implemented, and I can call, for example, rollapply(x$V1, mean) and calculate moving averages on all elements, instead of tiresomely long array element by element conversion.

 
СанСаныч Фоменко:


5. Load all cores. Standard and very simple wherever the algorithm allows.


SanSanych, could you clarify this? We were probing parallelism in R and came to a clear conclusion that it loads One core (it looks like 25% load on all 4 cores), unless otherwise provided for in the special package.
 
СанСаныч Фоменко:

R himself is three times retarded...


Then what is the scope of this software? To analyse an efficient assortment for a boutique selling Chinese consumer goods?
 
СанСаныч Фоменко:

... The main power of R is packages (over 7000 thousand, containing about 120 000 functions)...

And how many packages and functions are necessary and enough to get a stable profit?

What software will we master next, if R can't handle it?

 
Alexey Burnakov:
SanSanych, could you clarify this? We were feeling parallelism in R and came to a clear conclusion that it loads One core (it looks like 25% load on all 4 cores), unless otherwise stipulated in the special package.
Parallel computing is a very advanced thing and has a lot of publications, e.g. attac.
Files:
parallel.zip  387 kb
 
Dmitry Fedoseev:

What, then, is the scope of this software? To analyze an effective assortment for a boutique selling Chinese consumer goods?

Please read my post in its entirety.

To add.

When I was writing about R itself, please don't forget that real R code consists only in a small part of the R text itself.

The simplest example.

Forwarding: A=B.

If A and B are scalars, it is likely that the code in MKL will be faster.

But there are no scalars in R: A and B are at least vectors. In MCL it is cycles, in R it is written without any cycles and implemented as part of a package, today's matrix computation, which is top-notch in efficiency. And if you compare R and MCL in terms of matrix calculations, R is fundamentally more efficient.

It is a general principle of R to use chunks of off-the-shelf efficient code that was not written in R - usually in C, if no off-the-shelf specialized libraries were available.

Bottom line: R is computationally efficient by using internal subroutines and parallel computing

 
Event:

And how many packages and functions are necessary and sufficient to make a stable profit?

What software will we master next, if R is not enough?

For the needs of an individual trader we have redundant software.

Today R is the top software in the field of statistics in the broad sense. For example, the methods of machine learning, which have traditionally been attributed to artificial intelligence, are widely represented in R.

There is another nuance.

The latest buzz in the field comes in the form of the R package. And here's why. Nowadays, scientific publications in the field of statistics, apart from formulas, usually contain code in R, a sign of good mauvais ton, so to speak. And from R code in an article to a full-fledged package within R is one step.

To add to this, anything related to R is a worldwide hangout. Putting a package in the R repositories makes the author of a package within R a worldwide celebrity. R is a free, open source system with no restrictions on use. Exactly this property of R allows R to grab the world leadership from the previous paid leaders - SAS, SPSS, well also the confusing language of Python.

It is not for nothing that about a year ago Microsoft got into R by acquiring a paid variant of R - revolution analytics - into ownership and is now actively promoting it.

 
СанСаныч Фоменко:
Parallel computing is a very advanced thing, has a lot of publications, e.g. attac.
Grand merci.