Displaying 20 results from an estimated 9000 matches similar to: "n-th power of a matrix"
2004 Dec 14
4
Several questions in R
Hi,
I have several small question in R,
1) How to display all the variables in current workspace?
2) How to write a long command in two lines. Suppose one command line is
long to be put within one line.
Thanks!
tang
2005 Aug 17
2
power of a matrix
Dear all,
I have a population with three age-classes, at time t=0 the population
is:
n.zero <- c(1,0,0)
I have a transition matrix A which denotes "fertility" and "survival":
A <- matrix(c(0,1,5, 0.3,0,0, 0,0.5,0), ncol=3, byrow=TRUE)
To obtain the population at t=1, I calculate:
A %*% n.zero
To obtain the population t=2, I calculate:
A %*% (A %*% n.zero)
... and so
2012 Feb 20
3
How to determine a subset of a binary strings?
Hi,
I need some neat ways of determing a subset of binary strings. For example,
x=c(0,0,1), y=c(0,1,1), z=c(0,1,0). So x is a subset of y and z is also a
subset of y, but x is not a subset of z.
I tried to search R functions and packages but no hits. Any ideas?
Best,
Jing
--
Jing Tang, PhD
Senior Researcher
Finnish Institute of Molecular Medicine (FIMM)
FI-00014 University of
2012 Mar 22
2
Strsplit with a separator of ||
Hi,
I tried to use strsplit for separating a string with || like
strsplit(string,"\\||") but it returned each single character was separated.
For example:
strsplit("a||bc","\\||")
[[1]]
[1] "a" "" "" "b" "c"
where I want the result to be "a" and "bc".
Any ideas?
Thanks!
Best,
2007 Nov 16
1
Efficient way to compute power of a sparse matrix
Dear all,
I would like to compute power of a square non symmetric matrix. This is
a part of a simulation study. Matrices are quite large (e.g., 900 by
900), and contains many 0 (more than 99 %). I have try the function
mtx.exp of the Biodem package:
library(Biodem)
m <- matrix(0, 900, 900)
i <- sample(1:900, 3000, replace = T)
j <- sample(1:900, 3000, replace = T)
for(x in 1:3000)
2013 Feb 06
2
The interpretation of lm(y~x)?
Hi,
I am reading the book "Mixed Effects Models in S and S-Plus" and come
across an example with the Rail data.
I tried to use lm(travel~Rail,data=Rail) and got the following result:
Call:
lm(formula = travel ~ Rail, data = Rail)
Residuals:
Min 1Q Median 3Q Max
-6.6667 -1.0000 0.1667 1.0000 6.3333
Coefficients:
Estimate Std. Error t value Pr(>|t|)
2013 Feb 08
1
Contrasts for a data
Hi,
I am using a data called Rail in the nlme package. The data contains two
variables: Rail and Travel.
>Rail
Grouped Data: travel ~ 1 | Rail
Rail travel
1 1 55
2 1 53
3 1 54
4 2 26
5 2 37
6 2 32
7 3 78
8 3 91
9 3 85
10 4 92
11 4 100
12 4 96
13 5 49
14 5 51
15 5 50
16 6 80
2012 Jan 30
1
Quantum scalar i40 tape partitions
Hi All,
I have a Quantum scalar i40 tape library. I need to configure it to TWO tape partition libraries, e.g., library_a and library_b, so that each library has its own tape drive. Then connect this physical tape library to two different CentOS servers so that each server can see its own media changer and tape drive. I once had a successful configuration on one host but NOT on the other. One
2008 Apr 27
2
Raising a matrix to the (-1/2) power.
Hi, I need to raise a correlation matrix; R; to the negative one half power.
i.e. I need to find R^(-1/2)
eg: if R=[{1,.4},{.4,1}], then R^(-1/2)=[{1.0681,-.2229},
{-.2229,1.0681}]where matrix=[{row1},{row2}]
And are there any built in functions to do this? mtx.exp doesn't work
because it's not raised to a positive integer
Thank you so much.
--
View this message in context:
2004 Nov 25
4
Avoiding for-loops
Hello R-users,
I have a symmetric matrix of numerical values and I
want to obtain those values in the upper or lower
triangle of the matrix in a vector. I tried to do the
job by using two for-loops but it doens't seem to be a
clever way, and I'd like to know a more efficient code
for a large matrix of thousands of rows and columns.
Below is my code for your reference.
Thanks a lot.
2005 Feb 23
1
H-F corr.: covariance matrix for interaction effect
Hi,
I'm still not quite there with my H-F (G-G) correction code. I have it
working for the main effects, but I just can't figure out how to do it
for the effect interactions. The thing I really don't know (and can't
find anything about) is how to calculate the covariance matrix for the
interaction between the two (or even n) main factors.
I've looked through some books
2005 Feb 23
1
H-F corr.: covariance matrix for interaction effect
Hi,
I'm still not quite there with my H-F (G-G) correction code. I have it
working for the main effects, but I just can't figure out how to do it
for the effect interactions. The thing I really don't know (and can't
find anything about) is how to calculate the covariance matrix for the
interaction between the two (or even n) main factors.
I've looked through some books
2019 Jun 23
2
Calculation of e^{z^2/2} for a normal deviate z
I agree with many the sentiments about the wisdom of computing very
small p-values (although the example below may win some kind of a prize:
I've seen people talking about p-values of the order of 10^(-2000), but
never 10^(-(10^8)) !). That said, there are a several tricks for
getting more reasonable sums of very small probabilities. The first is
to scale the p-values by dividing the
2005 May 19
14
R annoyances
Dear R Folks,
I'm a big fan of R, but there are a couple of things
that repeatedly annoy me, and I wondered if anyone
has neat ways to deal with them.
(a) When using "apply" row-wise to a matrix, it returns
the results column-wise, and to preserve the original
orientation, I've to do a transpose. E.g. I've to keep
doing a transpose, which I consider to be quite
2010 Nov 07
1
How do I order xyplot line points?
I have the following xyplot figure:
http://img577.imageshack.us/img577/686/filesizeresults12000000.png
The data are organized in a matrix file as follows:
Type Elements Chromosome Time
bedGz 12000000 chr1 14.240
bedGz 12000000 chr2 7.949
bedGz 12000000 chr3 5.103
bedGz 12000000 chr4 5.290
bedGz 12000000 chr5 5.161
...
The x-axis labels in the Chromosome column are ordered
2019 Jun 21
4
Calculation of e^{z^2/2} for a normal deviate z
You may want to look into using the log option to qnorm
e.g., in round figures:
> log(1e-300)
[1] -690.7755
> qnorm(-691, log=TRUE)
[1] -37.05315
> exp(37^2/2)
[1] 1.881797e+297
> exp(-37^2/2)
[1] 5.314068e-298
Notice that floating point representation cuts out at 1e+/-308 or so. If you want to go outside that range, you may need explicit manipulation of the log values. qnorm()
2019 Jun 24
2
Calculation of e^{z^2/2} for a normal deviate z
>>>>> William Dunlap via R-devel
>>>>> on Sun, 23 Jun 2019 10:34:47 -0700 writes:
>>>>> William Dunlap via R-devel
>>>>> on Sun, 23 Jun 2019 10:34:47 -0700 writes:
> include/Rmath.h declares a set of 'logspace' functions for use at the C
> level. I don't think there are core R functions that call
2007 May 06
7
A function for raising a matrix to a power?
Hi,
Is there a function for raising a matrix to a power? For example if you like to compute A%*%A%*%A, is there an abbreviation similar to A^3?
Atte Tenkanen
> A=rbind(c(1,1),c(-1,-2))
> A
[,1] [,2]
[1,] 1 1
[2,] -1 -2
> A^3
[,1] [,2]
[1,] 1 1
[2,] -1 -8
But:
> A%*%A%*%A
[,1] [,2]
[1,] 1 2
[2,] -2 -5
2008 Mar 13
3
Overland Arcvault 12 and sequential/random settings
My unit's firmware: library 05.03, tape d22h, shows the device as set to
random mode. But mtx -f /dev/st0 status gives an error that google says
the device is in sequential mode. dmesg|grep -i hp does reflect CentOS
thinks the device is a sequential unit.
I've tried this with Fedora 8, too, and both show the same, so it is
either an issue with CentOS/Fedora RPMs, or the version of
2019 Jun 21
4
Calculation of e^{z^2/2} for a normal deviate z
Hello,
Well, try it:
p <- .Machine$double.eps^seq(0.5, 1, by = 0.05)
z <- qnorm(p/2)
pnorm(z)
# [1] 7.450581e-09 1.228888e-09 2.026908e-10 3.343152e-11 5.514145e-12
# [6] 9.094947e-13 1.500107e-13 2.474254e-14 4.080996e-15 6.731134e-16
#[11] 1.110223e-16
p/2
# [1] 7.450581e-09 1.228888e-09 2.026908e-10 3.343152e-11 5.514145e-12
# [6] 9.094947e-13 1.500107e-13 2.474254e-14 4.080996e-15