Displaying 20 results from an estimated 300 matches similar to: "How to alpha entire plot?"
2018 Jun 01
0
How to alpha entire plot?
Interesting problem.
I would discretize the x-values and interleave them. Lines from one dataset still overlap, so you see high- density and low-density regions, but lines from the other dataset are drawn into the interval. Like so:
interleave <- function(x, MIN, MAX, N, nChannel = 2, channel) {
isp <- seq(MIN, MAX, length.out = N + 1) # interleave support points
offset <-
2007 Apr 19
2
Filtering
Ein eingebundener Text mit undefiniertem Zeichensatz wurde abgetrennt.
Name: nicht verf?gbar
URL: https://stat.ethz.ch/pipermail/r-help/attachments/20070420/d7792b17/attachment.pl
2007 Feb 19
2
Calculating the Sharpe ratio
Hi useRs,
I am trying to calculate the Sharpe ratio with "sharpe" of the library
"tseries".
The documentation requires the univariate time series to be a
portfolio's cumulated returns. In this case, the example given
data(EuStockMarkets)
dax <- log(EuStockMarkets[,"FTSE"])
is however not the cumulated returns but rather the daily returns of the
FTSE
2007 Dec 13
2
How to use R to estimate a model which has two sets of lagged time series independent variables
Hi,
I would like to use R to estimate the following model:
X(t) = a + b1*X(t-1) + b2*X(t-2) + c1*Y(t) + c2*Y(t-1) + c3*Y(t-2)
Is there any R function that performs this type of estimation? I know
that if I only have one time series (i.e. lagged value of X) on the
right hand side then there are R functions to do the estimation. I am
thinking a work around by preparing X(t-1), X(t-2),Y(t),Y(t-1)
2024 Jul 16
2
Automatic Knot selection in Piecewise linear splines
>>>>> Anupam Tyagi
>>>>> on Tue, 9 Jul 2024 16:16:43 +0530 writes:
> How can I do automatic knot selection while fitting piecewise linear
> splines to two variables x and y? Which package to use to do it simply? I
> also want to visualize the splines (and the scatter plot) with a graph.
> Anupam
NB: linear splines, i.e. piecewise
2024 Jul 26
1
Automatic Knot selection in Piecewise linear splines
dear all,
I apologize for my delay in replying you. Here my contribution, maybe
just for completeness:
Similar to "earth", "segmented" also fits piecewise linear relationships
with the number of breakpoints being selected by the AIC or BIC
(recommended).
#code (example and code from Martin Maechler previous email)
library(segmented)
o<-selgmented(y, ~x, Kmax=20,
2023 Jul 23
1
col2rgb() function
Does adjustcolor() help?
cb8<- c("#000000", "#E69F00", "#56B4E9", "#009E73","#F0E442", "#0072B2",
"#D55E00", "#CC79A7")
plot(0,0,xlim=c(1,8),ylim=c(0,1))
points(1:8,rep(0.5,8),col=cb8,pch=19,cex=2)
points(1:8,rep(0.75,8),col=adjustcolor(cb8, alpha.f = 0.3), pch=19,cex=2)
On 2023-07-23 2:15 p.m., Nick Wray
2023 Jul 23
2
col2rgb() function
Thanks That works nicely Nick
On Sun, 23 Jul 2023 at 19:26, Ben Bolker <bbolker at gmail.com> wrote:
> Does adjustcolor() help?
>
> cb8<- c("#000000", "#E69F00", "#56B4E9", "#009E73","#F0E442", "#0072B2",
> "#D55E00", "#CC79A7")
> plot(0,0,xlim=c(1,8),ylim=c(0,1))
>
2023 Jul 23
1
col2rgb() function
Nick,
I've also made colors transparent by pasting the hex equivalent of, say,
0.3*256 = 76.9 to the hex color code. e.q. for black it might be
"#0000004d" and the 4d is 77 in hex. That way you don't need to convert
back and forth so much. If col is "#000000" the transparent version is
tcol <- paste0(col,"4d")
This would work in one step on a whole
2023 Jul 23
1
col2rgb() function
Just one addition which may or may not be useful: The color palette you
use is also known as "Okabe-Ito" and it is the default set of colors in
the palette.colors() function. This function also has an optional alpha
argument. So if you want to generate these colors with an alpha of 0.3 you
can also do:
palette.colors(8, alpha = 0.3)
or more explicitly
palette.colors(8, palette =
2010 Mar 16
1
Simple for-loop runs out of memory
I have the following simple for-loop, which makes R crash every time. The
length of the vectors is about 1200 rows, 1 column.
n = max(length(GSPC),length(FTSE))
for(i in 1:1000)
{
if (row.names(GSPC)[i]==row.names(FTSE)[i]){
} else {
if (row.names(GSPC)[i]>row.names(FTSE)[i]){
GSPC<-rbind(GSPC[1:(i-1),],GSPC[(i-1):length(GSPC),])
row.names(GSPC)[i]=row.names(FTSE)[i]
} else {
2005 Sep 29
2
priceIts
Dear All,
There is an example for the priceIts function (the its package) which
does not work for me as expected.
> ?priceIts
> x1 <- priceIts(instrument = c("^ftse"), start = "1998-01-01",
+ quote = "Close")
Error in validObject(.Object) : invalid class "its" object: Missing
values in dates
> x2 <-
2008 Mar 31
1
download.file error
Dear all,
I am looking for a way to work out if a file on the internet exists before attempting to download it using the function download.file(). For example,
using a url that does not exist
url <- "http://finance.yahoo.com/ftse.csv"
destfile <- tempfile()
download.file(url = url, destfile = destfile)
# gives the following response ...
trying URL
2005 Dec 13
1
fSeries
I'm trying to use garchFit from fSeries, with Student or Skewed Student conditionnal distribution. Let's say that eps (vector) is my series of daily log-returns:
data(EuStockMarkets)
eps = diff(log(EuStockMarkets[,"CAC"]))
library(fSeries)
g = garchFit(series = eps, formula.var = ~garch(2,2), cond.dist = "dstd")
s = g at fit$series
All the coefficients are ok
2007 Apr 24
2
Log-Returns
Ein eingebundener Text mit undefiniertem Zeichensatz wurde abgetrennt.
Name: nicht verf?gbar
URL: https://stat.ethz.ch/pipermail/r-help/attachments/20070424/c6ce561b/attachment.pl
2016 Apr 28
1
polygon angle option perpendicular to axis
Thanks for the question. Here is a sample of the code for my plot:
Top = c(34, 39, 42, 45, 46, 41, 41, 40, 43, 38, 33, 33)
Bottom = c(24, 29, 32, 36, 32, 34, 32,41, 40, 39, 29, 24)
plot(1,1, col = "white", xlim = c(1.3,11.7), ylim = c(0,80), axis = FALSE, xaxt = "n")
axis(1, at = c(1:12))
polygon(c(c(1:12),c(12:1)), c(top, bottom), col =
2010 Sep 04
1
tail.matrix returns matrix, while tail.mts return vector
Hi
I have a few problems with tail/head when applied to multiple time
series. I'm not sure as whether I did not understand the function or
whether it correspond to an unexpected behavior.
When head(a,n) is applied on data.frame or matrix, it returns a
data-frame or matrix with first n obs of *each* variable. When applied
to a mts object, it returns first n obs of *first* variable only,
2008 Oct 22
1
R 2.8.0 qqnorm produces error with object of class zoo?
Dear list-reader,
by running the following script:
library(zoo)
sessionInfo()
search()
packageDescription("zoo")
data(EuStockMarkets)
dax <- as.zoo(EuStockMarkets[1:10, "DAX"])
daxr <- diff(log(dax))
identical(as.vector(qnorm(daxr)), qnorm(coredata(daxr)))
qqnorm(coredata(daxr))
qqnorm(daxr)
qqnorm() produces an error:
> qqnorm(daxr)
Fehler in if (xi == xj) 0L
2024 Jul 09
1
Automatic Knot selection in Piecewise linear splines
How can I do automatic knot selection while fitting piecewise linear
splines to two variables x and y? Which package to use to do it simply? I
also want to visualize the splines (and the scatter plot) with a graph.
Anupam
[[alternative HTML version deleted]]
2012 Sep 05
2
cex.lab ignored in plot.zoo for multiple plots
Hello everyone,
a problem with the plot.zoo function. In the parameters of the function,
cex.lab is ignored. I tried to reduce the size of the yaxis labels by at
least 50%.
------------------
Example:
sample <- as.zoo(EuStockMarkets)
par(las=1)
plot.zoo(sample, plot.type="multiple", main="Time Series", xlab="Date",
yaxt="n", cex.lab=0.5,