diff options
Diffstat (limited to 'demo/massart97ex3.R')
-rw-r--r-- | demo/massart97ex3.R | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/demo/massart97ex3.R b/demo/massart97ex3.R index 7bf9633..731aba6 100644 --- a/demo/massart97ex3.R +++ b/demo/massart97ex3.R @@ -1,12 +1,15 @@ 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) +ybar <- sapply(yx,mean) +s <- round(sapply(yx,sd),digits=2) +w <- round(1/(si^2),digits=3) +data.frame(x=levels(factor(x)),ybar,s,w) -weights <- wi[factor(x)] +weights <- w[factor(x)] m <- lm(y ~ x,w=weights) +inverse.predict(m,15,ws=1.67) +inverse.predict(m,90,ws=0.145) + +calplot(m) |