[R] denstrip package: densregion when density is not provided
Matteo Richiardi
matteo.richiardi at gmail.com
Sun Oct 4 09:02:10 CEST 2015
I need to estimate the density from the other time series, similarly to what
denstrip does (however, I need a whole region, and not just a strip).
This is my updated example, where I tried to estimate the density from my
bootstrapped projections using density() - as in denstrip:
require(denstrip)
x <- 2013:2015
y0.df <- read.delim("clipboard")
y0.num <- data.matrix(y0.df, rownames.force = NA)
y.df <- read.delim("clipboard")
y.num <- data.matrix(y.df, rownames.force = NA)
z <- density(y.num)
densregion(x, y, z)
where y0.num contains my "central" projection:
> head(y0.num)
default
[1,] 0.7086428
[2,] 0.7111570
[3,] 0.7117583
[4,] 0.7124711
[5,] 0.7166852
[6,] 0.7167453
and y.num contains the bootstrapped projections:
run1 run2 run3 run4 run5 run6
[1,] 0.6932324 0.7732179 0.6201226 0.6712345 0.6974636 0.7399447
[2,] 0.6773456 0.7971804 0.5810890 0.6775887 0.7134176 0.7480797
[3,] 0.6704025 0.8122599 0.5655451 0.6836657 0.7438639 0.7540193
[4,] 0.6671754 0.8235685 0.5663680 0.6828320 0.7650042 0.7605239
[5,] 0.6644370 0.8287378 0.5643008 0.6846030 0.7921467 0.7655395
[6,] 0.6630486 0.8333708 0.5612197 0.6882252 0.8183746 0.7687452
This is the error I get:
Error in rank(x, ties.method = "min", na.last = "keep") :
unimplemented type 'list' in 'greater'
Matteo
On 3 October 2015 at 09:16, Matteo Richiardi <matteo.richiardi at gmail.com>
wrote:
> I have several estimated time series, running from 2013 to 2050. 'y'
> values are constrained between 0 and 1. I would like to plot them using
> shaded colours of decreasing intensity, depending on an estimated density
> at each point x in 2013-2050.
>
> This is what I have done:
>
> require(denstrip)
> x <- 2013:2015
> y <- seq(0, 1, length=100)
> z <- read.delim("clipboard")
> densregion(x, y, z)
>
> where I imported 'z' from MS Excel. 'z' looks like (I copied only the
> first 2 columns, l but I have 100 of them):
>
> run1 run2
> 1 0.6932324 0.7732179
> 2 0.6773456 0.7971804
> ...
> 37 0.7260790 0.8724961
> 38 0.7290335 0.8755433
>
> I get the following error message:
> Error in `[.data.frame`(x, order(x, na.last = na.last, decreasing =
> decreasing)) :
> undefined columns selected
>
> Could anybody please help me with fixing this? Thanks in advance
>
[[alternative HTML version deleted]]
More information about the R-help
mailing list