1
$\begingroup$

I have a data frame with two columns. One for height and one for genotype. Genotype is a categorical variable consisting of 4 levels (B3, ein9, ein194, ein9xein194) and height is a numerical continuous variable. Basically i want to see if the 4 genotypes are statically significant or not with respect to height. Can i do t.test for different combination such as B3 vs ein9, B3 vs ein194 and B3 vs ein9xein194 and so on?

Here is my data frame

> dput(data)
structure(list(height = c(21.794, 18.364, 17.594, 23.226, 
18.286, 17.35, 23.387, 16.639, 11.936, 13.985, 13.202, 12.92, 
18.105, 14.486, 29.666, 27.265, 25.847, 26.05, 26.211, 24.952, 
26.973, 33.803, 30.32, 30.078, 25.792, 37.102, 25.603, 22.766, 
29.087, 24.291, 27.133, 21.965, 23.476, 18.823, 21.638, 18.885, 
19.258, 19.475, 29.642, 25.921, 34.921, 30.796, 32.631, 29.194, 
28.733, 27.218, 25.732, 28.153, 29.293, 23.522), Genotype = structure(c(1L, 
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 3L, 3L, 3L, 
3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 2L, 2L, 2L, 2L, 2L, 2L, 
2L, 2L, 2L, 2L, 2L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 
4L), .Label = c("B3", "ein9", "ein194", "ein9xein194"), class = "factor")), .Names = c("height", 
"Genotype"), row.names = c(NA, -50L), class = "data.frame") 
$\endgroup$
  • 1
    $\begingroup$ "df" is a traditional abbreviation in statistical science for degrees of freedom and distribution function; usually the context makes clear which is intended. Please don't overload the term further with R-specific jargon for data frame. $\endgroup$ – Nick Cox May 5 '15 at 0:02
  • $\begingroup$ My bad. Edited accordingly.... $\endgroup$ – upendra May 5 '15 at 0:44
  • $\begingroup$ "see if the 4 genotypes are statically significant or not with respect to height" is unclear. Are you after a comparison of means adjusting for height, 4 tests of correlations with height, or something else? $\endgroup$ – Glen_b May 5 '15 at 1:16
  • $\begingroup$ Re your title: your questions of interest (what you want to know from the data) are central to what kind of test you want. Start with those. Details of the data are important, but data don't determine the questions. $\endgroup$ – Glen_b May 5 '15 at 1:18
0
$\begingroup$

If you are just looking to see if mean height varies with Genotype, you can run ANOVA

summary(aov(height ~ Genotype, data=df))

This gives a very small p-value of $1.69 * 10^{-11}$

If you want to know the amount of difference, consider a simple linear regression

fit <- lm(height ~ Genotype, data=df)
summary(fit)
plot(fit)

Everything looks statistically significant when I ran it. The Intercept coefficient estimate gives the expected height of the reference genotype. The other 3 coefficient estimates give the change in height from the reference genotype. For example, if the intercept is 17.2 and the coefficient for the second genotype is 5.2, then the expected height for genotype 2 is 22.4.

Unfortunately, the model only includes the estimates and p-values against the reference genotype. Getting the difference between two other genotypes is easy, but p-value is harder. For me, just changing the reference genotype would be the easiest thing to do.

Also, looking at the diagnostic plots, the Normal QQ plot doesn't look ideal to me. If you agree, consider doing a log transform of height and check your diagnostic plots again.This post has a great discussion about different options how to log transform your dependent variable. Just remember the interpretation of the coefficients change.

$\endgroup$
  • $\begingroup$ The output for summary of lm estimates the coefficients with respect to the reference. What if i am interested in testing to see the mean difference between ein9 vs ein194 as well as ein9 vs ein9xein194? $\endgroup$ – upendra May 5 '15 at 5:17
  • $\begingroup$ Sorry, I forgot to address that. For me, just changing the reference genotype would be the easiest thing to do. I've updated the answer. $\endgroup$ – Eric Farng May 5 '15 at 10:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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