title: ‘Assignment #4’ subtitle: ‘Chapter 5’ author: “Gael Tshilombo Manya” date: “2/14/2023”

5-1. Which of the linear models below are multiple linear regressions? \[\begin{align} {μ_i = α + βx_i} \tag{1}\\ μ_i = β_xx_i + β_zz_i \tag{2} \\ μ_i = α + β(x_i − z_i) \tag{3} \\ μ_i = α + β_xx_i + β_zz_i \tag{4} \\ \end{align}\]

# The second and third linear models are multiple linear regressions

5-2. Write down a multiple regression to evaluate the claim: Neither amount of funding nor size of laboratory is by itself a good predictor of time to PhD degree; but together these variables are both positively associated with time to degree. Write down the model definition and indicate which side of zero each slope parameter should be on.

#With F representing the funding and S representing the size of Laboratory the following will be my linear regression.
#ui = α + βfFi + βsSi
#Both parameters βf and βs should be positive, meaning > 0.

5-3. It is sometimes observed that the best predictor of fire risk is the presence of firefighters— States and localities with many firefighters also have more fires. Presumably firefighters do not cause fires. Nevertheless, this is not a spurious correlation. Instead fires cause firefighters. Consider the same reversal of causal inference in the context of the divorce and marriage data. How might a high divorce rate cause a higher marriage rate? Can you think of a way to evaluate this relationship, using multiple regression?

#My approach on this would be that an increased number of divorces causes a new supply of single individuals in the dating pool and therefore increases the possibility of divorced individuals to remarry either non-previously-divorced individuals or previously-divorced individuals. This can be evaluated using a multiple regression by regressing the marriage rate on both re-marriage rate and divorce rate. If it happens that the rate of divorce can no longer predict marriage rate despite the re-marriage rate being known, then this would support our approach.

5-4. Suppose you have a single categorical predictor with 4 levels (unique values), labeled A, B, C and D. Let Ai be an indicator variable that is 1 where case i is in category A. Also suppose Bi, Ci, and Di for the other categories. Now which of the following linear models are inferentially equivalent ways to include the categorical variable in a regression? Models are inferentially equivalent when it’s possible to compute one posterior distribution from the posterior distribution of another model. \[\begin{align} μ_i = α + β_AA_i + β_BB_i + β_DD_i \tag{1}\\ μ_i = α + β_AA_i + β_BB_i + β_CC_i + β_DD_i \tag{2}\\ μ_i = α + β_BB_i + β_CC_i + β_DD_i \tag{3}\\ μ_i = α_AA_i + α_BB_i + α_CC_i + α_DD_i \tag{4}\\ μ_i = α_A(1 − B_i − C_i − D_i) + α_BB_i + α_CC_i + α_DD_i \tag{5}\\ \end{align}\]

# Model 1 includes a single intercept for C and slopes for A, B, and D.

# Model 2 includes slopes for all A,B.C, and D.

# model 3 includes a single intercept for A and slopes for B, C, and D.

# model 4 includes separate intercepts for A, B, C and D and no slopes.

# model 5 multiplies the intercept for category A  by 1 when in category A and multiplied by 0 when not.

# Models 1, 3, 4, and 5 are inherently equivalent as they allow the computation of each other’s posterior distribution.

5-5. One way to reason through multiple causation hypotheses is to imagine detailed mechanisms through which predictor variables may influence outcomes. For example, it is sometimes argued that the price of gasoline (predictor variable) is positively associated with lower obesity rates (outcome variable). However, there are at least two important mechanisms by which the price of gas could reduce obesity. First, it could lead to less driving and therefore more exercise. Second, it could lead to less driving, which leads to less eating out, which leads to less consumption of huge restaurant meals. Can you outline one or more multiple regressions that address these two mechanisms? Assume you can have any predictor data you need.

#For the first hypothesis, we can include the predictor variable of the average distance that person walks weekly
# For the second hypothesis, we can include an average number of times a person eats out per week