Displaying 20 results from an estimated 1100 matches similar to: "graphics layout"
2012 Feb 20
2
stats on transitions from one state to another
Folks,
I'm trying to get stats from a matrix for each transition from one state to another.
I have a matrix x as below.
structure(c(0, 2, 2, 2, 0, 0, 0, 1, 1, 1, 1, 2, 2, 1, 1, 1, 0,
0, 2, 2, 0.21, -0.57, -0.59, 0.16, -1.62, 0.18, -0.81, -0.19,
-0.76, 0.74, -1.51, 2.79, 0.41, 1.63, -0.86, -0.81, 0.39, -1.38,
0.06, 0.84, 0.51, -1, -1.29, 2.15, 0.39, 0.78, 0.85, 1.18, 1.66,
0.9, -0.94,
2002 Aug 06
1
polygon() draws non-transparent border, erase.screen draws non-transparent border (PR#1881)
# polygon ignores requests to have its border transparent, look at
par(bg="transparent")
plot(c(0, 3), 0:1)
polygon(c(0, 1, 1, 0), c(0, 0, 1, 1), border=NA, col = 0)
polygon(c(1, 2, 2, 1), c(0, 0, 1, 1), border="transparent", col = 0)
polygon(c(2, 3, 3, 2), c(0, 0, 1, 1), border=0, col = 0)
# a quick fix for erase.screen() is the following
erase.screen <-
function (n =
2010 Aug 31
2
simultaneous estimation
Hi folks,
Not sure what this sort of estimation is called. I have a 2-column time-series x(i,t) [with (i=1,2; t=1,...T)], and I want to do the following 'simultaneous' regressions:
x(1,t) = (d - 1)(x(1, t-1) - mu(1))
x(2,t) = (d - 1)(x(2, t-1) - mu(2))
And I want to determine the coefficients d, mu(1), mu(2).
Note that the d should be the same for both estimations, whereas the
2011 Mar 31
3
choosing best 'match' for given factor
Folks,
I have a 'matching' matrix between variables A, X, L, O:
> a <- structure(c(1, 0.41, 0.58, 0.75, 0.41, 1, 0.6, 0.86, 0.58,
0.6, 1, 0.83, 0.75, 0.86, 0.83, 1), .Dim = c(4L, 4L), .Dimnames = list(
c("A", "X", "L", "O"), c("A", "X", "L", "O")))
> a
A X L O
A 1.00 0.41
2006 Jul 18
1
using split.screen?
Hello. I am having trouble understanding the use of split.screen. I want
to divide the device surface first into 4 equal screens:
split.screen(figs=c(2,2))
This works.
I next want to subdivide each of these 4 screens into 10 subscreens. I do,
for the first of these 4 screens:
screen(1,new=T)
and then: split.screen(figs=c(10,2))
My understanding is that this should split screen 1 (i.e.
2010 Sep 01
2
getting column names of row-by-row sorted matrix
Hi folks,
I want to sort a matrix row-by-row and create a new matrix that contains the corresponding colnames of the original matrix.
E.g.
> set.seed(123)
> a <- matrix(rnorm(20), ncol=4); colnames(a) <- c("A","B","C","D")
> a
A B C D
[1,] -0.56047565 1.7150650 1.2240818 1.7869131
[2,]
2010 Oct 18
1
questions on unstack()
Folks,
I have the following dataframe:
> x <- structure(list(name = c("EU B", "EU B", "EU B", "EU B", "EU B",
"EU B", "AU A", "AU A", "AU A", "AU A", "AU A", "AU A"), date = c("2010-10-11",
"2010-10-12", "2010-10-13",
2017 Nov 01
3
repeat a function
I want to populate the matrix prb through the function HWMProb <- function (a,j,dt) that encapsulates different functions (please see code below), using j= 0:2 for each j.
It only populates prb if I specify each function independently in the global environment and then run the loop with the iF statement, as per below.
for (j in 0:2) {
if (j==0) {
prb["0","1"] <-
2017 Nov 02
2
repeat a function
Hi Petr,
Many thanks for your response.
Basically I want to create a probability matrix to be used in a trinomial tree going forward. This is the reason why I thought to build the matrix around 0 would be much more efficient. I need to loop through because the probabilities will depend on my node and is not always the same per row (e.g. if N> jmax, jmax being defined in another function)
I
2017 Nov 02
0
repeat a function
Hi Eric
I did not see any answer and frankly speaking I cannot provide you with canned help.
AFAIK if a function is defined within another function (which is your case) it cannot be called directly so it is necessary to define it in global environment.
> fff <- function(x) {
+ myf <- function(a) a+2
+ myf(x)^2}
>
> fff(5)
[1] 49
> myf(5)
Error in myf(5) : could not find
2017 Nov 03
0
repeat a function
Hi
Well, I am not an expert in this field so I cannot comment your approach. I wanted only to point out that building matrix your way is like scratching your left ear with right hand, especially in R. What if you want increase size of your matrix?
E.g. you use function ProbUP once for row "0" and than for rows different from jmax (if I correctly understand your code). Use of any
2006 Jul 18
0
using split.screen? [Broadcast]
This means that the margins for 10 screens would take up more room than you
have - essentially the plot area is being squeezed to nothing. You can try
reducing your margins using par.
Also, it looks like you're trying to split into 20 screens there.
Hope this helps,
Matt
-----Original Message-----
From: r-help-bounces at stat.math.ethz.ch
[mailto:r-help-bounces at stat.math.ethz.ch] On
2007 Jul 29
2
array writing and their filenames
Hi,
I want to save a array (say, array[6,7,8]) write a cvs file. How can I do
that??? can I write in one file?
if I could not write in one file, i want to use a loop to save in different
files (in the matrix[6,7,8], should be 8 csv files), such as the filename
structure should be: file ="filename" +str(i) +"." +"csv"
Many thanks.
Dong
[[alternative HTML version
2007 Jul 29
2
write.csv
Hi,
I want to save an array(say, array[6,7,8]) write a cvs file. How can I do
that??? can I write in one file?
if I could not write in one file, i want to use a loop to save in different
files (in the array[6,7,8], should be 8 csv files), such as the filename
structure should be: file ="filename" +str(i) +"." +"csv"
Many thanks.
[[alternative HTML version
2008 Jul 02
5
multiplication question
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
where R is a matrix?
thanks,
murali
2007 Mar 29
1
creating conditional list of elements
Sorry to plague the list, but I think I got the answer. The following
would do:
> signalList <- list(tradingRules$Signal[tradingRules$Enabled]) [[1]]
> length(signalList)
[1] 2
Now my problem is shifted: I have the Signal column in the original data
frame referring to actual
matrices previously created in R. That is, bar_signal and cif_signal are
extant matrices. What I
need is the
2002 Sep 10
4
legend outside axes of image or other plot
I have tried and tried unsuccessfully to place a legend outside the plot
frame of a graph. This would allow me to draw a legend for an image() plot.
But any legend I add is cut off outside the axes.
Is there a way of doing this? Thanks for any advice on how to make this
work (I'm using R1.5.1 with Windows 2000).
Richard Condit
Smithsonian Tropical Research Institute
Unit 0948
APO AA
2007 Sep 19
3
Row-by-row regression on matrix
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)))
[1] 44.72 18.00 69.52 NA NA
Takes more than a minute to do (and I need to do many
2007 Feb 13
2
Computing stats on common parts of multiple dataframes
Folks,
I have three dataframes storing some information about
two currency pairs, as follows:
R> a
EUR-USD NOK-SEK
1.23 1.33
1.22 1.43
1.26 1.42
1.24 1.50
1.21 1.36
1.26 1.60
1.29 1.44
1.25 1.36
1.27 1.39
1.23 1.48
1.22 1.26
1.24 1.29
1.27 1.57
1.21 1.55
1.23 1.35
1.25 1.41
1.25 1.30
1.23 1.11
1.28 1.37
1.27 1.23
R> b
EUR-USD NOK-SEK
1.23 1.22
1.21 1.36
1.28 1.61
1.23 1.34
1.21 1.22
2009 Jun 18
3
Replace zeroes in vector with nearest non-zero value
Folks,
If I have a vector such as the following:
x <- c(0, -1, -1, -1, 0, 0, 1, -1, 1, 0)
and I want to replace the zeroes by the nearest non-zero number to the
left, is there a more elegant way to do this than the following loop?
y <- x
for (i in 2 : length(x))
{
if (y[i] == 0) {
y[i] <- y[i - 1]
}
}
> y
[1] 0 -1 -1 -1 -1 -1 1 -1 1 1
You can see the