Questions tagged [r]

R is a language and environment for statistical computing and graphics that provides a wide variety of statistical (linear and nonlinear modelling, classical statistical tests, time-series analysis, classification, clustering, ...) and graphical techniques and is highly extensible. (Questions about problems and bugs encountered when using R belong on the R-help mailing list (https://stat.ethz.ch/mailman/listinfo/r-help).)

Filter by
Sorted by
Tagged with
0 votes
0 answers
13 views

Simulating a dataset from model output when model includes multiple binary deviation-coded variables

I am trying to simulate data using parameters from a glmer() model output. The model, which comes from a published paper, is as follows: DV ~ 1 + group* sex *verb type + trial number + (1 |participant)...
HungryHippo's user avatar
0 votes
0 answers
27 views

Doubt of wavelets about the return of comand plot() of package Wavethresh in R language

I take a plot of father wavelet with this code library(wavethresh) y <- c(1,1,7,9,2,8,8,6) ywd <- wd(y, filter.number=1, family='DaubExPhase') plot(ywd) But ...
Siqueira's user avatar
0 votes
0 answers
105 views

How can I plot Haar Wavelet Approximation in R?

I was trying to replicate the graphics in figure below using the package wavethresh in R. This figure can be found in the book: Wavelet Methods in Statistcs with R, G.P. Nason, pg. 30. The data used ...
Siqueira's user avatar
0 votes
0 answers
42 views

Numerical Method for Multivariate Inversion Formula

For my research, I need to evaluate the density of a random vector $\boldsymbol{X} \in \mathbb{R}^p$ using the multivariate inversion formula. Let the density function of $\boldsymbol{X}$ be $f (\...
little_sky's user avatar
0 votes
1 answer
163 views

Solve discontinuous ODE with lsode

I am trying to solve a discontinuous ODE using the lsode solver. I tried setting the t_crit parameter to specify the time where the discontinuity is present, but it ...
Bruno's user avatar
  • 101
-1 votes
1 answer
606 views

How to initialize Eigen C++ parameters within for-loop? [closed]

I am new to Eigen C++ programming. I am trying to create an Rcpp function to call from R. The function takes a list of matrices (Xlst), and two lists of vectors (ylst and smwlst). In each for-loop ...
Shakil's user avatar
  • 1
0 votes
0 answers
68 views

Getting gradient from voxel, is it possible and how?

The R package rmarchingcubes implements a marching cubes algorithm. Given a voxel contructed from a function defining an isosurface, it returns a 3d mesh with some vertex normals. When I plot this ...
Stéphane Laurent's user avatar
-1 votes
1 answer
44 views

Finding matrix of a linear transformation using R programing

The full question is: Let {u1, u2,···, un} and {x1, x2,···, xm} be bases for Rn and Rm respectively. Let T:Rn→Rm be the linear transformation whose associated matrix with respect to the above bases is ...
veronica frost's user avatar
1 vote
0 answers
247 views

Efficient multidimensional numerical integration in R and C++

I'm trying to perform a 4-dimensional numerical integration in R using a function I wrote in C++ code which is then sourced in <...
CafféSospeso's user avatar
13 votes
3 answers
6k views

How are scientific computing workflows faring on Apple's M1 hardware

The initial wave of reviews for Apple's M1 hardware are out, and there's lots of generic benchmarks and data on workflows on professional programs for creative users, but I haven't seen anyone talking ...
Fomite's user avatar
  • 2,383
0 votes
3 answers
153 views

Problem of half-planes intersection

Consider the half-planes $\{x \leqslant 2\}$ and $\{x+y \leqslant 3\}$. These two half-planes are coded with the R package 'rcdd' as follows: ...
Stéphane Laurent's user avatar
1 vote
2 answers
330 views

(Lack of) Availability of Finite-Difference library for simple 2D PDEs

I would like to solve two types of simple 2D problems, namely the stationary heat equation on an L shaped geometry like this: And also compute the magnetostactic field in an air gap of the following ...
Ken Grimes's user avatar
0 votes
0 answers
48 views

How to solve for underlying function from discrete data set containing integral of that function

New to Computational Science, I hope I'm on the right exchange network for this question. I have a time series data set that contains the sum of a source data set representing an exponential decay ...
jeromeResearch's user avatar
2 votes
0 answers
328 views

2-dimensional Gauss-Hermite quadrature in R

A similar question was asked here and the given answer is perfect for a unidimensional integration. I need to make bidimensional integration in R with a Gauss-Hermite quadrature: $$\int_{R^2} h(p1,p2)...
Flora Grappelli's user avatar
3 votes
1 answer
423 views

Solving an SDE with time-dependent parameter in R

I am trying to solve a system of SDEs in R using the Diffeqr package. Let's reduce the system to a simple ODE: ...
user213544's user avatar
1 vote
0 answers
197 views

How to compute the following Crank-Nicolson scheme for the viscous Burgers' Equation?

I am attempting to replicate results from this article. I'm not sure why but my results are completely different and wrong. For example, the exact solution with parameters ($x=0.1$, $T=0.01$, $Re=0....
mathnoob's user avatar
1 vote
1 answer
80 views

Draw contour line to represent multiple contours

I have 5 data sets, each includes multiple scatter points. If I use the geom_path function in R, I could obtain 5 contours like the following graph shows. Those five contours are annotated outlines ...
HAOYANG MI's user avatar
3 votes
1 answer
253 views

Numerical solving Lotka-Volterra ODE in R

Aim: I am trying to numerically solve a Lotka-Volterra ODE in R, using de sde.sim() function in the sde package. I would like to use the ...
user213544's user avatar
0 votes
1 answer
199 views

R function or package for carrying out maximum likelihood techniques in random effect models

I am applying optim() function in R to obtain maximum likelihood estimates of the fixed effects and random effects in a model with bivariate random effects. The ...
T Richard's user avatar
  • 101
0 votes
2 answers
2k views

reading and processing large GRIB files

I'm trying to convert and process GrADS (grib) files into netcdf files. The files have values every 3 hours (2890 per year), 12 z levels, 120 variables, 241 columns and 236 rows. The data is almost 80 ...
Guillermo.D's user avatar
5 votes
2 answers
293 views

Recommended language/environment for large scale semi-continuous biological models

We have a fairly large (maybe 1000 equations) differential-algebraic equation model written in ACSLX, an obsolete modelling environment similar to Modelica. The model represents the evolution of a ...
Simon Woodward's user avatar
2 votes
1 answer
1k views

The difference between mkl_intel_lp64 vs mkl_gf_lp64 in a numerical reproducibility issue with Intel MKL

It has been discussed that Intel MKL can exhibit irreproducible behavior under certain conditions. In fact, this is a known thing and described by Intel as Conditional Numerical Reproducibility. A ...
xeroqu's user avatar
  • 143
1 vote
0 answers
240 views

Is there a FEM package for R

I am looking for a R package that performs finite element analysis. Is there a fenics or equivalent FEM package for R?
Graham G's user avatar
  • 111
0 votes
1 answer
174 views

Sparse matrix inverse with reduced bandwidth

I have a sparse symmetric matrix of dimension 1393x1393 (8308 no zero elements), with bandwidth 1380. By Cuthill–McKee algorithm, I could achieve a new matrix with ...
Jiang Du's user avatar
1 vote
0 answers
598 views

Pseudoinverse of a large sparse matrix in r

This question was moved from Cross-Validated: https://stats.stackexchange.com/questions/274042/pseudoinverse-of-large-sparse-matrix-in-r I am trying to calculate the pseudoinverse of a large sparse ...
Paul's user avatar
  • 111
2 votes
1 answer
77 views

How to invert a lagrangian polynomial

I'm reading the following paper (Grezlak and Oosterlee) and I have a specific question to a sentence on page 5. I quote: "Since the mapping $y=g(x)$ is bijective and $g(x)$ is strictly increasing,...
math's user avatar
  • 101
1 vote
2 answers
2k views

efficient way to compute lagrange polynomials

For two given vectors, not necessairly the same length, $x=(x_1,\dots,x_N)$ and $s=(s_1,\dots,s_M)$ I would like to compute the following term as efficiently as possible in R. For $j=1, \dots, N$ $$ ...
math's user avatar
  • 101
8 votes
0 answers
176 views

Tucker factorisation to compare multiple PCA decompositions?

This is an entry-level question for multiway matrix decompositions. I have a set/population $k$ of entities (here biological cells) for each of which I also have a number ($l$) of flavours of length $...
drw's user avatar
  • 203
1 vote
0 answers
168 views

Problem in using N-BFGS-B in optim

I am a beginner user of R. I am trying to maximize log likelihood function with the bounded parameters. The function is a kind of gamma mixture model which try to ...
S Kim's user avatar
  • 11
5 votes
0 answers
179 views

Difference of convex functions optimization problem in R

I am seeking of any already written R package which could help in an optimization technique which is called Difference of convex functions. This technique is sketched here and could be very useful ...
xolodec's user avatar
  • 151
5 votes
3 answers
2k views

matrix storage, many rows or many columns?

tl;dr Should I store a matrix of Nx3 elements row-wise or column-wise, if I'm going to access 3 elements at a time? Does it matter? I'm setting up a numerical simulation with matrices of x,y,z ...
baptiste's user avatar
  • 223
1 vote
0 answers
875 views

How to adjust scikit-learn FactorAnalysis() settings to get scores output similar to one from factanal() in R?

I'm new to factor analysis and I need to compute factor scores using Python. I have R code to compute scores and I want to ...
SS_Rebelious's user avatar
0 votes
4 answers
2k views

Easiest Way to Begin GPU Computing

What is the the simplest way to get started using GPU computing? My interests are primarily in neural networks and I would love to start using GPUs, but my time for learning GPU computing is very ...
Adam12344's user avatar
  • 101
2 votes
1 answer
532 views

Monte Carlo Double Integration Implementation

Am implementing a monte carlo integration routine to compute this double integral in eqn 0.3 of page 2 of this paper 'Mobius energy of knots and unknots', Annals of Mathematics, http://www.math.ucsb....
hearse's user avatar
  • 259
2 votes
3 answers
3k views

Is my Restricted (Natural) Cubic Spline equation wrong?

I am trying to fit a restricted cubic spline (natural cubic spline) with 4 knots to toy data, attempting to follow Hastie, Tibshirani, Friedman 2nd ed. 5.2.1 p.144-146, Eqs 5.4 and 5.5. Data: Is ...
user242023's user avatar
1 vote
1 answer
129 views

How we can implement the result of maximum principle in our numerical optimization algorithm?

I have an algorithm (in R) that maximizes a convex function on a compact convex set in every iteration. Based on the maximum principle, I know that the maximima are only attained on the boundary. But ...
Ehsan's user avatar
  • 21
1 vote
0 answers
109 views

Package for integration over non-rectangular region

I want to compute the expected value of a multivariate function f(x) wrt to dirichlet distribution. My problem is "penta-nomial" (i.e 5 variables) so calculating ...
Bob's user avatar
  • 111
4 votes
1 answer
4k views

Is R or Matlab currently faster?

The most up-to-date performance benchmarks comparison between R and Matlab that I could find are several years out of date: 1 2 Is anyone aware of a more up-to-date comparison?
Dylan Richard Muir's user avatar
0 votes
2 answers
949 views

What is "SOLVER" in R and Statistics/Analytics?

I tried to research what exactly is a SOLVER only to find a not clear-cut simple answer. My doubts still remain after going through several sites full of discussions about it. I need to clarify as to ...
Code Man's user avatar
0 votes
1 answer
61 views

Signal balancing using SVD: notations and implementation in R

Hibbs et. al use SVD to balance the strength of different underlying signals in gene expression data using the following decomposition: $X_{m*n} = U_{m*n} \Sigma_{n*n} V^T_{n*n}$ In this case $U$ ...
Michael Schubert's user avatar
2 votes
1 answer
3k views

How do I simultaneously minimize two different functions who have the same inputs?

I want to minimize two different functions simultaneously who have the same inputs. The functions are both linear and non-exponential. $$F_1(X_1, X_2) = a_1X_1 + a_2X_2$$ $$F_2(X_1, X_2) = b_1X_1 + ...
user136482's user avatar
1 vote
1 answer
2k views

computing the inverse of a large block diagonal sparse matrix in r

I would like to compute the inverse of some large block diagonal sparse matrix. The number of rows and columns is somewhat over 50,000. The blocks are 12 by 12 and are sparse (27 non zero elements). ...
user3499209's user avatar
1 vote
1 answer
180 views

what went wrong with my logistic regression implementation in c++?

I have implemented a simple logistic regression function with IRLS algorithm using the armadillo linear algebra libray ...
qed's user avatar
  • 111
2 votes
3 answers
445 views

R/C/C++ library for N-dimensional arrays

I'm looking for a library that is either in R or easily wrappable with R, that can do the following things: construct and subset N-dimensional arrays perform operations such as ...
Michael Schubert's user avatar
2 votes
1 answer
25k views

why Lapack routine dgesv doesn't solve this?

Suppose I have the following 3 by 3 matrix: p<-3 X<-matrix(1/p,p,p) --$\pmb X$ is just a $p$ by $p$ matrix where every entry is $1/p$. Now I want to solve ...
user189035's user avatar
0 votes
1 answer
307 views

How could I implement this neural network in R? [closed]

In Establishing, versus maintaining, brain function: a neurocomputational model of cortical reorganisation after injury to the immature brain, Varier et al develop a neural network model of motor ...
Flask's user avatar
  • 101
7 votes
2 answers
1k views

adaptive Gauss-Kronrod quadrature with vector-valued integrand

So I'm trying to implement a Gauss-Kronrod adaptive quadrature. That is, I want to calculate $$\int_a^b f(x) dx = \sum_i f(x_i) w_i$$ where f(x) is evaluated at multiple points at once for ...
baptiste's user avatar
  • 223
3 votes
1 answer
153 views

Constrained System / Combinatorial Problem

Let $x\in \mathbb{R}^{n}$, $Y\in \mathbb{R}^{mxn}$. We can then define: $row_{i}(Y)=$ $i^{th}$ row of $Y$ $column_{i}(Y)=$ $i^{th}$ column of $Y$ $x_{i}=i^{th}$ element of $x$ $sum(x)=$ sum of ...
Angel Eyes's user avatar
-2 votes
1 answer
79 views

R language - how to list variables in use [closed]

How can I generate a list of all the variables that have been assigned in an R language session?
user3067676's user avatar
3 votes
1 answer
385 views

LU Decomposition with memory-mapped matrices

I have a ~4.12 Tb structured relatively-sparse matrix dataset (about 8% of the matrix entries are non-zero) that i want to apply an LU decomposition, however, given the size of it, loading it in ...
lurscher's user avatar
  • 249