Re: [R] Intersection of 2 matrices

2011-12-02 Thread Michael Kao
On 2/12/2011 2:48 p.m., David Winsemius wrote: On Dec 2, 2011, at 4:20 AM, oluwole oyebamiji wrote: Hi all, I have matrix A of 67420 by 2 and another matrix B of 59199 by 2. I would like to find the number of rows of matrix B that I can find in matrix A (rows that are common to both matr

Re: [R] round to specific intervals

2011-12-01 Thread Michael Kao
1 5:20 p.m., Duncan Murdoch wrote: On 01/12/2011 10:55 AM, Michael Kao wrote: Dear R users/helpers, I am wondering is there an existing function in which you can round numbers to a set of values. I know you can use 5 * round(x/5) for rounding to the nearest 5 or so, but what if the interval size

[R] round to specific intervals

2011-12-01 Thread Michael Kao
Dear R users/helpers, I am wondering is there an existing function in which you can round numbers to a set of values. I know you can use 5 * round(x/5) for rounding to the nearest 5 or so, but what if the interval size is not constant. For example: ## Not run test <- rnorm(100) round(test, c

Re: [R] generating a vector of y_t = \sum_{i = 1}^t (alpha^i * x_{t - i + 1})

2011-11-27 Thread Michael Kao
2 loopRec2(1:1000, 0.5) 500.77 1.00 0.76 0.00 3 loopRec3(1:1000, 0.5) 500.86 1.116883 0.85 0.00 1 loopRec(1:1000, 0.5) 501.84 2.389610 1.79 0.01 Regards, Enrico Am 27.11.2011 01:20, schrieb Michael Kao: Dear R-help, I ha

Re: [R] Transforming a string into a command

2011-11-27 Thread Michael Kao
This is one way to do it. a = 1 b = 2 c = parse(text = "log(a + b)") eval(c) Hope this helps. Cheers, On 27/11/2011 11:16 a.m., Victor wrote: I would like to make a string executable, e.g, s<- "ln(a+b)" a<-1 b<-2 execute string s to obtain ln(a+b) How can I make it? Ciao fron Ro

Re: [R] generating a vector of y_t = \sum_{i = 1}^t (alpha^i * x_{t - i + 1})

2011-11-27 Thread Michael Kao
1000, 0.5) 500.77 1.00 0.76 0.00 3 loopRec3(1:1000, 0.5) 500.86 1.116883 0.85 0.00 1 loopRec(1:1000, 0.5) 501.84 2.389610 1.79 0.01 Regards, Enrico Am 27.11.2011 01:20, schrieb Michael Kao: Dear R-help, I have been tr

[R] generating a vector of y_t = \sum_{i = 1}^t (alpha^i * x_{t - i + 1})

2011-11-26 Thread Michael Kao
Dear R-help, I have been trying really hard to generate the following vector given the data (x) and parameter (alpha) efficiently. Let y be the output list, the aim is to produce the the following vector(y) with at least half the time used by the loop example below. y[1] = alpha * x[1] y[2]

Re: [R] Copula Fitting Using R

2011-11-25 Thread Michael Kao
I don't know why my last email didn't go through properly, but library copula is still active. Here is a toy example with reference. ## Toy example for gumbel copula with log-normal distribution ## (Taken from the documentation of copula::fitMvdc) ## Specify the copula gumbel.cop <- gumbelCopu

Re: [R] Copula Fitting Using R

2011-11-25 Thread Michael Kao
library(copula) could be helpful as well. ## Toy example for gumbel copula with log-normal distribution ## (Taken from the documentation of copula::fitMvdc) ## Specify the copula gumbel.cop <- gumbelCopula(3, dim=2) myMvd <- mvdc(gumbel.cop, c("lnorm","lnorm"), list(list(meanlog = 1.17),