0
$\begingroup$

The following is from Hoff's "A First Course in Bayesian Statistical Methods" book.

enter image description here

The data set tplant mentioned above appears below.

enter image description here

I am trying to use an ordinary least squares to fit a regression line, modeling the plant height as a function of both time (measurement period) and pH level, but I have some concerns about my model. EDIT:

  1. I interpret the entries of column V2 to indicate the time period (0 or 1 - corresponding to the initial or latter height measurement); V3 indicates the pH levels (the duplicates appear since we are using the same pH for the second measurement); V1 indicates the height measurements (alternating between times 0 and 1).

  2. Based on 1), my linear model is $$y_i = \beta_1 x_{i1}+\beta_2 x_{i2}+\varepsilon_{i},$$ where $y_i$ is the height of the ith plant measurement, $i=1,...,20$ ; the values $x_{i1}$ correspond to the time period, so $x_{i1}=0$ if $i$ is odd and $x_{i1}=1$ otherwise; the values $x_{i2}$ correspond to column V3 (pH level).

I.e., $$11.80=y_1=\beta_{1}0+6.39\beta_{2}+\varepsilon_{1}=6.39\beta_{2}+\varepsilon_{1}\\ 11.54 = y_2 = \beta_{1}1+6.39\beta_{2}+\varepsilon_{2}=\beta_{1}+6.39\beta_{2}+\varepsilon_{2}\\ \vdots \\ 8.86 = y_{19}=\beta_{1}0+\beta_{2}2.02+\varepsilon_{19}=2.02\beta_2+\varepsilon_{19}\\ 12.24 = y_{20} = \beta_{1}1+\beta_{2}2.02+\varepsilon_{20} = \beta_{1}+2.02\beta_{2}+\varepsilon_{20} $$

$\endgroup$
5
  • 1
    $\begingroup$ Is your objective really to "model the plant height as a function of ... time"? One would suppose the purpose might instead be to analyze any relationship between plant growth and pH. BTW, V1 appears to be some kind of height measurement, V2 indexes the measurement (0=first, 1=second evidently), and V3 must be the pH--although I seriously doubt any plants are being grown in soils of pH 2! (Maybe these are fake data and this is a textbook exercise?) $\endgroup$
    – whuber
    Apr 2, 2021 at 18:29
  • $\begingroup$ I also found the part about time confusing. This is from a book, I've edited the post. $\endgroup$ Apr 2, 2021 at 18:32
  • $\begingroup$ There's not actually a question here. Anyway, it doesn't make sense to treat the the response as a random variable for the time-point V2=0 if we really consider that a "pre" condition. You should consider adjusting for the baseline height as a covariate and not a random response. A small plant will only grow so much compared to a tall one, and if you "know" the height at baseline, your predictions are far more precise. See also "ANCOVA" for pre post designs. $\endgroup$
    – AdamO
    Apr 2, 2021 at 21:56
  • $\begingroup$ Thanks @AdamO, I don't believe it will be a linear regression if I use ANCOVA. $\endgroup$ Apr 2, 2021 at 22:03
  • $\begingroup$ @IcedPalmer Indeed it will, ANOVA and ANCOVA typically refer to using categorical covariates for group assignment, but since the relationship with OLS has been recognized they're typically used interchangeably. ANCOVA is more precisely used when one adjusts for the baseline response as a covariate. $\endgroup$
    – AdamO
    Apr 2, 2021 at 22:05

1 Answer 1

3
$\begingroup$

@whuber is right - plants need a pH above 4.6 to grow, so this "toy" data set appears to contain implausible pH values for some of the plants. It's disappointing to see the book author didn't pay closer attention to this. It also makes it harder for you to learn statistical modelling when relying on an implausible dataset.

The dataset you are using is also not ideal for learning how to formulate linear regression models because it contains "pre" and "post" observations on plant height from the same tomato plant. We can expect these observations to be related for each plant, rather than independent. Linear regression modelling relies on the assumption of independence of observations (i.e., knowing something about one observation will tell you nothing about the other observations), which will clearly be invalidated in the type of model you are trying to formulate.

With these two caveats in place - implausible pH values and within-plant dependence of heights - you can still formulate a linear regression model just so that you learn how to formulate it (though meaning of model results would be suspect). In practice, if the data were plausible, you would need to correct the standard errors reported for each regression coefficient so they account for the grouping of height values by plant. This would allow you to report cluster-robust standard errors (where "cluster" refers to "plant").

Models you can fit include:

  1. $height_{ij} = \beta_0 + \beta_1 period_{ij} + \beta_2 pH_{ij} + \epsilon_{ij}$

  2. $height_{ij} = \beta_0 + \beta_1 period_{ij} + \beta_2 pH_{ij} + \beta_3 period_{ij} * pH_{ij} + \epsilon_{ij}$

Here, the index $i$ denotes the plant and the index $j$ denotes the time period for each plant. So $i$ runs from 1 to 20 and $j$ runs from 1 to 2. The star symbol denotes multiplication.

Both of these models, if you fit them using standard software, assume independence of height observations both within and across plants (something we know does NOT happen here, where we likely have dependence of height observations within plants). For example, in R, you can fit these two models with the commands:

    model1 <- lm(height ~ period + pH, data = plantdata) 

    model2 <- lm(height ~ period + pH + period:pH, data = plantdata) 

and summarize them with the commands:

    summary(model1)

    summary(model2) 

The first model postulates that the relationship between plant height and pH is the same in each of the two periods.

The second model postulates that the relationship between plant height and pH is different across periods.

Neither of these two models gets at what you want, which is to compare plant heights across periods within plants. For that, you can expand on these models by including a random effect of plant. The models would become linear mixed effects regression models rather than just linear regression models.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.