This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# author: ljsa @ cin.ufpe.br | |
# sd = Standart deviation | |
# confidence = (0~1) | |
# Obj: ver se o estado esta dentro da area de confianca da media | |
plotNorm = function(mean, sd, confidence){ | |
curve (dnorm(x, mean, sd), xlim = c(mean - (3*sd), mean + (3*sd))); | |
left = (1-confidence)/2; | |
right = confidence + L; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# author: ljsa @ cin.ufpe.br | |
# two decimal places | |
decimal = function (number){ | |
return(format(round(number, 2), nsmall = 2)); | |
} | |
# cast function | |
character = function (text){ | |
return(as.character(decimal(text))); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# author: ljsa @ cin.ufpe.br | |
# dataset = vector of numbers | |
mode = function (dataset) { | |
dataset = sort(dataset); | |
maxTam = 1; | |
curTam = 0; | |
counter = 2; | |
lastMode = dataset[1]; |