Tutorial nparLD
resp = Altura de planta time = semanal Diseño LD-F1
library("nparLD")
## Warning: package 'nparLD' was built under R version 4.2.2
## Loading required package: MASS
data("dental")
head(dental)
## resp boys time subject
## 1 26.0 12 8 1
## 2 21.5 13 8 2
## 3 23.0 14 8 3
## 4 25.5 15 8 4
## 5 20.0 16 8 5
## 6 24.5 17 8 6
alturas=dental
Gráfica
boxplot(resp ~ time, data = alturas,
lwd = 2,
xlab = "Tiempo(semanas)",
ylab="Altura (cm)", font.lab = 2,
cex.lab = 2,
main = "Diagrama de caja")
Ho: ER8=ER10=ER12=ER14
mod1LD <- nparLD(resp ~ time,
data = alturas,
subject = "subject",
description = FALSE)
## LD F1 Model
## -----------------------
## Check that the order of the time level is correct.
## Time level: 8 10 12 14
## If the order is not correct, specify the correct order in time.order.
summary(mod1LD)
## Model:
## LD F1 Model
##
## Call:
## resp ~ time
##
## Relative Treatment Effect (RTE):
## RankMeans Nobs RTE
## time8 19.06250 16 0.2900391
## time10 24.31250 16 0.3720703
## time12 37.03125 16 0.5708008
## time14 49.59375 16 0.7670898
##
## Wald-Type Statistc (WTS):
## Statistic df p-value
## time 94.47718 3 2.391503e-20
##
## ANOVA-Type Statistc (ATS):
## Statistic df p-value
## time 31.48774 2.700785 1.437729e-18
plot(mod1LD)
library(ggplot2)
library(dplyr)
##
## Attaching package: 'dplyr'
## The following object is masked from 'package:MASS':
##
## select
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
alturas |>
group_by(time) |>
summarise(medias=mean(resp),
desv=sd(resp)) |>
ggplot(aes(x=time,y=medias,group=1))+
geom_point()+
geom_line()
data("rat")
boxplot(resp ~ group * time, data = rat, names = FALSE,
col = c("grey", 2, 3), lwd = 2)
axis(1, at = 2, labels = "Time 0", font = 2, cex = 2)
axis(1, at = 5, labels = "Time 1", font = 2,cex = 2)
axis(1, at = 8, labels = "Time 2", font = 2,cex = 2)
axis(1, at = 11, labels = "Time 3", font = 2,cex = 2)
axis(1, at = 14, labels = "Time 4", font = 2,cex = 2)
legend(1, 190, c("Control", "15:15:15", "Gallinaza"), lwd = c(3, 3, 3),
col = c("grey", 2, 3), cex = 1)
levels(rat$group)=c("Control", "15:15:15", "Gallinaza")
mod2LD <- nparLD(resp ~ time * group, data = rat,
subject = "subject", description = FALSE)
## F1 LD F1 Model
## -----------------------
## Check that the order of the time and group levels are correct.
## Time level: 0 1 2 3 4
## Group level: Control Gallinaza 15:15:15
## If the order is not correct, specify the correct order in time.order or group.order.
plot(mod2LD)