Multiple Linear Regression in R

Asked

Viewed 200 times

2

Hello, I have data (https://drive.google.com/open?id=1JdgsnJn5VrkL8j1BsfWzqYW9fMGXND6U) of a completely randomized experiment, in which the fungal growth in response to the application of different doses (0.25, 0.50, 0.75 and 1.00) of different fungicides (4 natural + 1 chemical + control with water). In total there were 24 treatments x 4 repetitions each.

As I do not have mastery of R, I would like to know the appropriate script to perform ANOVA, regression and generate the charts already adjusted for each situation.

Sincerely yours

1 answer

4


dados <- read.table('IVCM.txt', header = TRUE)

regLin <- lm(IVCM ~ TRAT * RE, dados)
# o asterisco na fórmula indica que é para calcular também a interação
# você pode usar "+" no lugar se quiser o cálculo sem interação

summary(regLin)  # resumo do modelo

anova(regLin)  # tabela ANOVA

par(mfrow=c(2,2)); plot(regLin)  # gráficos de avaliação

Remember to check the model assumptions and the fit. In your example data, the residues do not follow Normal distribution, among other things. You can try a generalized linear model: it is run in R using the function glm, which uses the same formula syntax, but with the added to specify the probability function.

An excellent guide to linear models in R (English) is chapter 9 of the book "Ecological Models and Data in R". It is available in PDF on the author’s website: https://ms.mcmaster.ca/~bolker/emdbook/

  • Thank you @Carlos, your recommendations have helped me solve the problem. Yours sincerely!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.