aboutsummaryrefslogblamecommitdiff
path: root/demo/massart97ex3.R
blob: 7bf963356d257632b06d7f6c6820e7c568388356 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12











                                   
library(chemCal)
data(massart97ex3)
attach(massart97ex3)
xi <- levels(factor(x))
yx <- split(y,factor(x))
ybari <- sapply(yx,mean)
si <- round(sapply(yx,sd),digits=2)
wi <- round(1/(si^2),digits=3)
data.frame(xi,ybari,si,wi)

weights <- wi[factor(x)]
m <- lm(y ~ x,w=weights)

Contact - Imprint