https://github.com/cran/agricolae
Tip revision: 43f53bd983067301f9e8715e1b7c408ff3347c7e authored by Felipe de Mendiburu on 04 November 2013, 00:00:00 UTC
version 1.1-5
version 1.1-5
Tip revision: 43f53bd
audpc.R
`audpc` <-
function(evaluation, dates, type = "absolute") {
n<-length(dates)
k<-ncol(evaluation)
if (n!=k) {
cat("Error:\nThe number of dates of evaluation \nmust agree with the number of evaluations\n")
return()
}
audpc<-0
area.total<- 100*(dates[n]-dates[1])
for (i in 1:(n-1)) {
audpc<- audpc + (evaluation[,i]+evaluation[,i+1])*(dates[i+1]-dates[i])/2
}
if (type == "relative" ) audpc <-audpc/area.total
if (type =="absolute" | type =="relative" ) {
return(audpc)
}
else cat("Error: type is 'absolute' or 'relative'\n\n")
}