Displaying 20 results from an estimated 4000 matches similar to: "centering matrix"
2011 Aug 24
3
Efficient way to Calculate the squared distances for a set of vectors to a fixed vector
I am pretty new to R. So this may be an easy question for most of you.
?
I would like to calculate the squared distances of a large set (let's say 20000) of vectors (let's say dimension of 5) to a fixed vector.
?
Say I have a data frame MY_VECTORS with 20000 rows and 5 columns, and one 5x1 vector y. I would like to efficiently calculate the squared distances?between each of the 20000
2011 Aug 16
2
generalized inverse using matinv (Design)
i am trying to use matinv from the Design package
to compute the generalized inverse of the normal equations
of a 3x3 design via the sweep operator.
That is, for the linear model
y = ? + x1 + x2 + x1*x2
where x1, x2 are 3-level factors and dummy coding is being used
the matrix to be inverted is
X'X =
9 3 3 3 3 3 3 1 1 1 1 1 1 1 1 1
3 3 0 0 1 1 1 1 0 0 1 0 0 1 0 0
3 0 3 0 1 1 1 0 1 0 0 1
2013 Nov 12
1
using scan function
Hi,
You may try:
op <- options(digits=12)
r1 <- 4; c1 <- 4
?A <- matrix(scan("file1.txt",n=r1*c1),r1,c1,byrow=TRUE)
options(op) #reset
A.K.
Dear all,
I?m using 'scan' function to import data into a matrix from a .txt
file. The data are numbers with 12 significant digits (e.g.
471773.309872). ?
When I give the command:
A <- matrix(scan(file_name,
2013 May 21
1
keep the centre fixed in K-means clustering
Dear R users
I have the matrix of the centres of some clusters, e.g. 20 clusters each
with 100 dimentions, so this matrix contains 20 rows * 100 columns numeric
values.
I have collected new data (each with 100 numeric values) and would like to
keep the above 20 centres fixed/'unmoved' whilst just see how my new data
fit in this grouping system, e.g. if the data is close to cluster 1
2010 Oct 19
4
Problem while installing passenger for apache
Hi,
I am trying to install passenger 3.0 for apache2 on Ubuntu 10.10.
It says that I need to install libopenssl-ruby.
But when I did ''sudo apt-get install libopenssl-ruby'', I got the
following error.
Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting ''libruby'' instead of
2009 Apr 20
2
About Asterisk 1.6 web GUI
Hi,
I had some experience on Asterisk 1.0.7 and 1.2.0.
Now, I want to do something on the New Release of Asterisk 1.6.xx.
I want to know wheather there are already web GUI for use now in the
release.
Or still nedd integrate some other third part GUI?
Any advice will be appreciated.
Thanks ahead,
Best Regards,
Gary
-------------- next part --------------
An HTML attachment
2011 Aug 11
2
Removing all duplicate row except by one
Hi,
It's my problem, supppose that we have a data.frame:
t
a b c
1 1 1 1
2 0 1 1
3 1 1 1
4 0 0 0
5 1 0 1
6 0 1 0
7 1 1 1
8 0 1 0
I need extract duplicat row i.e i nedd frame like this
a b c
3 1 1 1
8 0 1 0
I try use subset(t, duplicated(t)) and t[duplicated(t), ] but this command
return
a b c
3 1 1 1
7 1 1 1
8 0 1 0
Best
Marcin M.
--
View this message in context:
2012 Feb 17
2
lmer - error message
Hi all,
I am fairly new to mixed effects models and lmer, so bear with me.
Here is a subset of my data, which includes a binary variable (lake (TOM or
JAN)), one other fixed factor (Age) and a random factor (Year).
lake FishID Age Increment Year
1 TOM 1 1 0.304 2007
2 TOM 1 2 0.148 2008
3 TOM 1 3 0.119 2009
4 TOM 1 4 0.053 2010
5
2008 Feb 26
2
Summing up diagonals w/o for-loop
? stato filtrato un testo allegato il cui set di caratteri non era
indicato...
Nome: non disponibile
Url: https://stat.ethz.ch/pipermail/r-help/attachments/20080226/43b3a38b/attachment.pl
2010 Apr 27
2
Connect 2 asterisks servers
Hi!
I need some help
Well i have this cenario:
1 ip04 running asterisk [A]
1 pc running asterisk [B]
I nedd to make calls from A to B, and B to A. Via sip
The A-B calls are working. Now I need to configure the dial plan to call B-A
either to sip numbers and Fxs.
Anyone can help me?
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
2013 Jan 18
1
Error in mer_finalize(ans) : Downdated X'X is not positive definite, 8.
Dear All,
I have conducted an experiment in order to examine predation pressure in the
surroundings of potential wildlife road-crossing structures. I have
documented predation occurrence (binary?) in these structures and calculated
several possible explanatory variables describing the spatial heterogeneity
in several scales. At the landscape scale I have calculated the percentage
of different
2004 Jan 12
1
question about how summary.lm works
Hi,
While exploring how summary.lm generated its output I came across a section
that left me puzzled.
at around line 57
R <- chol2inv(Qr$qr[p1, p1, drop = FALSE])
se <- sqrt(diag(R) * resvar)
I'm hoping somebody could explain the logic of these to steps or
alternatively point me in the direction of a text that will explain these
steps.
In particular I'm puzzled
2000 Mar 20
3
lm handling of ill-conditioned systems
The lm() function in R seems to handle the inversion of singular X'X matrices
(where there is collinearity between regression inputs) in a way
where one of the inputs is dropped and this also seems to be the
default behavior in SAS (please let me know if i'm wrong about this).
In some other packages (i.e. octave ols() function) the pseudo
inverse is computed where singular values less
2013 Jan 27
2
Loops
Dear Contributors,
I am asking help on the way how to solve a problem related to loops for
that I always get confused with.
I would like to perform the following procedure in a compact way.
Consider that p is a matrix composed of 100 rows and three columns. I need
to calculate the sum over some rows of each
column separately, as follows:
fa1<-(colSums(p[1:25,]))
fa2<-(colSums(p[26:50,]))
2010 Nov 28
4
how to divide each column in a matrix by its colSums?
Hi,
I have a matrix, say
m=matrix(c(
983,679,134,
383,416,84,
2892,2625,570
),nrow=3
)
i can find its row/col sum by
rowSums(m)
colSums(m)
How do I divide each row/column by its rowSum/colSums and still return in
the matrix form?
(i.e. the new rowSums/colSums =1)
Thanks.
Casper
--
View this message in context:
2009 Dec 04
5
logical masking of a matrix converts it to a vector
One problem I've been having is the special case in which only one
row/column remains and the variable gets converted into a vector when
entries are removed by logical masking. This is a problem because subsequent
code may rely on matrix operations (apply, colsums, dim, etc) For example:
> a <- matrix(c(1, 2, 3, 4), nrow = 2)
> a
[,1] [,2]
[1,] 1 3
[2,] 2 4
>
2008 Mar 07
4
Warning: matrix by vector division
Dear list,
I just made a very simple mistake, but it was hard to spot. And I
think that I should warn other people, because it is probably so
simple to make...
=== R code ===
# Let us create a matrix:
(a <- cbind(c(0,1,1), rep(1,3)))
# [,1] [,2]
# [1,] 0 1
# [2,] 1 1
# [3,] 1 1
# That is a MISTAKE:
a/colSums(a)
# [,1] [,2]
# [1,] 0.0000000 0.3333333
2012 Jul 12
3
Add row into a Matrix witout headers from Function
Hi,
Here i have a matrix like this,
OLDMatrix <-
X1 X2 X3
----- ------ ------
22 24 23
25 27 27
10 13 15
the thing is,
im running two function(SUM,COUNT) to get output in another matrix called
NEWMatrix
NEWMatrix <- c("SUM",colSums(OLDMatrix ))
NEWMatrix <- c("COUNT",colSums(!is.na(OLDMatrix
2008 Feb 29
4
Column sums from a data frame (without the headers)
Does anyone know how to get a vector of column sum from a data frame?
You can use colSums(), but this gives you a object of type "numeric"
with the column labels in the first row, and the sums in the second
row. I just want a vector of the sums, and I can't figure out a way
to index the "numeric" object.
Thanks!
2005 Aug 18
1
Error messages using LMER
Dear All,
After playing with lmer for couple of days, I have to say that I am
amazed! I've been using quite some multilevel/mixed modeling packages,
lme4 is a strong candidate for the overall winner, especially for
multilevel generzlized linear models.
Now go back to my two-level poisson model with cross-classified model.
I've been testing various different model specificatios for the