File: wormcomp.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 (19 lines) | stat: -rw-r--r-- 681 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
provide.data(worm)
Males   <- sm.binomial(Age[Sex == 1], Infection[Sex == 1], h = 10,
              display = "none")
agem    <- Males$eval.points
Females <- sm.binomial(Age[Sex == 2], Infection[Sex == 2], h = 10,
              eval.points = agem, display = "none")
estm <- Males$estimate
sem  <- Males$se
estf <- Females$estimate
sef  <- Females$se
plot(Age, Infection, ylab = "Proportion infected", type= "n")
av <- (log(estm/(1-estm)) + log(estf/(1-estf)))/2
se <- sqrt(sem^2 + sef^2)
upper <- 1/(1+exp(-(av + se)))
lower <- 1/(1+exp(-(av - se)))
polygon(c(agem, rev(agem)), c(upper, rev(lower)),
      col = "cyan", border = FALSE)
lines(agem, estm)
lines(agem, estf, lty = 3)