This file contains 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
#For the findings of the proposed study of diagnostic accuracy to be robust, we require a minimum number of infected and uninfected cases. The total number of samples required to accurately evaluate the diagnostic devices can be calculated4 using the formula | |
#p the expected sensitivity of the novel diagnostic | |
p<-0.99 | |
# po is the minimum acceptable level of sensitivity | |
#pick one of these or use your own value(s) | |
po<-0.98 |
This file contains 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
require(season) | |
# use glm model in the first part, date can be full date or month (1-12), | |
res = cosinor(response~exposures+exposures2+exposures3, date=month, data=df,family=binomial(link='cloglog'),type = "monthly",cycles = 1) | |
summary(res) | |
plot(res) | |
This file contains 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
#draws a 96 cell grid in R and adds some data to the cells : useful for drawing plate maps for 96 well laboratory plates | |
title="PLATE X" | |
values<-paste(c("A","B","C"),1:3,sep="\n") | |
verticals<-c(rep(7.5,12),rep(6.5,12),rep(5.5,12),rep(4.5,12),rep(3.5,12),rep(2.5,12),rep(1.5,12),rep(0.5,12)) | |
h2<-rep(seq(0.5,11.5,1),8) | |
#draw the grid | |
plot(c(0,12),c(0,8),pch=0,col="white",axes=FALSE,xlab="",ylab="") | |
abline(v=c(0:12)) |
This file contains 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
#Run a set of polynomial models on some x vs y data. | |
#create a data set x and y | |
x<-1:1100 | |
y<-sqrt(x^6+x/x^4)+x/x^x | |
#Define function to run models | |
polyfit<-function(x,order,raw=TRUE) | |
{ | |
fit<-lm(y~poly(x,order,raw=raw)) |
NewerOlder