I've conducted a multiple linear regression with interaction in RStudio. In my data, I want to see how CL varies with depth and how/if CL (numerical) varies with depth (numerical) depending on the side the sample has been taken (medial or lateral/categorical).
I have used the code as follows:
my_data <- read.csv(file.choose())
Side <- factor(c("MED", "LAT"))
mlr <- lm(CL_002 ~ Depth * Side, data = my_data)
summary(mlr)
So you can see I have MED and LAT as variables in my data, under the category Side.
This gives me this result:
Call:
lm(formula = CL_002 ~ Depth * Side, data = my_data)
Residuals:
Min 1Q Median 3Q Max
-9.8106 -1.7643 -0.3233 1.4473 19.5799
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 2.531e+01 7.281e-02 347.586 <2e-16 ***
Depth 5.763e-04 4.293e-05 13.424 <2e-16 ***
SideMED 2.133e-01 8.734e-02 2.442 0.0146 *
Depth:SideMED -6.001e-04 4.962e-05 -12.096 <2e-16 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 2.545 on 14732 degrees of freedom
Multiple R-squared: 0.02404, Adjusted R-squared: 0.02384
F-statistic: 120.9 on 3 and 14732 DF, p-value: < 2.2e-16
I may be misinterpreting my results here, but why do I only get the results for the SideMED in terms of depth? So as I understand it, this shows that CL_002 changes significantly (p < 0.001) with depth:
Depth 5.763e-04 4.293e-05 13.424 <2e-16 ***
CL_002 is significantly different (p < 0.05) between each side
SideMED 2.133e-01 8.734e-02 2.442 0.0146 *
But does this mean that CL_002 varies significantly with depth and in different ways depending on the side? Or does this mean something else? As the summary only includes "SideMED" and does not mention the LAT side, I am confused.
Depth:SideMED -6.001e-04 4.962e-05 -12.096 <2e-16 ***
How do I get the estimates for the lateral side, as I appear to only have them for the medial?
Is this correct, or should I be using a different kind of regression as I have categorical data too?
TIA
Example data:
ID | Side | Depth | CL_002 |
---|---|---|---|
67.00 | LAT | 0.00 | 25.28 |
67.00 | LAT | 25.00 | 27.24 |
67.00 | LAT | 50.00 | 27.84 |
67.00 | LAT | 75.00 | 28.08 |
67.00 | LAT | 100.00 | 28.49 |
67.00 | MED | 0.00 | 21.48 |
67.00 | MED | 25.00 | 21.85 |
67.00 | MED | 50.00 | 21.85 |
67.00 | MED | 75.00 | 21.54 |
67.00 | MED | 100.00 | 22.21 |
68.00 | LAT | 0.00 | 22.83 |
68.00 | LAT | 25.00 | 23.46 |
68.00 | LAT | 50.00 | 24.21 |
68.00 | LAT | 75.00 | 24.97 |
68.00 | LAT | 100.00 | 27.53 |
68.00 | MED | 0.00 | 34.39 |
68.00 | MED | 25.00 | 27.92 |
68.00 | MED | 50.00 | 27.39 |
68.00 | MED | 75.00 | 26.77 |
68.00 | MED | 100.00 | 26.55 |