Use the pressure data to fit a model with pressure as the response and temperature as the predictor. Use the Box-Cox method to determine the best transformation on the response.
library(faraway)
data(pressure)
plot(pressure$temperature, pressure$pressure)
lmodt <- lm(pressure ~ temperature, data=pressure)
library(MASS)
boxcox(lmodt, plotit=T)
boxcox(lmodt, lambda=seq(0.05,0.15,by=0.001), plotit=T)
Maximum transformation at lambda=0.12
plot(pressure$temperature, pressure$pressure^0.12)
lmodt2 = lm(pressure^0.12 ~ temperature, data=pressure)
abline(lmodt2$coefficients)
x = seq(0,360,by=0.1)
y = (lmodt2$coeff[1]+lmodt2$coeff[2]*x)^(1/0.12)
plot(pressure$temperature, pressure$pressure)
lines(x,y)
summary(lmodt2)
##
## Call:
## lm(formula = pressure^0.12 ~ temperature, data = pressure)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.0175875 -0.0087058 -0.0001531 0.0083502 0.0212483
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 3.386e-01 4.773e-03 70.94 <2e-16 ***
## temperature 5.309e-03 2.265e-05 234.37 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.01082 on 17 degrees of freedom
## Multiple R-squared: 0.9997, Adjusted R-squared: 0.9997
## F-statistic: 5.493e+04 on 1 and 17 DF, p-value: < 2.2e-16
we can write an eqution of the model from these intercepts for the reponse of pressure^0.12