File: sin_prop.q

package info (click to toggle)
sm 2.0.14-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 992 kB
  • ctags: 26
  • sloc: fortran: 133; sh: 28; makefile: 13
file content (16 lines) | stat: -rw-r--r-- 501 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
n <- 50
x <- seq(0, 1, length = n)
m <- sin(2 * pi * x)
h <- 0.05
true.sigma <- 0.2
model <- sm.regression(x, m, h = h, display = "none")
upper <- model$estimate + 2 * (true.sigma/model$sigma)*model$se
lower <- model$estimate - 2 * (true.sigma/model$sigma)*model$se
y <- rnorm(n, m, true.sigma)
plot(range(x), range(y, upper, lower), type = "n",
	xlab="x", ylab="y")
polygon(c(x, rev(x)), c(upper, rev(lower)), border = FALSE, col = "cyan")

lines(x, m)
lines(x, model$estimate, lty = 3)
points(x, y)