ssr {sisireg}R Documentation

Onedimensional SSR-model calculation

Description

Calculates L1- and L2-functions satisfiying the partial sum criterium.

Usage

ssr(df, y1=NULL, yn=NULL, fn=0, iter=10000, 
        minStat=FALSE, ne=TRUE, l1=TRUE, ps=TRUE)

Arguments

df

data frame with two-dimensional data.

y1

optional: fixed value left.

yn

optional: fixed value right.

fn

optional: partial-sum-quantile (standard: generic calculation from data).

iter

optional: maximum number of iterations.

minStat

optional: boolean value for the minimum statistic.

ne

optional: boolean value for non-equidistant observations.

l1

optional: boolean value for function type.

ps

optional: sign criterium (partial sum or run).

Value

mu

SSR-function as array.

Author(s)

Dr. Lars Metzner

References

Dr. Lars Metzner (2021) Adäquates Maschinelles Lernen. Independently Published.

Examples

# generate equidistant data
set.seed(1234)
x <- seq(0, 2*pi, length.out = 200)
y <- 4*sin(x) + rnorm(200)
df <- data.frame(x=x, y=y)
# calculate regression functions
l1 <- ssr(df, ne=FALSE, ps=FALSE)
l2 <- ssr(df, ne=FALSE, l1=FALSE)
lmin <- ssr(df, ne=FALSE, minStat=TRUE, ps=FALSE)
# plot results
plot(x, y, main = 'Sign-Simplicity-Regression', 
        xlab = 't', ylab = 'sin(t)+noise')
lines(x, l1, col = 'blue')
lines(x, l2, col = 'red')
lines(x, lmin, col = 'purple')
legend("topleft", inset=c(0.01,0.01), 
        legend=c("L1 run-crit.", "L2 ps-crit.", "L1 min-stat."),
        col=c("blue", "red", "purple"), lty=1:1)

# generate nonequidistant data
df <- data.frame(x=runif(500, min=-1, max=1)*pi)
df$y <- sin(df$x)*20 + rnorm(nrow(df), mean=0, sd=10)
# calculate regression function
dfl1 <- ssr(df, fn = 5)
# plot results
plot(df)
lines(dfl1, col = 'red')

[Package sisireg version 1.1.1 Index]