Medidas Repetidas: no paramétrico nparLD{style”color:red}

library(readxl)
Palma =read_excel("C:/Users/Cesar/Downloads/Palma.xlsx")

Palma
## # A tibble: 20 × 7
##    trt    AD10  AD20  AD30  AD40  AD50  AD60
##    <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
##  1 ctrl  1.09  1.20  2.53   4.27  5.47 10.7 
##  2 ctrl  0.956 1.05  2.22   3.75  4.80  8.66
##  3 ctrl  0.727 0.800 1.69   2.85  3.65  5.70
##  4 ctrl  1.12  1.23  2.60   4.39  5.62 11.1 
##  5 ctrl  0.901 0.992 2.09   3.53  4.53  7.91
##  6 ctrl  0.765 0.842 1.78   3.00  3.84  6.15
##  7 ctrl  0.875 0.963 2.03   3.43  4.39  7.55
##  8 ctrl  1.14  1.25  2.64   4.46  5.71 11.4 
##  9 ctrl  0.721 0.794 1.67   2.83  3.62  5.63
## 10 ctrl  1.02  1.12  2.37   4.00  5.13  9.62
## 11 quim  0.151 0.159 0.311  2.07  2.23  2.16
## 12 quim  0.196 0.206 0.405  1.94  2.14  2.10
## 13 quim  0.660 0.693 1.36   1.69  2.38  3.54
## 14 quim  0.502 0.527 1.04   2.09  2.62  3.17
## 15 quim  0.437 0.459 0.901  1.88  2.34  2.69
## 16 quim  0.767 0.805 1.58   1.73  2.54  4.23
## 17 quim  0.297 0.311 0.611  1.85  2.16  2.23
## 18 quim  0.301 0.316 0.621  2.11  2.43  2.50
## 19 quim  0.555 0.583 1.14   1.68  2.26  2.99
## 20 quim  0.614 0.644 1.26   2.00  2.65  3.60
library(reshape2)
## Warning: package 'reshape2' was built under R version 4.2.2
library(ggplot2)
library(dplyr)
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
df=melt(Palma,id.vars = "trt")
colnames(df)=c("trt","tiempo","AD")

df |>
  group_by(tiempo,trt) |> 
  summarise(AD=mean(AD)) |> 
  ggplot(aes(x=tiempo,y=AD,group=trt,color=trt))+
  geom_point(size=3)+
  geom_line(size=1)
## `summarise()` has grouped output by 'tiempo'. You can override using the
## `.groups` argument.

library(agricolae)
## Warning: package 'agricolae' was built under R version 4.2.2
dates<-c(14,21,28) # days
# example 1: evaluation - vector
evaluation<-c(40,80,90)
audps(evaluation,dates)
## evaluation 
##       1470
audps(evaluation,dates,"relative")
## evaluation 
##        0.7
x<-seq(10.5,31.5,7)
y<-c(40,80,90,90)
plot(x,y,"s",ylim=c(0,100),xlim=c(10,32),axes=FALSE,col="red" ,ylab="",xlab="")
title(cex.main=0.8,main="Absolute or Relative AUDPS\nTotal area=(31.5-10.5)*100=2100",
ylab="evaluation",xlab="dates" )
points(x,y,type="h")
z<-c(14,21,28)

points(z,y[-3],col="blue",lty=2,pch=19)
points(z,y[-3],col="blue",lty=2,pch=19)
axis(1,x,pos=0)
axis(2,c(0,40,80,90,100),las=2)
text(dates,evaluation+5,dates,col="blue")
text(14,20,"A = (17.5-10.5)*40",cex=0.8)
text(21,40,"B = (24.5-17.5)*80",cex=0.8)
text(28,60,"C = (31.5-24.5)*90",cex=0.8)
text(14,95,"audps = A+B+C = 1470")
text(14,90,"relative = audps/area = 0.7")

# It calculates audpc absolute
absolute<-audps(evaluation,dates,type="absolute")
print(absolute)
## evaluation 
##       1470
rm(evaluation, dates, absolute)