Displaying 11 results from an estimated 11 matches for "fortisinvest".
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
2008 Nov 05
2
matrix indexing and update
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, ]
a[6, ] <- -a[6, ]
a[10, ] <- -a[10, ]
I thought I could do
a[which(b >
2009 Mar 27
2
adding matrices with common column names
folks,
if i have three matrices, a, b, cc with some colnames in common, and i
want to create a matrix which consists of the common columns added up,
and the other columns tacked on, what's a good way to do it? i've got
the following roundabout code for two matrices, but if the number of
matrices increases, then i'm a bit stymied.
> a <- matrix(1:20,ncol=4); colnames(a) <-
2009 Mar 02
2
Goldbach partitions code
Folks,
I put up a brief note describing my naive attempts to compute Goldbach
partitions, starting with a brute-force approach and refining
progressively.
http://jostamon.blogspot.com/2009/02/goldbachs-comet.html
I'd welcome your suggestions on improvements, alternatives, other
optimisations, esp. to do with space vs time tradeoffs.
Is this an example interesting enough for
2010 Jan 20
1
min and max operations on matrix
Folks,
I've got a matrix x as follows:
> x <- matrix(c(1,2,3,5,3,4,3,2,1), ncol = 3, byrow = TRUE)
> x
[,1] [,2] [,3]
[1,] 1 2 3
[2,] 5 3 4
[3,] 3 2 1
In each row of x, I want to replace the minimum value by -1, the maximum
value by +1 and all other values by 0.
So in the above case I want to end up as follows:
[,1] [,2] [,3]
[1,] -1 0
2009 Apr 27
2
series at low freq expanded into high freq
Folks,
If I have a series mm of, say, monthly observations, and a series dd of
daily dates, what's a good way of expanding mm such that corresponding
to each day in dd within the corresponding month in mm, the values of mm
are repeated?
So e.g., if I have mm:
mm <- c(15, 10, 12, 13, 11)
names(mm)<-c("Nov 2008", "Dec 2008", "Jan 2009", "Feb
2004 Nov 10
2
fSeries
Good morning everyone,
I use for the first time the package fSeries and i try to run the example
given by Diethelm Würtz. But when i run its example which is the following
#
# Example:
# Model a GARCH time series process
#
# Description:
# PART I: Estimate GARCH models of the following type ARCH(2)
# and GARCH(1,1) with normal conditional distribution functions.
# PART II: Simulate
2004 Nov 11
0
ROracle SQL length limitation
...s)
12. Re: Basic Q on coercing factors in data frames to numeric
(Roger D. Peng)
13. Re: "conditional duplicates"? (Christian Schulz)
14. RE: Does something like partition.rpart() exist? (Andy Bunn)
15. Re: R under Pocket PC (Peter Dalgaard)
16. fSeries (CYRIL.CAILLAULT at FORTISINVESTMENTS.COM)
17. Re: worked in R, but not in S-Plus (Thomas Lumley)
18. fSeries (Vito Ricci)
19. Re: lattice: ordering the entries in a dotplot of a vector
(Deepayan Sarkar)
20. Building MacOSX binary in Windows XP (Tomas Aragon)
21. Re: Building MacOSX binary in Windows XP (Prof Brian...
2005 Feb 14
0
DCUHRE - Multiple integration
Good morning,
Do you know if there exists R package for the DCUHRE fortran routine like
for the ADAPT package.
Best regards
Cyril
[[alternative HTML version deleted]]
2009 Jul 02
0
convert xts vector into matrix
hi folks,
if i have an xts object as follows:
library(xts)
> dd <- as.POSIXct(strptime(c("2009-06-01 08:00:00", "2009-06-01
08:30:00","2009-06-01 09:00:00","2009-06-02 08:00:00", "2009-06-03
08:00:00", "2009-06-03 08:30:00"),"%Y-%m-%d %H:%M:%S"))
> a <- xts(1:6,dd)
> a
[[alternative HTML version
2009 Sep 25
0
differing behaviour between xts (0.6-7) and zoo (1.5-8)
Folks,
I have some weekly dataseries that I convert to monthly xts (with
yearmon indices), and obtain the two following extracts:
> str(sig)
An 'xts' object from Apr 1998 to Sep 1998 containing:
Data: num [1:6, 1] 0.0083 0.2799 -0.2524 -0.0119 0.18 ...
- attr(*, "dimnames")=List of 2
..$ : NULL
..$ : chr "e1"
Indexed by objects of class: [yearmon] TZ: