
R Under development (unstable) (2022-07-13 r82587 ucrt) -- "Unsuffered Consequences"
Copyright (C) 2022 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64 (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> ## this will render the output independent from the version of the package
> suppressPackageStartupMessages(library(fsdaR))
> suppressPackageStartupMessages(library(rrcov))
> 
> ##  corfwdplot(), covplot(), spmplot(), regspmplot() =============
> data(hbk, package="robustbase")
> (out <- fsmult(hbk[,1:3], monitoring=TRUE))

This is the very first call to the FSDA engine, 
it can take some time to initialize it ...



Call:
fsmult(x = hbk[, 1:3], monitoring = TRUE)

> corfwdplot(out)
> 
> ##  takes too much time
> ##(out1 <- smult(hbk, monitoring=TRUE, trace=TRUE))
> ##corfwdplot(out1)
> 
> ##  Cannot suppress the temporary messages
> ##(out2 <- mmmult(hbk[,1:3], monitoring=TRUE, trace=TRUE))
> ##corfwdplot(out2)
> 
> (out3 <- fsreg(hbk[,1:3], hbk[,4], monitoring=TRUE, trace=TRUE, method="FS"))

Optional parameters: 
$intercept
[1] 1

$nocheck
[1] 0

$tstat
[1] "trad"

$conflev
[1] 0.95 0.99

attr(,"class")
[1] "FSReda_control"

Returning from MATLAB - Fields returned by MATLAB: 
 [1] "RES"       "LEV"       "BB"        "mdr"       "msr"       "nor"      
 [7] "Bols"      "S2"        "coo"       "Tols"      "Un"        "betaINT"  
[13] "sigma2INT" "y"         "X"         "class"    

Call:
fsreg.default(x = hbk[, 1:3], y = hbk[, 4], method = "FS", monitoring = TRUE,     trace = TRUE)

> corfwdplot(out3)
> 
> ##  takes too much time
> ##(out4 <- fsreg(hbk[,1:3], hbk[,4], monitoring=TRUE, trace=TRUE, method="S"))
> ##corfwdplot(out4)
> 
> ##  Cannot suppress the temporary messages
> ##(out5 <- fsreg(hbk[,1:3], hbk[,4], monitoring=TRUE, trace=TRUE, method="MM"))
> ##corfwdplot(out5)
> 
> 
> ##  Produce monitoring covariances plot with all default options
> out <- fsmult(hbk, monitoring=TRUE)
> covplot(out)
> 
> spmplot(hbk)
> 
> ## regspmplot() ==================================================
> set.seed(12345)
> n <- 100
> p <- 3
> X <- matrix(data=rnorm(n*p), nrow=n, ncol=p)
> y <- matrix(data=rnorm(n*1), nrow=n, ncol=1)
> regspmplot(y, X)
> 
> group <- rep(0, n)
> group[1:(n/2)] <- rep(1, n/2)
> regspmplot(y, X, group)
> 
> regspmplot(y, X, group, plot=TRUE)
> 
> regspmplot(y, X, group, xlim=c(-1,2), ylim=c(0,2), pch=c(10,11), trace=TRUE)

Optional parameters to regspmplot(): 
$group
  [1] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
 [38] 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
 [75] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

$plo
$plo$sym
[1] ">"        "hexagram"

$plo$xlimx
[1] -1  2

$plo$ylimy
[1] 0 2


> 
> (out <- fsreg(y~X, method="LMS", control=LXS_control(nsamp=1000, msg=FALSE)))

Call:
fsreg.formula(formula = y ~ X, method = "LMS", control = LXS_control(nsamp = 1000,     msg = FALSE))

Coefficients:
(Intercept)           X1           X2           X3  
   -0.05276      0.11827      0.12531     -0.33265  

Scale estimate 0.6979 

> (out <- fsreg(y~X, bsb=out$bs, monitoring=TRUE))

Call:
fsreg.formula(formula = y ~ X, bsb = out$bs, monitoring = TRUE)

> 
> regspmplot(out, plot=0)
> 
> proc.time()
   user  system elapsed 
  55.01   13.96   56.76 
