-
Notifications
You must be signed in to change notification settings - Fork 0
/
aula13.qmd
80 lines (65 loc) · 1.37 KB
/
aula13.qmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
---
title: "aula13"
author: "ARLAM"
format: html
editor_options:
chunk_output_type: inline
#| warning: false
#| message: false
---
# carrega pacotes
```{r}
library(tidyverse)
library(readxl)
estande <- read_excel("C:dados-diversos.xlsx", "estande")
estande |>
ggplot(aes(trat, nplants, group = exp))+
geom_point()+
#facet_wrap(~exp)+
ylim(0,max(estande$nplants))+
geom_smooth(se = F, method = "lm")
```
#Modelos mistos
```{r}
exp1 <- estande |>
filter(exp == 1)
m1 <- lm(nplants ~ trat, data = exp1)
summary(m1)
exp2 <- estande |>
filter(exp == 2)
m2 <- lm(nplants ~ trat, data = exp2)
summary(m2)
exp3 <- estande |>
filter(exp == 3)
m3 <- lm(nplants ~ trat, data = exp3)
summary(m3)
g1 <- exp1 |>
ggplot(aes(trat, nplants))+
geom_point()+
geom_abline(intercept = 52.5,
slope = -0.24) +
ylim(0, max(estande$nplants))+
# geom_smooth(method = "lm", se = F)+
theme_bw()+
annotate(geom = "text", x = 24,
y = 70, label = "y = 52.5 - 0.24x")
g2 <- exp3 |>
ggplot(aes(trat, nplants))+
geom_point()+
ylim(0, max(estande$nplants))+
geom_smooth(method = "lm", se = F)+
annotate(geom = "text", x = 24,
y = 70, label = "y = 52.5 - 0.24x")
library(patchwork)
g1 + g2
```
#
```{r}
library(lme4)
mix <- lmer(nplants ~ trat + (trat | exp),
data = estande)
summary(mix)
library(car)
Anova(mix)
```
#