4

I have noticed that the inverse.predict function (chemCal package) does not take into account all the degrees of freedom of the model in order to calculate the confidence interval, and I am wondering why.

Let me explain a bit better. I was trying to figure out how much my calibration would change if I would use 5 sets of standards (6 levels) instead of 1 set. Building the two models I can see how each model has different degrees of freedom ($n-2$) where $n$ is the number of calibration standards. The model with 5 sets of standards has 28 df and the model with one set of standards has 4 df. (see below the code. It is actually a model with the logarithm both in $x$ and $y$)

However, when I apply the inverse.predict function to calculate the confidence interval, I see that it uses as $t$-value the one with 4 degrees of freedom (corresponding to one standard set). So I am wondering why is that?

I was not able to access the book that is give as a reference, but in most literature they consider $n$ the number of calibration points and not the number of levels (which I agree that in most cases is the same).

So the question is: Do you think it is correct to use the inverse.predict function with more than one set of standards? Or, should I make my own function considering $n$ as the number of calibration points instead of the calibration levels?

Would you recommend any other package? I am interested as well in applying this with models with weighted least squares regression. So it should be able to handle that as well.

logmod_all<-lm(log10(signal)~log10(conc), data=calibdata) #model with the whole dataset
logmod_1<-lm(log10(signal)~log10(conc), data=calibdata) #model with one set of standards
summary(logmod_all)
summary(logmod_1)

Up to here is all ok. I see that the two models have different degrees of freedom. And if I back calculate the $t$-value, I see that it is using different $t$-values with different df to calculate the confidence interval. But then when I do the inverse predict, I get:

    library("chemCal")
    inv_all<-inverse.predict(logmod_all, log(2500),0.05)
    inv_all
$Prediction
[1] 3.600191

$`Standard Error`
 [1] 0.006570478

$Confidence
[1] 0.01824257

 $`Confidence Limits`
[1] 3.581948 3.618433
    inv_1<-inverse.predict(logmod_1, log(2500),0.05)
    inv_1
$Prediction
[1] 3.589216

$`Standard Error`
 [1] 0.008305648

$Confidence
[1] 0.02306018

$`Confidence Limits`
 [1] 3.566156 3.612277

    inv_all$Confidence/inv_all$`Standard Error`
 [1] 2.776445

    inv_1$Confidence/inv_1$`Standard Error`
[1] 2.776445

So you can see how in both cases it calculated the $t$-value with 4 degrees of freedom.

    qt(c(0.025,0.975), df=4)
 [1] -2.776445 2.776445
kjetil b halvorsen
  • 63,378
  • 26
  • 142
  • 467
AnnaB
  • 41
  • 1

0 Answers0