patrones<-read.csv("EduardoCal.csv")
knitr::kable(patrones, align = "lc")
Conc Area
2.961004 3718453
6.636550 5698866
7.128343 6165431
15.959615 9791255
17.216873 10578222
38.759065 16215582
41.583397 18278200
100.000000 39114734
100.000000 38054828

Curva de Calibración del ciproconazol

y<-patrones$Area
x<-patrones$Conc

modelo<-lm(y~x)
s<-summary(modelo)
LOD<-s$coefficients[1,2]/s$coefficients[1]*3.3*8
b0=s$coefficients[1]
b1=s$coefficients[2]

yexp=modelo$fitted.values

Sxy=sqrt((sum(y*y)-b0*sum(y)-b1*sum(x*y))/(length(x)-2))

print(s)
## 
## Call:
## lm(formula = y ~ x)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -909181 -510642  114716  549264  995471 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  3555052     342259   10.39 1.66e-05 ***
## x             350104       6644   52.70 2.32e-10 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 720700 on 7 degrees of freedom
## Multiple R-squared:  0.9975, Adjusted R-squared:  0.9971 
## F-statistic:  2777 on 1 and 7 DF,  p-value: 2.322e-10
n=length(x)
SE=sqrt(sum((y-yexp)**2)/(n-2))
print("LOD:")
## [1] "LOD:"
print(SE/modelo$coefficients[2]*3.3)
##        x 
## 6.793209
t<-qt(0.975,3)
x1<-seq(0,100,0.1)
y1<-modelo$coefficients[2]*x1+modelo$coefficients[1]
IC1<-y1+t*Sxy*sqrt(1/n+(x1-mean(x))**2/sum((x1-mean(x))**2))
IC2<-y1-t*Sxy*sqrt(1/n+(x1-mean(x))**2/sum((x1-mean(x))**2))
plot(x,y,main="Curva de calibración del metano",xlab="[%Metano](v/v)",ylab="Area")
lines(x1,y1,lty=1,col="black")
lines(x1,IC1,lty=2,col="blue")
lines(x1,IC2,lty=2,col="blue")

library(ggplot2)
ggplot(patrones,aes(Conc, Area)) +
  geom_point() +
  geom_smooth(method='lm') 
## `geom_smooth()` using formula 'y ~ x'