18.4.2 Field Duplicates


# Tab. 18.4.: Combined sampling and analytical precision for selected elements
# from the 49 field duplicates
library(StatDA)
# Field duplicates
data(CHorFieldDUP)

xd1=CHorFieldDUP[,5:98]
xd2=CHorFieldDUP[,99:192]

sel=c("Ag","Al","Al2O3","As","Ba","Bi","CaO","Cd","Co","Cr","Cu","Fe","Fe_INAA","Fe2O3",
"La","La_INAA","Ni","Pb","S","Sc_INAA","Se","Te","Th_INAA","V","Zn")
dat1=xd1[,paste("F1_",sel,sep="")]
dat2=xd2[,paste("F2_",sel,sep="")]

res2 = rep(NA, length(sel))
for (i in 1:length(sel)){
dat=cbind(dat1[,i],dat2[,i])
dat=na.omit(dat)
dat.m=mean(dat)
dat.s=1/(2*nrow(dat))*sum((dat[,1]-dat[,2])^2)
res2[i]=100*sqrt(dat.s)/dat.m
}
names(res2)<- sel

res2r <- round(res2,1)
write.csv(res2r,file="tab-18-4.csv")


# Fig. 18.3.: Thompson-Howarth plot of field duplicates for K2O and Zn_INAA
library(StatDA)
# Field duplicates
data(CHorFieldDUP)

xd1=CHorFieldDUP[,5:98]
xd2=CHorFieldDUP[,99:192]

pdf("fig-18-3.pdf",width=9,height=4.5)
par(mfrow=c(1,2),mar=c(4,4,2,2))
i=39
xmean=apply(cbind(xd1[,i],xd2[,i]),1,mean)
xdiff=abs(xd1[,i]-xd2[,i])
xmax=max(xmean)
ymax=max(xdiff)
plot(xmean,xdiff,main="K2O",xlab="Mean [wt.-%]",ylab="Absolute difference [wt.-%]",
ylim=c(0,ymax))
abline(a=0,b=0.1)
abline(a=0,b=0.2)
text(2.8,0.09,"<10%")
text(2.7,0.41,"10-20%")
text(2.6,1.2,">20%")
# label observations
text(1.07,0.43,"591,39",cex=0.85)
text(1.92,1.62,"294,51",cex=0.85)
text(1.48,0.53,"688,146",cex=0.85)

i=94
xmean=apply(cbind(xd1[,i],xd2[,i]),1,mean)
xdiff=abs(xd1[,i]-xd2[,i])
xmax=max(xmean)
ymax=max(xdiff)
plot(xmean,xdiff,main="Zn_INAA",xlab="Mean [mg/kg]",ylab="Absolute difference [mg/kg]",
ylim=c(0,ymax))
abline(a=0,b=0.1)
abline(a=0,b=0.2)
text(170,5,"<10%")
text(190,28,"10-20%")
text(180,90,">20%")
dev.off()