aboutsummaryrefslogtreecommitdiff
path: root/vignettes/chemCal.R
blob: 701db7b2e42ec741ab50590ddef4799acef3533f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
### R code from vignette source '/home/jranke/git/chemCal/vignettes/chemCal.Rnw'

###################################################
### code chunk number 1: chemCal.Rnw:38-42
###################################################
library(chemCal)
data(massart97ex3)
m0 <- lm(y ~ x, data = massart97ex3)
calplot(m0)


###################################################
### code chunk number 2: chemCal.Rnw:49-50
###################################################
plot(m0,which=3)


###################################################
### code chunk number 3: chemCal.Rnw:56-63
###################################################
attach(massart97ex3)
yx <- split(y, x)
ybar <- sapply(yx, mean)
s <- round(sapply(yx, sd), digits = 2)
w <- round(1 / (s^2), digits = 3)
weights <- w[factor(x)]
m <- lm(y ~ x, w = weights)


###################################################
### code chunk number 4: chemCal.Rnw:69-71
###################################################
inverse.predict(m, 15, ws=1.67)
inverse.predict(m, 90, ws = 0.145)


Contact - Imprint