Page 69, Problem 12

A company with a fleet of trucks faces increasing maintenance costs as the age and mileage of the trucks increase.

For the scenarios presented in problem 12, identify a problem worth studying and list the variables that affect the behavior you have identified. Which variables would be neglected completely? Which might be considered as constants initially? Can you identify any submodels you would want to study in detail? Identify any data you would want collected.

Problem worth studying

Mininmizing the total cost of maintenance of the trucks and the cost of replacing old trucks

List of variables that affect the behavior

Variables: 1)Number of trucks 2)Replacement cost of a truck 3)Total amount of work required of the fleet. 4)Variables for each truck: age, mileage

Variables to be neglected:

Type of loadings on the truck.

Which might be considered as constants initially?

Number of trucks in the fleet

Can you identify any submodels you would want to study in detail?

Our model at this point is simply modeling the increasing costs of maintaining an aging fleet of vehicles, and trying to minimize that cost. The dependent variables would be the mileage for each truck. The total amount of work required of the fleet would be a constraint, and work would be allocated among trucks of varying age and mileage.

If the maintenance costs are growing increasing,then replacing the truck would make more sense.

Data I would want collected:

I would collect the maintenance cost of each truck and use it to model relationship between age and mileage. The model would give me expected maintenance cost for each truck

Page 79, Problem 11

In problems 7-12, determine whether the data set supports the stated proportionality model.

\[ y \propto x^3 \]

library(reshape2)
library(ggplot2)
q11data <- data.frame(y=c(0,1,2,6,14,24,37,58,82,114), x=c(1,2,3,4,5,6,7,8,9,10))

q11data$ypred <- q11data$x^3

q11data$k <- q11data$y/q11data$ypred

k <- mean(q11data$k)

kadj <- mean(tail(q11data$k, -1))

q11data$ypredk <- k*(q11data$x^3)

q11data$ypredkadj <- kadj*(q11data$x^3)

q11data
##      y  x ypred          k     ypredk   ypredkadj
## 1    0  1     1 0.00000000  0.0963571   0.1070634
## 2    1  2     8 0.12500000  0.7708568   0.8565076
## 3    2  3    27 0.07407407  2.6016417   2.8907130
## 4    6  4    64 0.09375000  6.1668545   6.8520605
## 5   14  5   125 0.11200000 12.0446376  13.3829307
## 6   24  6   216 0.11111111 20.8131338  23.1257042
## 7   37  7   343 0.10787172 33.0504856  36.7227618
## 8   58  8   512 0.11328125 49.3348356  54.8164840
## 9   82  9   729 0.11248285 70.2443265  78.0492517
## 10 114 10  1000 0.11400000 96.3571009 107.0634454
library(reshape2)

library(ggplot2)

ggplot(melt(q11data, id=c("x", "k", "ypred", "ypredk")), aes(x=x, y=value, color=variable)) + 
geom_point()

This data set supports the stated proportionality model. The graph is based on an adjusted k, where I took the mean of the calculated constant disregarding the first 0 value.

Page 94, Problem 4

LumberCutters—Lumbercutterswishtousereadilyavailablemeasurementstoestimate the number of board feet of lumber in a tree. Assume they measure the diameter of the tree in inches at waist height. Develop a model that predicts board feet as a function of diameter in inches.

Use the following data for your test:

x <- c(17, 19, 20, 23, 25, 28,  32,  38,  39,  41)
y <- c(19, 25, 32, 57, 71, 113, 123, 252, 259, 294)

data <- data.frame(x, y)

The variable x is the diameter of a ponderosa pine in inches, and y is the number of board feet divided by 10. a. Consider two separate assumptions, allowing each to lead to a model. Completely analyze each model. i. Assume that all trees are right-circular cylinders and are approximately the same height.

The characteristic dimension of a cylinder is the diameter dd. The number of board feet is a function of the volume which is given by V=πr2hV=πr2h. Assuming that the radius is proportional to the diameter, we derive:

V∝r2∝d2 V∝r2∝d2

where hh is constant since all trees are the same height.

For this model we assume that all trees are of the same height so the volume is a function of the diameter squared which is the xx variable.

V∝d2 V∝d2 or y∝x2 y∝x2

where y=boardfeety=boardfeet and x=diameterx=diameter

Using this, we calculate proportionality using:

y∝x2y∝x2 if and only if y = kx^2 for a constant kk which leads to y∝x2y∝x2

Calculate the ratio of y/x^2

data$ratio <- data$y/data$x^2  

k <- (mean(data$ratio))
data$predicted <- k*data$x^2   

df <- rbind(data.frame(value = 'Actual', x = data$x, y = data$y),
            data.frame(value = 'Predicted', x = data$x, y = data$predicted))

ggplot(df, aes(x=x, y=y, color=value)) + geom_line()

  1. Assume that all trees are right-circular cylinders and that the height of the tree is proportional to the diameter.
  1. Which model appears to be better? Why? Justify your conclusions.

For this model we assume that the height of the tree is proportional to the diameter. From above, we have volume is proportional to diameter squared (V∝d2V∝d2). In this problem, we are to assume that hh is proportional to the diameter.

V∝d2∗h∝d3 V∝d2∗h∝d3

Therefore the volume of each tree is a proportional to the diameter cubed or V∝d3V∝d3.

y∝x3 y∝x3

where y=boardfeety=boardfeet and x=diameter

x <- c(17, 19, 20, 23, 25, 28,  32,  38,  39,  41)
y <- c(19, 25, 32, 57, 71, 113, 123, 252, 259, 294)

data <- data.frame(x, y)
data$ratio <- data$y/data$x^3

k <- mean(data$ratio)

data$predicted <- k*data$x^3
df <- rbind(data.frame(value = 'Actual', x = data$x, y = data$y),
            data.frame(value = 'Predicted', x = data$x, y = data$predicted))
 
ggplot(df, aes(x=x, y=y, color=value)) + geom_line()

The second model appears to be better. The fit of the model appears to be more accurate than compared to the first.