Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
Improve this question
I have a large p (~20K) and small n (~500) problem. The first thing I was thinking is dimension reduction. After trying PCA, robust PCA, ICA, removing highly correlated features, I was thinking to use Random Projection. However, there is no simple R implementation of Random Projection.
I have found a few random projection R packages, like
MCLUST: https://cran.r-project.org/web/packages/mclust/index.html
RPEnsemble: https://cran.r-project.org/web/packages/RPEnsemble/index.html
But, it seems that they don't support random projection directly for dimension reduction. I have limited knowledge about random projection, but I found two functions in sklearn support this:
Gaussian random projection and Sparse random projection:
http://scikit-learn.org/stable/modules/random_projection.html
And it has pretty simple function interface.
Is that possible to implement random projection easily in R? Or, taking advantage of existing tools to do dimension reduction with Random Projection in R?
I concur that the RPEnsemble package doesn't seem to expose the low-level methods that would allow you to use only that feature in any convenient form.
I did however come across this R source code which seems fairly straight-forward and reasonably documented: R source code for random projections. This is part of the clusterv package and you can download it there.
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
Improve this question
I am by no means a math person, but I am really trying to figure out how create a graphable function from some data plots I measure from a chemical titration. I have been trying to learn R and I would like to know if anyone can explain to me or point me to a guide to create a mathmatic function of the titration graph below.
Thanks in advance.
What you are looking for is a Interpolation. I'm not a R programmer, but I'll try to answer anyway.
Some of the more common ways to achieve this function you want is by Polynomial Interpolation which usually gives back a Nth degree polynomial function, where N is the number of data points minus one (1 point gives a constant, 2 points make a line, 3 makes a*x^2 + b*x + c and so on).
Other common alternatives I've learn are used in Computer Graphics are Splines, B-spline, Bézier curve and Hermite interpolation. Those make the curve smoother and good looking (I've told they originated in the car industry so they are less true to the data points).
TL;DR: I've found evidence that there is a implementation of spline in R from the question Interpolation in R which may lead you to your solution.
Hope you get to know better your tool and do a great work.
When doing this kind of work in Computer Science we call it Numerical Methods (at least here in my university), I've done some class and homework in this area while attending to the Numerical Methods Course (it can be found at github) but it's nothing worth noting.
I would add a lot of links to Wikipedia but StackOverflow didn't allow it.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
I'm trying use linear regression with elastic net penalties for a mixed model. In the past I have used the R glmnet package with the penalty.factors parameter to accomplish this, but R is no longer an option for my project. I have found several implementations of elastic net in different languages, but none which allow for different penalty factors for each feature the way that the R glmnet package does.
Does a true translation of the R glmnet function exist in any other language? Thanks!
EDIT: Note that the R code is actually a wrapper of the FORTRAN code written for the R package. A few other wrappers exist in other languages, but I am looking for an new implementation of the full algorithm, not just an alternative wrapper. I want to be able to edit the code a bit, but I am not at all familiar with FORTRAN.
I would have put this in comments if I had enough points, but there is an implementation in Matlab, written by a few members of the team that wrote the original glmnet package:
http://web.stanford.edu/~hastie/glmnet_matlab/
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 3 years ago.
Improve this question
I'm quite new to R and I have the following problem:
I have a time series / signal and I want to build linear prediction model. It seems something like Matlab lpc will be great but I can't find corresponding function in R. Which package should I use?
It seems like you're talking about an autoregressive (AR) model - Yule-Walker equations seem to be at the heart of what you linked to. In which case, the ar function in the basic R installation may suffice or for more complicated models the arima function, also in the basic installation.
You should also look at the Time Series Task View on CRAN for additional information on suitable packages and I recommend you consult it for further options.
The kind of analysis you are trying to to can be done using packages in the timeseries task view. Most likely you want some kind of Autoregressive model (AR), for which I refer to the Forecasting and Univariate Modeling section of that task view. The linear filtering method you mentioned is probably implemented in packages like robfilter, more info can be found in the Decomposition and Filtering section of the task view.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
I'm interesting in evolutionary algorithms. I have tested genetic algorithms with R but has someone tried with genetic programming? Do you know, if there are code somewhere written in R.
I'm not aware of anything on CRAN for genetic programming in particular, although there is some work being done on the problem. In particular, have a look at the RGP package that is still in development.
Otherwise, have a look at the RFreak package, which is a wrapper for the "Free Evolutionary Algorithm Kit".
You might want to have a look at genalg, at GA and at galgo
There is a new package available:gramEvol: Grammatical Evolution for R
A native R implementation of grammatical evolution (GE). GE
facilitates the discovery of programs that can achieve a desired goal.
This is done by performing an evolutionary optimisation over a
population of R expressions generated via a user-defined context-free
grammar (CFG) and cost function.
You can find the vignette here:Grammatical Evolution: A Tutorial using gramEvol
UPDATE: I posted an article on my blog about it:
Symbolic Regression, Genetic Programming… or if Kepler had R.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
I needed an application for solving linear systems of equations (N up to 10), so I got different codes, and compile them, and they seem to work, but I get lots of problems with precision. I mean, the solvers are really very sensitive to small changes of the system.
So, could somebody recommend to me a reliable commandl ine application for this purpose? Or some useful open source code (and easy to compile)
Thanks
GNU Octave is essentially a free version of Matlab (the syntax is identical for basic operations), so you can try things out there and see how they compare to the answers that you're getting.
Having said that, if your answer is very sensitive to the input, it's possible that your problem is ill-conditioned - you can check this by computing the condition number of the matrix in Octave. It's hard to say what to do in that case without knowing more specifics on the problem.
Also, you don't mention which method you're currently using. Gaussian elimination (i.e. "what you learned in math class") is notoriously numerically unstable if you don't use pivoting (see the wikipedia entry for "Pivoting"); adding that might be enough to improve the quality of the results.
An approach is to use the numpy package in Python. You can create a 2d matrix A and a 1d vector b, then solve Ax=b for x using solve(A, x). It's part of the linalg subpackage of numpy.