5 Suppose I have an agricultural experiment with a field which I can divide

5 suppose i have an agricultural experiment with a

This preview shows page 4 - 5 out of 5 pages.

5. Suppose I have an agricultural experiment with a field which I can divide into 5 × 5 plots. I have 5 treatments, each a different density of mielie plants (I am interested in how close together I should plant them for maximum yield). What design should I use? What are the experimental units? Use R to randomly assign treatments to experimental units. 6. Categorical vs continuous variables: Suppose, for an experiment I have a treatment factor temperature with levels 50, 100, 150 and 200 C . Using the R code shown below, explain carefully how the parameter estimates and their meaning will differ when the following two linear models are fitted in R: a) temperature as a continuous variable, and b) temperature as a categorical variable. We first generate/simulate some data for the above fictional example: ob1 <- rnorm(5, mean = 5, sd = 2) ob2 <- rnorm(5, mean = 10, sd = 2) ob3 <- rnorm(5, mean = 15, sd = 2) ob4 <- rnorm(5, mean = 10, sd = 2) # the above code generates response values # for the 4 treatment groups, 5 values for each group # note all of the observations come from a normal distribution # with the same standard deviation # only the group means differ # -- to keep these data (or any data) in a spreadsheet or a data file # we need a column for each variable 4
Image of page 4
response <- c(ob1, ob2, ob3, ob4) # response treat <- rep(c(50, 100, 150, 200), each = 5) # treatment factor Make some plots of the data: boxplot(response ~ treat, xlab = "temperature", ylab = "response") plot(response ~ treat, xlab = "temperature", ylab = "response") Fit as a continuous variable: m1 <- lm(response ~ treat) summary(m1) abline(m1) Temperature as a categorical variable: temp <- as.factor(treat) m2 <- lm(response ~ temp) summary(m2) Compare the two models with respect to parameter estimates, degrees of freedom, residual standard deviation, estimate for response when temperature = 100 C. Are these two estimates the same? If not, why not? When would you use the one model, when the other? Most of the explanatory variables (treatment or blocking factors) in experiments will be cate- gorical. But every now and then we will come across a continuous variable, such as temperature, where we might want to fit a line, rather than get separate estimates for each level. 5
Image of page 5

You've reached the end of your free preview.

Want to read all 5 pages?

  • Summer '19
  • Randomness, researcher

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

Stuck? We have tutors online 24/7 who can help you get unstuck.
A+ icon
Ask Expert Tutors You can ask You can ask You can ask (will expire )
Answers in as fast as 15 minutes