Displaying 20 results from an estimated 10000 matches similar to: "Matrix Multiplication"
2003 Aug 12
3
Sorting a dataframe
Undoubtedly a simple question:
I've looked at order() and sort() in the help pages for
R1.7.1. It doesn't appear that these functions are immediately
suited to doing the same thing as
PROC SORT DATA = BLAH;
BY X Y Z;
RUN;
in SAS. I have also checked Frank Harrell's Hmisc library.
Could someone point me in the right direction so I can sort
by the levels of Z within the levels of
2010 May 08
1
matrix cross product in R different from cross product in Matlab
Hi all,
I have been searching all sorts of documentation, reference cards, cheat
sheets but can't find why R's
crossprod(A, B) which is identical to A%*%B
does not produce the same as Matlabs
cross(A, B)
Supposedly both calculate the cross product, and say so, or where do I
go wrong?
R is only doing sums in the crossprod however, as indicated by
(z <- crossprod(1:4)) # = sum(1 +
2003 Apr 23
3
regression parms var-cov matrix
Win2k, R1.6.2.
I've been using Splus 6.1 and wanted to try the same
regression analysis in R. Using "names( blah.lm )"
in R yields
[1] "coefficients" "residuals" "effects" "rank"
[5] "fitted.values" "assign" "qr" "df.residual"
[9] "xlevels"
2016 Sep 16
2
Numerical accuracy of matrix multiplication
Hello,
while testing the crossprod() function under Linux, I noticed the following:
set.seed(883)
x <- rnorm(100)
x %*% x - sum(x^2) # equal to 1.421085e-14
Is this difference normal? It seems to be rather large for double precision.
Regards,
Alexis.
[[alternative HTML version deleted]]
2015 Mar 19
6
RFC: Matrix package: Matrix products (%*%, crossprod, tcrossprod) involving "nsparseMatrix" aka sparse pattern matrices
This is a Request For Comment, also BCCed to 390 package maintainers
of reverse dependencies of the Matrix package.
Most users and package authors working with our 'Matrix' package will
be using it for numerical computations, and so will be using
"dMatrix" (d : double precision) matrix objects M, and indirectly, e.g., for
M >= c will also use "lMatrix" (l:
2016 Sep 20
2
Numerical accuracy of matrix multiplication
>>>>> peter dalgaard <pdalgd at gmail.com>
>>>>> on Fri, 16 Sep 2016 13:33:11 +0200 writes:
> On 16 Sep 2016, at 12:41 , Alexis Sarda <alexis.sarda at gmail.com> wrote:
>> Hello,
>>
>> while testing the crossprod() function under Linux, I noticed the following:
>>
>> set.seed(883)
2005 Jan 27
3
the incredible lightness of crossprod
The following is at least as much out of intellectual curiosity
as for practical reasons.
On reviewing some code written by novices to R, I came
across:
crossprod(x, y)[1,1]
I thought, "That isn't a very S way of saying that, I wonder
what the penalty is for using 'crossprod'." To my surprise the
penalty was substantially negative. Handily the client had S-PLUS
as
2004 Feb 11
3
RGui (Windows) crashes after use of a Salford Fortran DLL
Anybody out there successfully using the Salford Fortran compilers
with R?
I have created a DLL using the Salford FTN95 compiler and it works
in as far I can dyn.load it, run the routines and get the right
answers back. Unfortunately subsequently, sometime later, the
Rgui crashes (access violation I think from the DrWatson log). The
crashes depend on whether or not I paste the code as one
2011 Nov 12
1
Use of Matrix within packages in R-2.14.0
Dear R-devel readers:
I am really stuck trying resolving an issue with the use of the
Matrix in one of my packages, irlba, with R-2.14.0. When I use
crossprod with at least one sparse argument in the packaged code I
receive the error:
Error in crossprod(x, y) :
requires numeric/complex matrix/vector arguments
However, when I run the code outside of the context of the package it
works fine.
2003 Sep 04
7
Comparison of SAS & R/Splus
I am one of only 5 or 6 people in my organization making the
effort to include R/Splus as an analysis tool in everyday work -
the rest of my colleagues use SAS exclusively.
Today, one of them made the assertion that he believes the
numerical algorithms in SAS are superior to those in Splus
and R -- ie, optimization routines are faster in SAS, the SAS
Institute has teams of excellent numerical
2004 Jan 09
2
strange behaviour when converting from char to POSIX (PR#6422)
Full_Name: Christoph Schmutz, MeteoSchweiz, Switzerland
Version: R1.7.1, R1.8.1
OS: windows2000, solaris sunOS 5.8
Submission from: (NULL) (141.249.133.6)
I'm not sure if I don't get the clue, but please consider this:
> strptime("19930870150","%Y%j%H%M")
[1] "1993-03-28 01:50:00"
> strptime("19930870250","%Y%j%H%M")
[1]
2016 Sep 20
0
Numerical accuracy of matrix multiplication
>>>>> Alexis Sarda <alexis.sarda at gmail.com>
>>>>> on Tue, 20 Sep 2016 17:33:49 +0200 writes:
> I just realized that I was actually using a different random number
> generator, could that be a valid reason for the discrepancy?
> The code should be:
> RNGkind("L'Ecuyer")
> set.seed(883)
> x <-
2004 Oct 06
3
crossprod vs %*% timing
Hi
the manpage says that crossprod(x,y) is formally equivalent to, but
faster than, the call 't(x) %*% y'.
I have a vector 'a' and a matrix 'A', and need to evaluate 't(a) %*% A
%*% a' many many times, and performance is becoming crucial. With
f1 <- function(a,X){ ignore <- t(a) %*% X %*% a }
f2 <- function(a,X){ ignore <-
2003 Oct 17
2
Problems with crossprod
Dear R-users,
I found a strange problem
working with products of two matrices, say:
a <- A[i, ] ; crossprod(a)
where i is a set of integers selecting rows. When i is empty
the result is in a sense random.
After some trials the right answer
(a matrix of zeros) appears.
--------------- Illustration --------------------
R : Copyright 2003, The R Development Core Team
Version 1.8.0
2015 Mar 20
0
RFC: Matrix package: Matrix products (%*%, crossprod, tcrossprod) involving "nsparseMatrix" aka sparse pattern matrices
Hi Martin,
package arules heavily relies on ngCMatrix and uses multiplication and
addition for logical operations. I think it makes sense that in a mixed
operation with one dgCMatrix and one ngCMatrix the ngCMatrix should be
"promoted" to a dgCMatrix.
The current behavior of %*% and friends is in deed confusing:
> m <- matrix(sample(c(0,1), 5*5, replace=TRUE), nrow=5)
>
2006 Jun 09
1
X'W in Matrix
Hi!
I have used the Matrix package (Version: 0.995-10) successfully
to obtain the OLS solution for a problem where the design matrix X is
44000x6000. X is very sparse (about 80000 non-zeros elements).
Now I want to do WLS: (X'WX)^-1X'Wy
I tried W=Diagonal(length(w),w) and
wX=solve(X,W)
but after various minutes R gives a not enough
memory error (Im using a 64bit machine with 16Gigs
2015 Mar 19
0
RFC: Matrix package: Matrix products (%*%, crossprod, tcrossprod) involving "nsparseMatrix" aka sparse pattern matrices
Hi Martin
I got stung by this last week.
glmnet produces a coefficient matrix of class ?dgCMatrix?
If a predictor matrix was created using sparseMatrix as follows,
one gets unexpected results, as this simple example shows.
My fix was easy (I always convert the predictor matrix to class ?dgCMatrix? now)
Trevor
> y=Matrix(diag(4))
> y
4 x 4 diagonal matrix of class "ddiMatrix"
2010 Mar 27
1
R runs in a usual way, but simulations are not performed
Dear addresses, I need perform a batch of 10 000 simulations for each of
4 options considered. (The idea is to obtain the parameter estimates in
a heteroskedastic linear regression model - with additive or mixed
heteroskedasticity - via the Kenward-Roger small-sample adjusted
covariance matrix of disturbances). For this purpose I wrote an R
program which would capture all possible options (true
2010 Dec 04
1
Quadratic programming with semi-definite matrix
Hello.
I'm trying to solve a quadratic programming problem of the form min
||Hx - y||^2 s.t. x >= 0 and x <= t using solve.QP in the quadprog
package but I'm having problems with Dmat not being positive definite,
which is kinda okay since I expect it to be numerically semi-definite
in most cases. As far as I'm aware the problem arises because the
Goldfarb and Idnani method first
2003 Apr 17
18
Validation of R
Hi All
I am really very interested in starting to use R within our company. I
particularly like the open source nature of the product. My company is a
medical research company which is part of the University of London.
We conduct contract virology research for large pharma companies. My
question is how do we validate this software? I wonder if anyone else
has had the problem and might be able to