Folks,
Is there a way to print a matrix in tabular form onto the graphics device?
I want to create a display consisting of graphs and tables,
so that I can do something like:
windows()
opar = par(mfrow = c(3, 2))
library(plotrix)
library(PerformanceAnalytics)
radial.plot(...)
radial.plot(...)
Folks,
I have a matrix:
set.seed(123)
a <- matrix(rnorm(100), 10)
And a vector:
b <- rnorm(10)
Now, I want to switch the signs of those rows of a corresponding to
indices in b whose values exceed the 75 %-ile of b
which(b > quantile(b)[4])
[1] 2 6 10
so I want, in effect:
a[2, ] <- -a[2,
folks,
is there a better way to convert a daily series of price returns to a monthly
one than as follows:
library(xts)
a <- xts(rnorm(100) / 100, order.by = as.Date(1:100))
am <- diff(to.monthly(cumsum(a))[, 4]) # [, 4] for Close levels
the problem with this is that the entire first month of
iplication questionCC: [EMAIL PROTECTED] example ...x <- 1:5 ; y<-
6:8(m <- x %o% y) # is this what you mean by product of two
vectors?sum(m[row(m)!=col(m)]) # or ...sum(m)-sum(diag(m))
On Wed, Jul 2, 2008 at 7:30 PM, Murali Menon <[EMAIL PROTECTED]> wrote:
folks,is there a clev
folks,
is there a clever way to compute the sum of the product of two vectors such
that the common indices are not multiplied together?
i.e. if i have vectors X, Y, how can i compute
Sum (X[i] * Y[j])
i != j
where i != j
also, what if i wanted
Sum (X[i] * Y[j] * R[i, j])
i != j
w
Folks,
I have a list of correlation matrices of equities, say, and I need to
manipulate each matrix: I weight each equity by its median absolute
correlation against all the other equities, such that the equity with the
least such correlation gets the highest weight. Something like min(over
all
Folks,
I have a 3000 x 4 matrix (y), which I need to regress row-by-row against a
4-vector (x) to create a
matrix lm.y of intercepts and slopes. To illustrate:
y <- matrix(rnorm(12000), ncol = 4)
x <- c(1/12, 3/12, 6/12, 1)
system.time(lm.y <- t(apply(y, 1, function(z) lm(z ~ x)$coefficient)))
7 matches
Mail list logo