\(H=exp\left ( \alpha_{0} + \alpha_{1} * log(d) + \alpha_{2} *log(d^{2}) \right )\)
Pt<-read.csv("~/MCF202/data/OAXP1.CSV", header=T)
head(Pt)
## H1 DB1 H2 DB2
## 1 0.14 0.7 0.25 0.9
## 2 0.14 0.5 0.28 0.8
## 3 0.18 0.8 0.17 0.6
## 4 0.13 0.6 0.18 0.5
## 5 0.20 0.6 0.15 0.6
## 6 0.17 0.6 0.19 0.5
Pt <- Pt[which(!is.na(Pt$H1)),] # Eliminar NAs
m1 <- lm(log(Pt$H1) ~ I(log(Pt$DB1)) + I(log(Pt$DB1)^2))
print(summary(m1))
##
## Call:
## lm(formula = log(Pt$H1) ~ I(log(Pt$DB1)) + I(log(Pt$DB1)^2))
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.64542 -0.17830 -0.02085 0.16526 0.67936
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -1.36167 0.04373 -31.136 <2e-16 ***
## I(log(Pt$DB1)) 1.04412 0.06802 15.350 <2e-16 ***
## I(log(Pt$DB1)^2) 0.05073 0.02467 2.057 0.0428 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.2836 on 83 degrees of freedom
## Multiple R-squared: 0.9787, Adjusted R-squared: 0.9782
## F-statistic: 1907 on 2 and 83 DF, p-value: < 2.2e-16
plot(Pt$DB1, Pt$H1, ylim=c(-3,25), xlim=c(0,40), xlab="DB (cm)", ylab="H (m)" )
curve(exp(-1.36167+1.04412*log(x)+ 0.05073*log(x)^2 ), from=0, to=30, add=TRUE, col=2, lwd=2)
m2 <- lm(log(Pt$H2) ~ I(log(Pt$DB2)) + I(log(Pt$DB2)^2))
print(summary(m2))
##
## Call:
## lm(formula = log(Pt$H2) ~ I(log(Pt$DB2)) + I(log(Pt$DB2)^2))
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.69382 -0.13966 -0.01181 0.13243 0.53629
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -1.025124 0.034930 -29.35 <2e-16 ***
## I(log(Pt$DB2)) 1.149875 0.073928 15.55 <2e-16 ***
## I(log(Pt$DB2)^2) -0.009925 0.025448 -0.39 0.698
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.2377 on 83 degrees of freedom
## Multiple R-squared: 0.9817, Adjusted R-squared: 0.9813
## F-statistic: 2227 on 2 and 83 DF, p-value: < 2.2e-16
plot(Pt$DB2, Pt$H2, ylim=c(-3,25), xlim=c(0,40), xlab="DB (cm)", ylab="H (m)" )
curve(exp(-1.02124 + 1.149875 *log(x) - 0.009925*log(x)^2 ), from=0, to=30, add=TRUE, col=3, lwd=2)