Commit 97cc106e authored by Martin Maechler's avatar Martin Maechler

Have sample() use the 3.5.0 RNGkind {in R >= 3.6.0}

parent 330df4f9
Package: CLA
Version: 0.95-0
Date: 2018-10-05
Date: 2019-02-04
Title: Critical Line Algorithm in Pure R
Author: Yanhao Shi <syhelena@163.com>,
Martin Maechler <maechler@stat.math.ethz.ch>
......
......@@ -4,7 +4,7 @@
\title{News for \R Package \pkg{CLA}}% MM: look into ../svn-log-from.all
\newcommand{\CRANpkg}{\href{https://CRAN.R-project.org/package=#1}{\pkg{#1}}}
\section{Changes in version 0.95-0 (2018-10-05)}{
\section{Changes in version 0.95-0 (2019-02-04)}{
\subsection{New Features}{
\itemize{
\item \emph{Not} back-compatible \emph{changed} result: The very
......@@ -25,6 +25,9 @@
\item In some cases such as \code{muS.10ex}, the last turning
point with \code{lambda=0} was not computed previously.
\item adapt \file{man/findSig.Rd} example to R 3.6.0's new default
\code{sample()} kind.
}
}
}
......
......@@ -37,8 +37,10 @@ findMu(Sig0, result, covar, tol.unir = 1e-06, equal.tol = 1e-06)
\examples{
data(muS.sp500)
## Full data taking too much time for example
if(getRversion() >= "3.6") .Rk <- RNGversion("3.5.0") # for back compatibility & warning
set.seed(2016)
iS <- sample.int(length(muS.sp500$mu), 17)
if(getRversion() >= "3.6") do.call(RNGkind, as.list(.Rk)) # revert
cov17 <- muS.sp500$covar[iS, iS]
CLsp.17 <- CLA(muS.sp500$mu[iS], covar=cov17, lB=0, uB = 1/2)
CLsp.17 # 16 turning points
......
......@@ -37,8 +37,10 @@ findSig(Mu0, result, covar, equal.tol)
\examples{
data(muS.sp500)
## Full data taking too much time for example: Subset of n=21:
if(getRversion() >= "3.6") .Rk <- RNGversion("3.5.0") # for back compatibility & warning
set.seed(2018)
iS <- sample.int(length(muS.sp500$mu), 21)
if(getRversion() >= "3.6") do.call(RNGkind, as.list(.Rk)) # revert
cov21 <- muS.sp500$covar[iS, iS]
CLsp.21 <- CLA(muS.sp500$mu[iS], covar=cov21, lB=0, uB = 1/2)
CLsp.21 # 14 turning points
......
......@@ -39,9 +39,10 @@ muSigmaGarch(x, formula = ~garch(1, 1), cond.dist = "std", trace = FALSE,
\examples{
if(requireNamespace("FRAPO")) {
data(NASDAQ, package = "FRAPO")
set.seed(17)
## 12 randomly picked stocks from NASDAQ data
iS <- sample(ncol(NASDAQ), 12)
iS <- if(FALSE) { ## created (w/ warning, in new R) by
RNGversion("3.5.0"); set.seed(17); iS <- sample(ncol(NASDAQ), 12)
} else c(341L, 2126L, 1028L, 1704L, 895L, 1181L, 454L, 410L, 1707L, 425L, 950L, 5L)
X. <- NASDAQ[, iS]
muSig <- muSigmaGarch(X.)
stopifnot(identical(names(muSig$mu), names(NASDAQ)[iS]),
......
......@@ -12,14 +12,14 @@ arch
data(muS.sp500)## <<-- working from this data ---------------------
##--> ../man/findMu.Rd -- has this example
##--> ../man/findMu.Rd -- has this example --
set.seed(2016)
iS <- sample.int(length(muS.sp500$mu), 17)
cov17 <- muS.sp500$covar[iS, iS]
CLsp.17 <- CLA(muS.sp500$mu[iS], covar=cov17, lB=0, uB = 1/2)
CLsp.17 # 16 turning points
tpS <- CLsp.17$MS_weights[,"Sig"]
str(s0 <- seq(0.0186, 0.0477, by = 0.0001))
str(s0 <- c(min(tpS), seq(0.0188, 0.039, by = 0.0001), max(tpS)))
mu.. <- findMu(s0, result=CLsp.17, covar=cov17)
str(mu..)
stopifnot(dim(mu..$weight) == c(17, length(s0)))
......@@ -31,9 +31,9 @@ set.seed(2018)
iS <- sample.int(length(muS.sp500$mu), 21)
cov21 <- muS.sp500$covar[iS, iS]
CLsp.21 <- CLA(muS.sp500$mu[iS], covar=cov21, lB=0, uB = 1/2)
CLsp.21 # 14 turning points
CLsp.21 # had 14, now (R-devel new sample()) 21 turning points
tpM <- CLsp.21$MS_weights[,"Mu"]
str(m0 <- c(min(tpM),seq(0.00205, 0.00525, by = 0.00005), max(tpM)))
str(m0 <- c(min(tpM), seq(0.0028, 0.0052, by = 0.00005), max(tpM)))
sig. <- findSig(m0, result=CLsp.21, covar=cov21)
str(sig.)
stopifnot(dim(sig.$weight) == c(21, length(m0)))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment