similar to: Help with Matrix package

Displaying 20 results from an estimated 4000 matches similar to: "Help with Matrix package"

2004 Sep 28
2
S4 method selection based on second argument
I'm translating some Matlab code and need some help figuring out how to change this call into an S4 generic method. In matlab, there's a function called 'repmat' with three calling sequences (all I have to deal with anyway): 1) B = repmat(A, m, n) 2) B = repmat(A, [m n]) 3) B = repmat(A, n) In all cases, A is the fill value, m is number of rows, and n is number of
2006 May 29
2
Analog to matlab repmat function
Hello, I'm trying to switch from Matlab to R-project, and having some difficulties. I make a use of multidimensional matrices. For example, I need to extract mean from one of the dimensions: % we have matrix data of size: 130 x 11 x 350 x 2 data = data - repmat(mean(data,3),[130 1 1 1]); In R project I managed to do that in a very pervarsive way: # mean(data,3) in R base <-
2009 Feb 05
2
Non-linear optimisation
Hi there, I have a piece of Matlab code I use to optimise a trding strategy. If there are any Matlab/R specialists out there, I would appreciate your help in doing the exact same optimisation in R. I suspect I would use nlm() in R but am not sure where to define my constraints. I have attached my Matlab code below for reference. Many thanks. Constraints function [c,ceq]=TriskellConstraints(X)
2011 Nov 02
4
array manipulation
Hello, I'm at the very beginning of the learning process of this language. Sorry in advance for the (possible but plausible) stupidity of my question. I would like to find a way to permute the DIMENSIONS of an array. Something that sounds like the function "permute()" in matlab. Given an array C of dimensions c x d x T , for instance, the command permute(C, [2 1 3]) would provide
2003 Feb 25
3
cat in windows vs linux
Hi all, Easy question for you (which I failed to find the answer to in the FAQ etc). I've recently been forced to switch from linux to windows (currently windows NT), and my usual habit of putting lots of "cat" statements in slow functions to get an idea of the progress rate is no longer useful. Why -- because R waits until the function is completely finished before printing the cat
2002 Jan 03
6
Graphical representation of a matrix ?
Hi, The function Repmat under S allows to represent a matrix of data. Is there an equivalent function under R ? thanks for your reply Bruno -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not
2009 Feb 23
1
trade-off between speed and storage in matrix multiplications
Dear R-users, I coded two equivalent ways to perform (in a simplified version) some matrix multiplications I would like to use in a more general framework. In the first case I used Kronecker product and vectorization of a certain matrix. This approach takes less time, but, as you may guess, I run out of memory when dimensions are large. In the second approach, I profited of sparseness and
2003 Mar 06
2
anova subhypotheses
Hello all, A really noddy question for you all: I''m trying without success to do some subhypothesis testing. Using simple anova model, with a toy dataset from a book. I have four factors A,B,C,D, and wish to test mu_C = mu_D. This is what I have tried: > contrasts(infants$group,how.many=1) <- c(0,0,1,-1) > contrasts(infants$group) [,1] A 0 B 0 C 1
2007 May 07
1
looking for equivalent of matlab's medfilt1 function
Dear all, I have several files with Matlab code, which I am translating to R. For the zero-level approach, I took the very old shell script from R-help archives, which has made some obvious leg-work such as replacement of "=" with "<-". Now I am translating indexing, matrix operations and function call using this table http://37mm.no/mpy/octave-r.html The problem is, I
2001 Jul 10
0
speeding up aperm/ adding repmat
Hi, I have noticed that aperm is very slow, and I wondered if there was a way of speeding it up. Let me tell you a bit about the context of my problem, because perhaps I shouldn't be using aperm at all. The context is probabilistic inference in graphical models. One of the most fundamental operations is two compute an element-wise multiplication of two arrays of different sizes, say A and B.
2010 Jan 11
2
sparseM and kronecker product_R latest version
Dear all, I just installed the new version of R, 2.10.1, and I am currently using the package sparseM. (I also use a 64 bit windows version) I got a problem that I never had: when I try to multiply with a kronecker product (%x%) two sparse matrixes I get the following message: Error in dim(x) <- length(x) : invalid first argument I never had this problem with previous versions of R. May
2013 Feb 23
1
how to calculate left kronecker product?
For an application, I have formulas defined in terms of a left Kronecker product of matrices, A,B, meaning A \otimes_L B = {A * B[i,j]} -- matrix on the left multiplies each element on the right. The standard kronecker() function is the right Kronecker product, A \otimes_R B = {A[i,j] * B} -- matrix on the right multiplies each element on the left. The example below shows the result of
2005 Dec 08
1
kronecker(... , make.dimnames=TRUE)
Hi I'm using kronecker() with a matrix and a vector. I'm interested in the column names that kronecker() returns: > a <- matrix(1:9,3,3) > rownames(a) <- letters[1:3] > colnames(a) <- LETTERS[1:3] > b <- c(x=1,y=2) > kronecker(a,b,make.dimnames=TRUE) A: B: C: a:x 1 4 7 a:y 2 8 14 b:x 2 5 8 b:y 4 10 16 c:x 3 6 9 c:y 6 12 18 > The
2010 Nov 25
1
Request: kronecker to get a sep= argument
kronecker, with make.dimnames=TRUE uses a hardwired sep=":" in the line tmp <- outer(dnx[[i]], dny[[i]], FUN = "paste", sep = ":") For an application in which dimnames arise from an n-way array, where different dimensions have different roles, and I would like to be able to use kronecker in the form kronecker(A, B, make.dimnames=TRUE,
2012 Feb 09
1
Row-wise kronecker product with Matrix package
I'm trying to calculate the row-wise kronecker product A \Box B of two sparse matrices A and B, and am struggling to find a quick way to do this that takes advantage of sparseness. I thought a good idea would be to use "rep" to construct 2 matrices of the same dimension of the end product, and multiply these two together: library(Matrix) A<-Matrix(c(1,0,0,0,0,1,2,0), 2, 4)
2012 Jun 09
2
Matrix package loading problem "Error : object ‘kronecker’ is not exported by 'namespace:methods'"
Hi R users all , I have a clean install of R-2.15.0 in a win32 machine and a problem loading Matrix 1.0-6 that looks like this: > library(Matrix) Loading required package: lattice Error : object ?kronecker? is not exported by 'namespace:methods' Error: package/namespace load failed for ?Matrix? > I understand that kronecker() now has an S4 generic in package methods. Is that a
2004 Sep 21
1
lda predict
Dear R-helpers, I have a model created by lda, and I would like to use this model to make predictions for new or old data. The catch is, I want to do this without using the "predict" function, i.e. only using information directly from the foo.lda object to create my posterior probabilities. In anticipation of likely responses, I will be brushing up my lda knowledge using the
2009 May 30
1
Spatiotemporal correlation function
Hi, I'm trying to compute  the spatiotemporal correlation matrix by using Delta Kronecker products of spatial and temporal correlation matrix  in R, but didn't find any delta Kronecker's operator in R. The operators in matrix such as multiplication, addition, eigen values/vector and etc is easily to find and used. Could someone help me, please? Cheers. Firdaus
2012 Nov 30
1
Fw: quantreg installation and conflicts with R 2.15.2
Just noticed that I get a similar error about object 'kronecker' in "Matrix" package when trying to load "lme4". So this is a more pervasive problem. Brian Brian S. Cade, PhD U. S. Geological Survey Fort Collins Science Center 2150 Centre Ave., Bldg. C Fort Collins, CO 80526-8818 email: brian_cade@usgs.gov tel: 970 226-9326 ----- Forwarded by Brian S
2011 Jun 05
2
kronecker sum
Dear All, Could someone please suggest how to find the Kronecker sum of two 2x2 matrices, i.e. given two matrices: -A A a -a and -B B b -b I need: -A-B A B 0 a -a-B 0 B b 0 -A-b A 0 b a -a-b Many thanks, Lara [[alternative HTML version deleted]]