Compare commits
37 Commits
7250a00adc
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| d450000178 | |||
| 5071896110 | |||
| abf02ef4ec | |||
| f5575f8429 | |||
| 058027f721 | |||
| b2eb61a820 | |||
| 4cfdc288a8 | |||
| 4cfda9d162 | |||
| c480111552 | |||
| cf1ce314e1 | |||
| 3afd241dfc | |||
| c14e919a18 | |||
| 12eabc4d0c | |||
| e71cfd1b6a | |||
| 69e3545ac7 | |||
| 5254900810 | |||
| 8106bed956 | |||
| d44c88eef7 | |||
| 18433be282 | |||
| 335dfc653d | |||
| 1b3af203a2 | |||
| a69a7db1b7 | |||
| b5bad4ed0f | |||
| 18661b8d0c | |||
| 7a75b53b5b | |||
| b0cf97a5ee | |||
| b38e60e1a3 | |||
| 57a726ed27 | |||
| 420c78d4c4 | |||
| 9ff1a360d4 | |||
| ec13d95387 | |||
| 9422490f25 | |||
| 9861af5fba | |||
| 1555fe3b6c | |||
| a4bdbe8f8c | |||
| e4b054d2d6 | |||
| bc678b2525 |
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"TabSet1": 0,
|
||||
"TabSet2": 3,
|
||||
"TabSet2": 1,
|
||||
"TabZoom": {},
|
||||
"Sidebar": 0
|
||||
}
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
{
|
||||
"source_window_id": "",
|
||||
"Source": "Source",
|
||||
"cursorPosition": "2155,38",
|
||||
"scrollLine": "2145",
|
||||
"cursorPosition": "2726,27",
|
||||
"scrollLine": "2716",
|
||||
"docOutlineVisible": "1",
|
||||
"docOutlineSize": "118"
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
{
|
||||
"id": "3F7244B6",
|
||||
"path": null,
|
||||
"project_path": null,
|
||||
"type": "r_dataframe",
|
||||
"hash": "0",
|
||||
"contents": "",
|
||||
"dirty": false,
|
||||
"created": 1778393027500.0,
|
||||
"source_on_save": false,
|
||||
"relative_order": 6,
|
||||
"properties": {
|
||||
"expression": "slopeSt",
|
||||
"caption": "slopeSt",
|
||||
"totalObservations": "10",
|
||||
"displayedObservations": "10",
|
||||
"variables": "2",
|
||||
"cacheKey": "B95B358D",
|
||||
"object": "slopeSt",
|
||||
"environment": "_rs_no_env",
|
||||
"contentUrl": "grid_resource/gridviewer.html?env=_rs_no_env&obj=slopeSt&cache_key=B95B358D&max_display_columns=50",
|
||||
"preview": "0",
|
||||
"source_window_id": "",
|
||||
"Source": "Source"
|
||||
},
|
||||
"folds": "",
|
||||
"lastKnownWriteTime": 0,
|
||||
"encoding": "",
|
||||
"collab_server": "",
|
||||
"source_window": "",
|
||||
"last_content_update": 1778393027500,
|
||||
"read_only": false,
|
||||
"read_only_alternatives": []
|
||||
}
|
||||
+5
-5
@@ -3,7 +3,7 @@
|
||||
"path": "~/plateflow/NewApp/app.R",
|
||||
"project_path": "app.R",
|
||||
"type": "r_source",
|
||||
"hash": "2785151077",
|
||||
"hash": "1413864872",
|
||||
"contents": "",
|
||||
"dirty": false,
|
||||
"created": 1777232335294.0,
|
||||
@@ -12,17 +12,17 @@
|
||||
"properties": {
|
||||
"source_window_id": "",
|
||||
"Source": "Source",
|
||||
"cursorPosition": "2155,38",
|
||||
"scrollLine": "2145",
|
||||
"cursorPosition": "2726,27",
|
||||
"scrollLine": "2716",
|
||||
"docOutlineVisible": "1",
|
||||
"docOutlineSize": "118"
|
||||
},
|
||||
"folds": "",
|
||||
"lastKnownWriteTime": 1777839495,
|
||||
"lastKnownWriteTime": 1778405820,
|
||||
"encoding": "UTF-8",
|
||||
"collab_server": "",
|
||||
"source_window": "",
|
||||
"last_content_update": 1777839495532,
|
||||
"last_content_update": 1778405820161,
|
||||
"read_only": false,
|
||||
"read_only_alternatives": []
|
||||
}
|
||||
+122
-109
@@ -1096,18 +1096,25 @@ server <- function(input, output, session) {
|
||||
tabPanel("linear Analysis",
|
||||
sidebarLayout(
|
||||
sidebarPanel(
|
||||
width=3,
|
||||
width=2,
|
||||
fluidRow(
|
||||
column(6,
|
||||
column(12,
|
||||
numericInput("Limits",p("limit to be >", bsButton("q4",label="", icon=icon("info"), style="primary", size="extra-small")),
|
||||
bsPopover(id="q4", title="", content="The calculated limits ...")))
|
||||
bsPopover(id="q4", title="", content="The calculated limits ...")),
|
||||
checkboxGroupInput("selectedSSTsLinear", "Which suitability tests to be used?",
|
||||
choices= c("F-test on Regr."="1",
|
||||
"F-test on non-linearity"= "2",
|
||||
"F-test on R^2 A"= "3","F-test on R^2 B"= "4",
|
||||
"F-test on slope A"= "5", "F-test on slope B"="6",
|
||||
"F-test on non-parallelism"= "7", "F-test on preparation"="8"),
|
||||
selected= c("1","2","3","4","5","6","7","8")),
|
||||
)
|
||||
)),
|
||||
mainPanel(
|
||||
tabsetPanel(id="tabs",
|
||||
tabPanel("linear PLA",
|
||||
box(title="ANOVA table", status="primary",solidHeader = T, width=12,
|
||||
tableOutput("Anovatab")),
|
||||
column(6,
|
||||
|
||||
column(12,
|
||||
htmlOutput("PureErrW3"),
|
||||
tags$head(tags$style("#PureErrW3{color: red;
|
||||
font-size: 16px;
|
||||
@@ -1118,18 +1125,19 @@ server <- function(input, output, session) {
|
||||
h4("Unrestricted linear model (SSSI):"),
|
||||
tableOutput("SummaryModABu"),
|
||||
h4("Restricted linear model (CSSI):"),
|
||||
tableOutput("SummaryModAB")),
|
||||
column(3,
|
||||
tableOutput("SummaryModAB"),
|
||||
|
||||
h3("Tests for linear PLA):"),
|
||||
DT::dataTableOutput("TESTSlin"),
|
||||
box(title="Suitability tests", status="primary",solidHeader = T, width=12,
|
||||
DTOutput("TESTSlin")),
|
||||
h5("The estimate is the p-value of the test"),
|
||||
h5("F-tests on regression, significance of slopes, and preparation need to have a p-value <0.05 to pass"),
|
||||
h5("All other tests pass if p-value > 0.05"),
|
||||
"SST CI for difference of slopes:",
|
||||
tableOutput("SlopeDiffCI")),
|
||||
column(3,
|
||||
tableOutput("SlopeDiffCI"),
|
||||
|
||||
h3("ANOVA for parallel line assay"),
|
||||
DT::dataTableOutput("ANOVAlin"))),
|
||||
DTOutput("ANOVAlin"))),
|
||||
tabPanel("Report",
|
||||
h4("Settings for report")
|
||||
))
|
||||
@@ -1489,6 +1497,7 @@ server <- function(input, output, session) {
|
||||
coeffsMR <- Smr$coefficients[,1]
|
||||
coeffsMU <- Smu$coefficients[,1]
|
||||
Dat$coeffsMRes <- coeffsMR
|
||||
Dat$coeffsMUnr <- coeffsMU
|
||||
names(coeffsMU) <- c("lowAsym REF", "slope REF","upperAsym REF","EC50 REF","lowAsym TEST","slope TEST","upperAsym TEST","r")
|
||||
|
||||
if (!PureErrFlag) {
|
||||
@@ -2150,102 +2159,106 @@ server <- function(input, output, session) {
|
||||
#### linear Plot output ----
|
||||
|
||||
output$plotLin <- renderPlot({
|
||||
|
||||
tab <- Dat$EXCEL
|
||||
|
||||
# tab <- sim2()
|
||||
# if (is.character(tab)) stop(tab)
|
||||
# #browser()
|
||||
# if (!is.na(Dils()[4])) noDilSer <- Dils()[4] else noDilSer = (ncol(tab)-1)/2
|
||||
# Conc <- CONC()
|
||||
# Conctab <- Dat$Conctab
|
||||
if (is.character(tab)) stop(tab)
|
||||
#browser()
|
||||
log_conc <- tab$log_dose
|
||||
noDilSer = (ncol(tab)-1)/2
|
||||
noDil <- nrow(tab)
|
||||
Conctab <- perConcTab(tab, noDilSer)
|
||||
# if (!is.na(Dils()[3])) noDil <- Dils()[3] else noDil = length(Conc)
|
||||
#
|
||||
# slopeSt <- slopeTe <- matrix(NA, nrow=noDil-2,ncol=2)
|
||||
# for (i in 1:(noDil-2)) {
|
||||
# avs <- Conctab[noDilSer+1,]
|
||||
# threes <- data.frame(lnC=log(Conc[i:(i+2)]), resp=avs[i:(i+2)])
|
||||
# lm3St <- lm(resp ~ lnC, data=threes)
|
||||
# slopeSt[i,] <- lm3St$coefficients
|
||||
# avt <- Conctab[noDilSer*2+4,]
|
||||
# threet <- data.frame(lnC=log(Conc[i:(i+2)]), resp=avt[i:(i+2)])
|
||||
# lm3Te <- lm(resp ~ lnC, data=threet)
|
||||
# slopeTe[i,] <- lm3Te$coefficients
|
||||
# }
|
||||
#
|
||||
# indS <- which(abs(slopeSt[,2]) == max(abs(slopeSt[,2])))
|
||||
# indT <- which(abs(slopeTe[,2]) == max(abs(slopeTe[,2])))
|
||||
#
|
||||
# pl_ <- slopeSt[indS,1]+slopeSt[indS,2]*log(Conc)
|
||||
# pl_T <- slopeTe[indT,1]+slopeTe[indT,2]*log(Conc)
|
||||
# pl_df <- data.frame(lnC=log(Conc), plotS=pl_, plotT=pl_T)
|
||||
#
|
||||
# all_l <- melt(data.frame(tab), id.vars="log_dose",variable.name="replname",value.name="readout")
|
||||
# isRef <- rep(c(1,0), 1,each=nrow(all_l)/2)
|
||||
# isSample <- rep(c(0,1), 1,each=nrow(all_l)/2)
|
||||
# all_l2 <- cbind(all_l,isRef, isSample)
|
||||
# all_l2S <- all_l2[all_l2$isRef == 1,]
|
||||
# all_l2T <- all_l2[all_l2$isRef == 0,]
|
||||
# all_mS <- all_l2S[order(all_l2S$log_dose, decreasing=TRUE),]
|
||||
# all_mT <- all_l2T[order(all_l2T$log_dose, decreasing=TRUE),]
|
||||
#
|
||||
# circleS <- all_mS[(indS*noDilSer-(noDilSer-1)):((indS+2)*noDilSer),]
|
||||
# circleT <- all_mT[(indT*noDilSer-(noDilSer-1)):((indT+2)*noDilSer),]
|
||||
# circle <- rbind(circleS,circleT)
|
||||
#
|
||||
# Dat$circles <- circle
|
||||
# sigmoid <- sigmoid()
|
||||
# log_dose <- unique(all_l$log_dose)
|
||||
# seq_x <- seq(min(log_dose), max(log_dose),0.1)
|
||||
# SAMPLEtrue <- sigmoid[2] + (sigmoid[4]-sigmoid[2])/(1+exp(sigmoid[6]*((sigmoid[7]-log(input$potencydiff/100)-seq_x))))
|
||||
# REFtrue <- sigmoid[1] + (sigmoid[3]-sigmoid[1])/(1+exp(sigmoid[5]*((sigmoid[7]-seq_x))))
|
||||
#
|
||||
# truePL_df <- cbind(seq_x,SAMPLEtrue, REFtrue)
|
||||
#
|
||||
# p <- ggplot(all_l2,aes(x=log_dose,y=readout, color=factor(isRef))) +
|
||||
# geom_point() +
|
||||
# labs(title=paste("linear regression model", indS,indT), color="product") +
|
||||
# scale_colour_manual(labels = c("test","reference"), values=c("red","blue")) +
|
||||
# ylim(min(all_l2$readout),max(all_l2$readout)) +
|
||||
# theme_bw()
|
||||
# p2 <- p + geom_line(data=pl_df,aes(x=lnC,y=plotS),color="blue",
|
||||
# inherit.aes = F) +
|
||||
# geom_line(data=pl_df,aes(x=lnC,y=plotT),color="red",
|
||||
# inherit.aes = F) +
|
||||
# geom_line(data=data.frame(truePL_df),aes(x=seq_x,y=SAMPLEtrue),color="red", linetype=2,alpha=0.4,
|
||||
# inherit.aes = F) +
|
||||
# geom_line(data=data.frame(truePL_df),aes(x=seq_x,y=REFtrue),color="blue", linetype=2,alpha=0.4,
|
||||
# inherit.aes = F) +
|
||||
# labs(title = paste("unrestricted linear regression model",indS,indT), color="product") +
|
||||
# theme(legend.position="none", axis.text = element_text(size=14))
|
||||
# p3 <- p2 + geom_point(circle, mapping=aes(x=log_dose, y=readout, shape=factor(isRef),
|
||||
# size=5,alpha=0.2), inherit.aes = FALSE) +
|
||||
# scale_shape_manual(labels=c("test","reference"), values=c(21,21))
|
||||
#
|
||||
# mLin <- gsl_nls(readout ~ (intS+r)*isSample + intS*isRef + k*log_dose,
|
||||
# data=circle,
|
||||
# start=list(intS = 0, k=1,r=0),
|
||||
# control = gsl_nls_control(xtol=1e-10,ftol=1e-10,gtol=1e-10))
|
||||
# # alternativ: modAB <- lm(readout ~ log_dose+isSample, circle)
|
||||
# sum_mLin <- summary(mLin)
|
||||
#
|
||||
# pl_restS <- sum_mLin$coefficients[1,1] + sum_mLin$coefficients[2,1]*log(Conc)
|
||||
# pl_restT <- sum_mLin$coefficients[1,1] + sum_mLin$coefficients[3,1] + sum_mLin$coefficients[2,1]*log(Conc)
|
||||
# pl_rest <- data.frame(lnC=log(Conc), plotS=pl_restS, plotT=pl_restT)
|
||||
#
|
||||
# pr2 <- p + geom_line(data=pl_rest,aes(x=lnC,y=plotS),color="blue",
|
||||
# inherit.aes = F) +
|
||||
# geom_line(data=pl_rest,aes(x=lnC,y=plotT),color="red",
|
||||
# inherit.aes = F) +
|
||||
# geom_line(data=data.frame(truePL_df),aes(x=seq_x,y=SAMPLEtrue),color="red", linetype=2,alpha=0.4,
|
||||
# inherit.aes = F) +
|
||||
# geom_line(data=data.frame(truePL_df),aes(x=seq_x,y=REFtrue),color="blue", linetype=2,alpha=0.4,
|
||||
# inherit.aes = F) +
|
||||
# labs(title = paste("restricted linear regression model",indS,indT), color="product") +
|
||||
# theme(legend.position="none", axis.text = element_text(size=14))
|
||||
# pr3 <- pr2 + geom_point(circle, mapping=aes(x=log_dose, y=readout, shape=factor(isRef),
|
||||
# size=5,alpha=0.2), inherit.aes = FALSE) +
|
||||
# scale_shape_manual(labels=c("test","reference"), values=c(21,21))
|
||||
# grid.arrange(p3,pr3,nrow=1)
|
||||
slopeSt <- slopeTe <- matrix(NA, nrow=noDil-2,ncol=2)
|
||||
for (i in 1:(noDil-2)) {
|
||||
avs <- Conctab[noDilSer+1,]
|
||||
threes <- data.frame(lnC=log_conc[i:(i+2)], resp=avs[i:(i+2)])
|
||||
lm3St <- lm(resp ~ lnC, data=threes)
|
||||
slopeSt[i,] <- lm3St$coefficients
|
||||
avt <- Conctab[noDilSer*2+4,]
|
||||
threet <- data.frame(lnC=log_conc[i:(i+2)], resp=avt[i:(i+2)])
|
||||
lm3Te <- lm(resp ~ lnC, data=threet)
|
||||
slopeTe[i,] <- lm3Te$coefficients
|
||||
}
|
||||
|
||||
indS <- which(abs(slopeSt[,2]) == max(abs(slopeSt[,2])))
|
||||
indT <- which(abs(slopeTe[,2]) == max(abs(slopeTe[,2])))
|
||||
|
||||
pl_ <- slopeSt[indS,1]+slopeSt[indS,2]*log_conc
|
||||
pl_T <- slopeTe[indT,1]+slopeTe[indT,2]*log_conc
|
||||
pl_df <- data.frame(lnC=log_conc, plotS=pl_, plotT=pl_T)
|
||||
|
||||
all_l <- melt(data.frame(tab), id.vars="log_dose",variable.name="replname",value.name="readout")
|
||||
isRef <- rep(c(1,0), 1,each=nrow(all_l)/2)
|
||||
isSample <- rep(c(0,1), 1,each=nrow(all_l)/2)
|
||||
all_l2 <- cbind(all_l,isRef, isSample)
|
||||
all_l2S <- all_l2[all_l2$isRef == 1,]
|
||||
all_l2T <- all_l2[all_l2$isRef == 0,]
|
||||
all_mS <- all_l2S[order(all_l2S$log_dose, decreasing=TRUE),]
|
||||
all_mT <- all_l2T[order(all_l2T$log_dose, decreasing=TRUE),]
|
||||
|
||||
circleS <- all_mS[(indS*noDilSer-(noDilSer-1)):((indS+2)*noDilSer),]
|
||||
circleT <- all_mT[(indT*noDilSer-(noDilSer-1)):((indT+2)*noDilSer),]
|
||||
circle <- rbind(circleS,circleT)
|
||||
|
||||
Dat$circles <- circle
|
||||
#browser()
|
||||
mLin <- gsl_nls(readout ~ (intS+r)*isSample + intS*isRef + k*log_dose,
|
||||
data=circle,
|
||||
start=list(intS = 0, k=1,r=0),
|
||||
control = gsl_nls_control(xtol=1e-10,ftol=1e-10,gtol=1e-10))
|
||||
# alternativ: modAB <- lm(readout ~ log_dose+isSample, circle)
|
||||
sum_mLin <- summary(mLin)
|
||||
sigmoid <- Dat$coeffsMUnr
|
||||
log_dose <- unique(all_l$log_dose)
|
||||
seq_x <- seq(min(log_dose), max(log_dose),0.1)
|
||||
SAMPLEtrue <- sigmoid[5] + (sigmoid[7]-sigmoid[5])/(1+exp(sigmoid[6]*((sigmoid[4]-sigmoid[8]-seq_x))))
|
||||
REFtrue <- sigmoid[1] + (sigmoid[3]-sigmoid[1])/(1+exp(sigmoid[2]*((sigmoid[4]-seq_x))))
|
||||
|
||||
truePL_df <- cbind(seq_x,SAMPLEtrue, REFtrue)
|
||||
|
||||
p <- ggplot(all_l2,aes(x=log_dose,y=readout, color=factor(isRef))) +
|
||||
geom_point() +
|
||||
labs(title=paste("linear regression model", indS,indT), color="product") +
|
||||
scale_colour_manual(labels = c("test","reference"), values=c("#C2173F","#4545BA")) +
|
||||
ylim(min(all_l2$readout),max(all_l2$readout)) +
|
||||
theme_bw()
|
||||
p2 <- p + geom_line(data=pl_df,aes(x=lnC,y=plotS),color="#4545BA",
|
||||
inherit.aes = F) +
|
||||
geom_line(data=pl_df,aes(x=lnC,y=plotT),color="#C2173F",
|
||||
inherit.aes = F) +
|
||||
geom_line(data=data.frame(truePL_df),aes(x=seq_x,y=SAMPLEtrue),color="#C2173F", linetype=2,alpha=0.4,
|
||||
inherit.aes = F) +
|
||||
geom_line(data=data.frame(truePL_df),aes(x=seq_x,y=REFtrue),color="#4545BA", linetype=2,alpha=0.4,
|
||||
inherit.aes = F) +
|
||||
labs(title = paste("unrestricted linear regression model",indS,indT), color="product") +
|
||||
theme(legend.position="none", axis.text = element_text(size=14))
|
||||
p3 <- p2 + geom_point(circle, mapping=aes(x=log_dose, y=readout, shape=factor(isRef),
|
||||
size=5,alpha=0.2), inherit.aes = FALSE) +
|
||||
scale_shape_manual(labels=c("test","reference"), values=c(21,21))
|
||||
# fit intercept for test and ref and common slope
|
||||
|
||||
|
||||
pl_restS <- sum_mLin$coefficients[1,1] + sum_mLin$coefficients[2,1]*log_conc
|
||||
pl_restT <- sum_mLin$coefficients[1,1] + sum_mLin$coefficients[3,1] + sum_mLin$coefficients[2,1]*log_conc
|
||||
pl_rest <- data.frame(lnC=log_conc, plotS=pl_restS, plotT=pl_restT)
|
||||
|
||||
pr2 <- p + geom_line(data=pl_rest,aes(x=lnC,y=plotS),color="#4545BA",
|
||||
inherit.aes = F) +
|
||||
geom_line(data=pl_rest,aes(x=lnC,y=plotT),color="#C2173F",
|
||||
inherit.aes = F) +
|
||||
geom_line(data=data.frame(truePL_df),aes(x=seq_x,y=SAMPLEtrue),color="#C2173F", linetype=2,alpha=0.4,
|
||||
inherit.aes = F) +
|
||||
geom_line(data=data.frame(truePL_df),aes(x=seq_x,y=REFtrue),color="#4545BA", linetype=2,alpha=0.4,
|
||||
inherit.aes = F) +
|
||||
labs(title = paste("restricted linear regression model",indS,indT), color="product") +
|
||||
theme(legend.position="none", axis.text = element_text(size=14))
|
||||
pr3 <- pr2 + geom_point(circle, mapping=aes(x=log_dose, y=readout, shape=factor(isRef),
|
||||
size=5,alpha=0.2), inherit.aes = FALSE) +
|
||||
scale_shape_manual(labels=c("test","reference"), values=c(21,21))
|
||||
grid.arrange(p3,pr3,nrow=1)
|
||||
})
|
||||
|
||||
|
||||
@@ -2273,9 +2286,9 @@ server <- function(input, output, session) {
|
||||
indS <- which(abs(slopeSt[,2]) == max(abs(slopeSt[,2])))
|
||||
indT <- which(abs(slopeTe[,2]) == max(abs(slopeTe[,2])))
|
||||
|
||||
pl_ <- slopeSt[indS,1]+slopeSt[indS,2]*log(Conc)
|
||||
pl_T <- slopeTe[indT,1]+slopeTe[indT,2]*log(Conc)
|
||||
pl_df <- data.frame(lnC=log(Conc), plotS=pl_, plotT=pl_T)
|
||||
pl_ <- slopeSt[indS,1]+slopeSt[indS,2]*log_conc
|
||||
pl_T <- slopeTe[indT,1]+slopeTe[indT,2]*log_conc
|
||||
pl_df <- data.frame(lnC=log_conc, plotS=pl_, plotT=pl_T)
|
||||
|
||||
all_l <- melt(data.frame(tab), id.vars="log_dose",variable.name="replname",value.name="readout")
|
||||
isRef <- rep(c(1,0), 1,each=nrow(all_l)/2)
|
||||
@@ -2326,9 +2339,9 @@ server <- function(input, output, session) {
|
||||
# alternativ: modAB <- lm(readout ~ log_dose+isSample, circle)
|
||||
sum_mLin <- summary(mLin)
|
||||
|
||||
pl_restS <- sum_mLin$coefficients[1,1] + sum_mLin$coefficients[2,1]*log(Conc)
|
||||
pl_restT <- sum_mLin$coefficients[1,1] + sum_mLin$coefficients[3,1] + sum_mLin$coefficients[2,1]*log(Conc)
|
||||
pl_rest <- data.frame(lnC=log(Conc), plotS=pl_restS, plotT=pl_restT)
|
||||
pl_restS <- sum_mLin$coefficients[1,1] + sum_mLin$coefficients[2,1]*log_conc
|
||||
pl_restT <- sum_mLin$coefficients[1,1] + sum_mLin$coefficients[3,1] + sum_mLin$coefficients[2,1]*log_conc
|
||||
pl_rest <- data.frame(lnC=log_conc, plotS=pl_restS, plotT=pl_restT)
|
||||
|
||||
pr2 <- p + geom_line(data=pl_rest,aes(x=lnC,y=plotS),color="blue",
|
||||
inherit.aes = F) +
|
||||
@@ -0,0 +1,34 @@
|
||||
{
|
||||
"id": "909E8FCF",
|
||||
"path": null,
|
||||
"project_path": null,
|
||||
"type": "r_dataframe",
|
||||
"hash": "0",
|
||||
"contents": "",
|
||||
"dirty": false,
|
||||
"created": 1778393048148.0,
|
||||
"source_on_save": false,
|
||||
"relative_order": 7,
|
||||
"properties": {
|
||||
"expression": "pl_df",
|
||||
"caption": "pl_df",
|
||||
"totalObservations": 11,
|
||||
"displayedObservations": 11,
|
||||
"variables": 3,
|
||||
"cacheKey": "5D429755",
|
||||
"object": "pl_df",
|
||||
"environment": "_rs_no_env",
|
||||
"contentUrl": "grid_resource/gridviewer.html?env=_rs_no_env&obj=pl_df&cache_key=5D429755&max_display_columns=50",
|
||||
"preview": 0,
|
||||
"source_window_id": "",
|
||||
"Source": "Source"
|
||||
},
|
||||
"folds": "",
|
||||
"lastKnownWriteTime": 0,
|
||||
"encoding": "",
|
||||
"collab_server": "",
|
||||
"source_window": "",
|
||||
"last_content_update": 1778393048148,
|
||||
"read_only": false,
|
||||
"read_only_alternatives": []
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
{
|
||||
"id": "9E593C09",
|
||||
"path": null,
|
||||
"project_path": null,
|
||||
"type": "r_dataframe",
|
||||
"hash": "0",
|
||||
"contents": "",
|
||||
"dirty": false,
|
||||
"created": 1778393675522.0,
|
||||
"source_on_save": false,
|
||||
"relative_order": 8,
|
||||
"properties": {
|
||||
"expression": "slopeTe",
|
||||
"caption": "slopeTe",
|
||||
"totalObservations": 10,
|
||||
"displayedObservations": 10,
|
||||
"variables": 2,
|
||||
"cacheKey": "E00BF6E9",
|
||||
"object": "slopeTe",
|
||||
"environment": "_rs_no_env",
|
||||
"contentUrl": "grid_resource/gridviewer.html?env=_rs_no_env&obj=slopeTe&cache_key=E00BF6E9&max_display_columns=50",
|
||||
"preview": 0,
|
||||
"source_window_id": "",
|
||||
"Source": "Source"
|
||||
},
|
||||
"folds": "",
|
||||
"lastKnownWriteTime": 0,
|
||||
"encoding": "",
|
||||
"collab_server": "",
|
||||
"source_window": "",
|
||||
"last_content_update": 1778393675522,
|
||||
"read_only": false,
|
||||
"read_only_alternatives": []
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
{
|
||||
"id": "FC76AEE8",
|
||||
"path": null,
|
||||
"project_path": null,
|
||||
"type": "r_dataframe",
|
||||
"hash": "0",
|
||||
"contents": "",
|
||||
"dirty": false,
|
||||
"created": 1778097939830.0,
|
||||
"source_on_save": false,
|
||||
"relative_order": 5,
|
||||
"properties": {
|
||||
"expression": "Conctab",
|
||||
"caption": "Conctab",
|
||||
"totalObservations": 12,
|
||||
"displayedObservations": 12,
|
||||
"variables": 8,
|
||||
"cacheKey": "E00A59C5",
|
||||
"object": "Conctab",
|
||||
"environment": "_rs_no_env",
|
||||
"contentUrl": "grid_resource/gridviewer.html?env=_rs_no_env&obj=Conctab&cache_key=E00A59C5&max_display_columns=50",
|
||||
"preview": 0,
|
||||
"source_window_id": "",
|
||||
"Source": "Source"
|
||||
},
|
||||
"folds": "",
|
||||
"lastKnownWriteTime": 0,
|
||||
"encoding": "",
|
||||
"collab_server": "",
|
||||
"source_window": "",
|
||||
"last_content_update": 1778097939830,
|
||||
"read_only": false,
|
||||
"read_only_alternatives": []
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
name: Build and deploy Roxygen2|pkgdown documentation site
|
||||
run-name: Documentation Build on push to main branch
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
build-and-deploy-documentation:
|
||||
runs-on: linux_amd64
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
# - name: Install package dependencies
|
||||
# run: |
|
||||
# Rscript -e 'remotes::install_deps(dependencies = TRUE)'
|
||||
|
||||
- name: Call to roxygen2::roxygenise()
|
||||
run: |
|
||||
Rscript -e 'roxygen2::roxygenise()'
|
||||
|
||||
- name: Call to pkgdown::build_site()
|
||||
run: |
|
||||
Rscript -e 'pkgdown::build_site()'
|
||||
|
||||
- name: Deploy to WEBROOT
|
||||
env:
|
||||
WEBROOT: ${{ vars.WEBROOT }}
|
||||
run: |
|
||||
test -n "$WEBROOT"
|
||||
mkdir -p "$WEBROOT"
|
||||
rsync -av --delete docs/* "$WEBROOT"
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
name: run tests
|
||||
run-name: run tests
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
build-and-deploy-documentation:
|
||||
runs-on: linux_amd64
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Call to devtools::test()
|
||||
run: |
|
||||
Rscript -e 'devtools::test()'
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
.Rproj.user
|
||||
.Rproj
|
||||
.Rhistory
|
||||
.RData
|
||||
.Ruserdata
|
||||
.positai
|
||||
.png
|
||||
.DS_Store
|
||||
www/.DS_Store
|
||||
dev/www/.DS_Store
|
||||
man
|
||||
docs
|
||||
pkgdown
|
||||
@@ -0,0 +1,11 @@
|
||||
linters: linters_with_defaults(
|
||||
line_length_linter(150),
|
||||
commented_code_linter = NULL,
|
||||
object_name_linter = NULL,
|
||||
brace_linter = NULL
|
||||
)
|
||||
exclusions: list(
|
||||
"inst/doc/creating_linters.R" = 1,
|
||||
"inst/example/bad.R",
|
||||
"tests/testthat/exclusions-test"
|
||||
)
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
Package: DashboardApp
|
||||
Type: Package
|
||||
Title: What the Package Does (Title Case)
|
||||
Version: 0.1.0
|
||||
Authors@R: c(
|
||||
person(
|
||||
"Franz", "Innerbichler",
|
||||
email = "f.innerbichler@eclipso.at",
|
||||
role = c("aut", "cre")
|
||||
),
|
||||
person(
|
||||
"Simon", "Innerbichler",
|
||||
email = "simon.innerbichler@proton.me",
|
||||
role = c("aut")
|
||||
)
|
||||
)
|
||||
Description: More about what it does (maybe more than one line).
|
||||
Continuation lines should be indented.
|
||||
Imports:
|
||||
shiny,
|
||||
shinydashboard,
|
||||
shinyjs,
|
||||
shinyAce,
|
||||
shinycssloaders,
|
||||
shinyBS,
|
||||
purrr,
|
||||
gslnls,
|
||||
tidyverse,
|
||||
ggplot2,
|
||||
reshape2,
|
||||
openxlsx,
|
||||
DT,
|
||||
ggpubr,
|
||||
gridExtra,
|
||||
drc,
|
||||
twopartm,
|
||||
car,
|
||||
dplyr,
|
||||
scales
|
||||
License: Commercial, all rights reserved
|
||||
Encoding: UTF-8
|
||||
LazyData: true
|
||||
Config/roxygen2/version: 8.0.0
|
||||
Suggests:
|
||||
testthat (>= 3.0.0)
|
||||
Config/testthat/edition: 3
|
||||
@@ -12,3 +12,8 @@ Encoding: UTF-8
|
||||
|
||||
RnwWeave: Sweave
|
||||
LaTeX: pdfLaTeX
|
||||
|
||||
BuildType: Package
|
||||
PackageUseDevtools: Yes
|
||||
PackageInstallArgs: --no-multiarch --with-keep.source
|
||||
PackageRoxygenize: rd,collate,namespace
|
||||
@@ -1,432 +0,0 @@
|
||||
---
|
||||
output:
|
||||
pdf_document:
|
||||
extra_dependencies: ["float"]
|
||||
number_sections: true
|
||||
toc: true
|
||||
toc_depth: 3
|
||||
header_includes:
|
||||
-\usepackage{fancyheadr}
|
||||
-\setlength{\headheight}{22pt}%
|
||||
-\usepackage{lastpage}
|
||||
-\pagestyle{fancy}
|
||||
-\usepackage{pdflscape}
|
||||
-\usepackage{longtable}
|
||||
-\rhead{\includegraphics[width=.15\textwidth]{`r getwd()`/logo.png}}
|
||||
params:
|
||||
FileName: NA
|
||||
newTitle: NA
|
||||
author: NA
|
||||
REP: NA
|
||||
coeffs: NA
|
||||
author: "Author: `r params$author`"
|
||||
title: |
|
||||
| {width=1in}
|
||||
| 4PL bioassay evaluation
|
||||
subtitle: |
|
||||
`r params$FileName`
|
||||
|
||||
<left> Unique time: </left> <right> `r Sys.time()`</right>
|
||||
date: "`r paste(params$Subway, params$Version)`"
|
||||
|
||||
---
|
||||
|
||||
<!-- \fancyfoot[C]{\thepage\ of \pageref{LastPage}} -->
|
||||
<!-- \newpage -->
|
||||
|
||||
<!-- \newpage -->
|
||||
|
||||
```{r setup, include=FALSE}
|
||||
|
||||
knitr::opts_chunk$set(echo = TRUE)
|
||||
|
||||
library(knitr)
|
||||
library(DT)
|
||||
|
||||
REP <- params$REP
|
||||
author <- params$author
|
||||
coeffs <- params$coeffs
|
||||
|
||||
all_l <- REP$all_l
|
||||
ANOVAXLS <- REP$ANOVAXLS
|
||||
DiagnTable <- REP$DiagnTable
|
||||
UnRPLAausw <- REP$UnRPLAausw
|
||||
UnRPLBend <- REP$UnRPLBend
|
||||
PLAausw <- REP$PLAausw
|
||||
PLBend <- REP$PLBend
|
||||
LogPLAausw <- REP$LogPLAausw
|
||||
LogUnrPLAausw <- REP$LogUnrPLAausw
|
||||
|
||||
XLdat2 <- REP$XLdat2
|
||||
|
||||
CIplot <- REP$CIplot
|
||||
testsTab <- REP$testsTab
|
||||
relpotTestPlot <- REP$relpotTestPlot
|
||||
|
||||
|
||||
|
||||
```
|
||||
|
||||
|
||||
# Introduction
|
||||
|
||||
Bioassay potency estimation uses statistical methods to quantify the strength of a biological product or drug by comparing its response to that of a reference standard. Because biological responses are inherently variable, affected by assay conditions, cell systems or organisms, and measurement noise, the 4-parametric logistic regression is used to obtain reliable potency values. The variance for confidence interval calculation is coming from the regression procedure itself and is an excellent predictor for the variability of any future potency determinations.
|
||||
USP<1034> recommends calculation of standard errors of ratios of the parameters using Fieller's theorem [Finney D.J. 1978] or using the "delta" method (for a discussion about the "delta" method see [Ver Hoef 2012]). However, the presented gradient approach using the differences on the log-scale is methematically more stable und thus preferable compared to any ratio approach ([Franz, V.H. 2007]).
|
||||
|
||||
# Results
|
||||
|
||||
All data used for the 4PL evaluation is shown in table 1:
|
||||
|
||||
```{r alll, echo=FALSE, warning=FALSE, results='asis'}
|
||||
|
||||
kable(all_l, format = "markdown", caption= "Uploaded data (test and reference) in long format", digits=3)
|
||||
|
||||
```
|
||||
|
||||
The following 4 plots show all 4 models: restricted and unrestricted, and log transformed, respectively.
|
||||
|
||||
You can also embed plots, for example:
|
||||
|
||||
```{r XLplot, echo=FALSE, warning=FALSE, fig.height=4, fig.width=6, fig.cap="Plot of models", fig.align='left'}
|
||||
|
||||
plot_f <- function(dat, sigmoid,det_sig) {
|
||||
CORdat <- cor(dat[,1],dat[,ncol(dat)])
|
||||
|
||||
all_l <- melt(data.frame(dat), id.vars="log_dose", variable.name="replname", value.name = "readout")
|
||||
isRef <- rep(c(1,0),1,each=nrow(all_l)/2)
|
||||
isSample <- rep(c(0,1),1,each=nrow(all_l)/2)
|
||||
all_l2 <- cbind(all_l, isRef, isSample)
|
||||
|
||||
if(is.null(det_sig)) {
|
||||
if (CORdat<0) {
|
||||
startlist <- list(a=sigmoid[3], b=-sigmoid[5],cs=sigmoid[7],
|
||||
d=sigmoid[1],r=sigmoid[8])
|
||||
} else {
|
||||
startlist <- list(a=sigmoid[3],b=sigmoid[5],cs=sigmoid[7],
|
||||
d=sigmoid[1],r=sigmoid[8])
|
||||
}
|
||||
} else {
|
||||
startlist <- list(a=det_sig[5], b=det_sig[1],cs=det_sig[7],
|
||||
d=det_sig[3],r=det_sig[7] - det_sig[8])
|
||||
}
|
||||
#browser()
|
||||
tryCatch({
|
||||
mr <- gsl_nls(fn = readout ~ a+(d-a)/(1+exp(b*(log_dose-(cs-r*isSample)))),
|
||||
data=all_l2,
|
||||
start=startlist,
|
||||
control=gsl_nls_control(xtol=1e-6,ftol=1e-6, gtol=1e-6))
|
||||
},
|
||||
error = function(err) {
|
||||
err$message
|
||||
})
|
||||
s_mr <- summary(mr)
|
||||
a <- s_mr$coefficients[1,1]
|
||||
b <- s_mr$coefficients[2,1]
|
||||
cs <- s_mr$coefficients[3,1]
|
||||
d <- s_mr$coefficients[4,1]
|
||||
r <- s_mr$coefficients[5,1]
|
||||
|
||||
log_dose <- unique(all_l$log_dose)
|
||||
seq_x <- seq(min(log_dose),max(log_dose),0.1)
|
||||
SAMPLE <- a+(d-a)/(1+exp(b*(seq_x-(cs-r))))
|
||||
REF <- a+(d-a)/(1+exp(b*(seq_x-(cs))))
|
||||
|
||||
if (is.null(det_sig)) {
|
||||
SAMPLEtrue <- sigmoid[4] + (sigmoid[2] -sigmoid[4])/(1+exp(sigmoid[6]*(seq_x-(sigmoid[7]-sigmoid[8]))))
|
||||
REFtrue <- sigmoid[3] + (sigmoid[1] -sigmoid[3])/(1+exp(sigmoid[5]*(seq_x-(sigmoid[7]))))
|
||||
} else {
|
||||
SAMPLEtrue <- det_sig[4] + (det_sig[6] -det_sig[4])/(1+exp(-det_sig[2]*(seq_x-(det_sig[8]))))
|
||||
REFtrue <- det_sig[3] + (det_sig[5] -det_sig[3])/(1+exp(-det_sig[1]*(seq_x-(det_sig[7]))))
|
||||
}
|
||||
|
||||
pl_df <- cbind(seq_x, SAMPLE, REF, SAMPLEtrue, REFtrue)
|
||||
all_l2$readout[all_l2$readout < 0] <- 0.01
|
||||
all_l2$readouttrans <- log(all_l2$readout)
|
||||
slopeEC50 <- b*(a-d)/4
|
||||
|
||||
Xbendl3 <- cs-(1.31696/b)
|
||||
Xbendu3 <- cs+(1.31696/b)
|
||||
XbendlT <- cs-r-(1.31696/b)
|
||||
XbenduT <- cs-r+(1.31696/b)
|
||||
bendpoints <- c(bendREF_lower = round(Xbendl3,3), bendREF_upper=round(Xbendu3,3),
|
||||
bendSAMPLE_lower = round(XbendlT,3), bendSAMPLE_upper=round(XbenduT,3))
|
||||
|
||||
p <- ggplot(all_l2, aes(x=log_dose, y=readout, color=factor(isRef))) +
|
||||
geom_point(shape=factor(isRef), alpha=0.8) +
|
||||
labs(title = paste("restricted 4pl; bendp:", round(Xbendl3,3),round(Xbendu3,3),round(XbendlT,3),round(XbenduT,3)),
|
||||
color="product") +
|
||||
scale_color_manual(labels=c("test","reference"), values=c("red","blue")) +
|
||||
scale_shape_manual(labels=c("test","reference")) +
|
||||
theme_bw() +
|
||||
theme(axis.text = element_text(size=14))
|
||||
|
||||
p2 <- p + geom_line(data=as.data.frame(pl_df), aes(x=seq_x, y=SAMPLE), color="red",
|
||||
inherit.aes = F) +
|
||||
geom_line(data=as.data.frame(pl_df), aes(x=seq_x, y=REF), color="blue",
|
||||
inherit.aes = F) +
|
||||
geom_line(data=as.data.frame(pl_df), aes(x=seq_x, y=SAMPLEtrue), color="red", linetype=2, alpha=0.4,
|
||||
inherit.aes = F) +
|
||||
geom_line(data=as.data.frame(pl_df), aes(x=seq_x, y=REFtrue), color="blue", linetype=2, alpha=0.4,
|
||||
inherit.aes = F) +
|
||||
geom_vline(xintercept=c(Xbendl3, Xbendu3), col="blue",linetype=2) +
|
||||
geom_vline(xintercept=c(XbendlT, XbenduT), col="red",linetype=2) +
|
||||
annotate("text", x=cs, y=a+(d-a)/2, label="0", size=5) +
|
||||
theme(legend.position="none")
|
||||
|
||||
|
||||
# transformed plots
|
||||
p_rt <- ggplot(all_l2, aes(x=log_dose, y=readouttrans, color=factor(isRef))) +
|
||||
geom_point(shape=factor(isRef), alpha=0.8) +
|
||||
labs(title = paste("restricted transformed 4pl"), color="product") +
|
||||
scale_color_manual(labels=c("test","reference"), values=c("red","blue")) +
|
||||
theme_bw()
|
||||
|
||||
mrt <- gsl_nls(fn = readouttrans ~ a+(d-a)/(1+exp(b*(log_dose-(cs-r*isSample)))),
|
||||
data=all_l2,
|
||||
start=startlist,
|
||||
control=gsl_nls_control(xtol=1e-6,ftol=1e-6, gtol=1e-6))
|
||||
s_mrt <- summary(mrt)
|
||||
a_trans <- s_mrt$coefficients[1,1]
|
||||
b_trans <- s_mrt$coefficients[2,1]
|
||||
cs_trans <- s_mrt$coefficients[3,1]
|
||||
d_trans <- s_mrt$coefficients[4,1]
|
||||
r_trans <- s_mrt$coefficients[5,1]
|
||||
|
||||
XbendlTrans <- cs_trans-(1.31696/b_trans)
|
||||
XbenduTrans <- cs_trans+(1.31696/b_trans)
|
||||
XbendlTransT <- cs_trans-r_trans-(1.31696/b_trans)
|
||||
XbenduTransT <- cs_trans-r_trans+(1.31696/b_trans)
|
||||
bendpointsTRANS <- c(bendREF_lower = round(XbendlTrans,3), bendREF_upper=round(XbenduTrans,3),
|
||||
bendSAMPLE_lower = round(XbendlTransT,3), bendSAMPLE_upper=round(XbenduTransT,3))
|
||||
|
||||
SAMPLEtrans <- a_trans+(d_trans-a_trans)/(1+exp(b_trans*(seq_x-(cs_trans-r_trans))))
|
||||
REFtrans <- a_trans+(d_trans-a_trans)/(1+exp(b_trans*(seq_x-(cs_trans))))
|
||||
|
||||
pl_df_trans <- cbind(seq_x, SAMPLEtrans, REFtrans)
|
||||
p_rt2 <- p_rt + geom_line(data=as.data.frame(pl_df_trans), aes(x=seq_x, y=SAMPLEtrans), color="red",
|
||||
inherit.aes = F) +
|
||||
geom_line(data=as.data.frame(pl_df_trans), aes(x=seq_x, y=REFtrans), color="blue",
|
||||
inherit.aes = F) +
|
||||
geom_vline(xintercept=c(XbendlTrans, XbenduTrans), col="blue",linetype=2) +
|
||||
geom_vline(xintercept=c(XbendlTransT, XbenduTransT), col="red",linetype=2) +
|
||||
theme(legend.position = "none", axis.text=element_text(size=14))
|
||||
|
||||
if (is.null(det_sig)) {
|
||||
unrestr <- drm(readout ~ exp(log_dose), isSample, data=all_l2, fct=LL.4(),
|
||||
pmodels=data.frame(isSample, isSample,isSample,isSample))
|
||||
Sum_u <- summary(unrestr)
|
||||
ast <- Sum_u$coefficients[3,1]
|
||||
ate <- Sum_u$coefficients[4,1]
|
||||
bst <- Sum_u$coefficients[1,1]
|
||||
bte <- Sum_u$coefficients[2,1]
|
||||
cst <- log(Sum_u$coefficients[7,1])
|
||||
cte <- log(Sum_u$coefficients[8,1])
|
||||
dst <- Sum_u$coefficients[5,1]
|
||||
dte <- Sum_u$coefficients[6,1]
|
||||
} else {
|
||||
ast <- det_sig[5]
|
||||
ate <- det_sig[6]
|
||||
bst <- det_sig[1]
|
||||
bte <- det_sig[2]
|
||||
cst <- det_sig[7]
|
||||
cte <- det_sig[8]
|
||||
dst <- det_sig[3]
|
||||
dte <- det_sig[4]
|
||||
}
|
||||
REFu <- ast + (dst-ast)/(1+exp(bst*(seq_x-cst)))
|
||||
SAMPLEu <- ate + (dte-ate)/(1+exp(bte*(seq_x-cte)))
|
||||
pl_df2 <- cbind(seq_x, SAMPLEu, REFu)
|
||||
#browser()
|
||||
pu <- ggplot(all_l2, aes(x=log_dose, y=readout, color=factor(isRef))) +
|
||||
geom_point() +
|
||||
labs(title="unrestricted 4_pl-Model", color="product") +
|
||||
scale_color_manual(labels = c("test","reference"), values=c("red","blue")) +
|
||||
theme_bw()
|
||||
pu2 <- pu + geom_line(data=as.data.frame(pl_df2), aes(x=seq_x, y=SAMPLEu),
|
||||
color="red", inherit.aes = F) +
|
||||
geom_line(data=as.data.frame(pl_df2), aes(x=seq_x, y=REFu),
|
||||
color="blue", inherit.aes = F,
|
||||
show.legend = F)
|
||||
pu2_ <- pu2 +
|
||||
theme(legend.position = "none", axis.text = element_text(size=14))
|
||||
putrans <- ggplot(all_l2, aes(x=log_dose, y=readouttrans, color=factor(isRef))) +
|
||||
geom_point() +
|
||||
labs(title="unrestricted transformed 4_pl-Model", color="product") +
|
||||
scale_color_manual(labels = c("test","reference"), values=c("red","blue")) +
|
||||
theme_bw()
|
||||
|
||||
unrestr_trans <- drm(readouttrans ~ exp(log_dose), isSample, data=all_l2, fct=LL.4(),
|
||||
pmodels=data.frame(isSample, isSample,isSample,isSample))
|
||||
Sum_ut <- summary(unrestr_trans)
|
||||
ast_t <- Sum_ut$coefficients[3,1]
|
||||
ate_t <- Sum_ut$coefficients[4,1]
|
||||
bst_t <- Sum_ut$coefficients[1,1]
|
||||
bte_t <- Sum_ut$coefficients[2,1]
|
||||
cst_t <- log(Sum_ut$coefficients[7,1])
|
||||
cte_t <- log(Sum_ut$coefficients[8,1])
|
||||
dst_t <- Sum_ut$coefficients[5,1]
|
||||
dte_t <- Sum_ut$coefficients[6,1]
|
||||
|
||||
REFu_trans <- ast_t + (dst_t-ast_t)/(1+exp(bst_t*(seq_x-cst_t)))
|
||||
SAMPLEu_trans <- ate_t + (dte_t-ate_t)/(1+exp(bte_t*(seq_x-cte_t)))
|
||||
pl_df2u_t <- cbind(seq_x, SAMPLEu_trans, REFu_trans)
|
||||
|
||||
pu2_t <- putrans + geom_line(data=as.data.frame(pl_df2u_t), aes(x=seq_x, y=SAMPLEu_trans),
|
||||
color="red", inherit.aes = F) +
|
||||
geom_line(data=as.data.frame(pl_df2u_t), aes(x=seq_x, y=REFu_trans),
|
||||
color="blue", inherit.aes = F,
|
||||
show.legend = F)
|
||||
pu3_t <- pu2_t
|
||||
grid.arrange(p2,p_rt2,pu2_,pu3_t, nrow=2)
|
||||
}
|
||||
|
||||
plot_f(XLdat2, sigmoid=NULL, det_sig=coeffs)
|
||||
|
||||
|
||||
```
|
||||
|
||||
The ANOVA of the unconstrained model is listed in table 2:
|
||||
|
||||
```{r anovaxls, echo=FALSE, warning=FALSE, results='asis'}
|
||||
|
||||
kable(ANOVAXLS, format = "markdown", caption= "ANOVA table unrestricted", digits=3)
|
||||
|
||||
|
||||
```
|
||||
|
||||
|
||||
```{r SST_ergebn, fig.align='center', fig.pos='htb!', echo=FALSE, cache=FALSE, warning=FALSE, message=FALSE, tidy=TRUE}
|
||||
|
||||
kable(testsTab[1:7,], row.names = F, format = "markdown", caption="SST results")
|
||||
|
||||
|
||||
```
|
||||
|
||||
|
||||
*...The estimate for F-test on regression and on non-linearity is the p-value
|
||||
F-test on regression passes if F-value > F-crit and thus p < 0.05
|
||||
F-test on non-linearity passes if F-value < F-crit and thus p > 0.05
|
||||
Test results outcome:
|
||||
|
||||
0 ... test passed (for EQ tests: CI within limits);
|
||||
|
||||
1 ... test failed (for EQ tests CI not within limits);
|
||||
|
||||
-1 ... calculations unbound/denominator too close to 0
|
||||
|
||||
|
||||
<!-- ```{r, label= 'CIplot', echo=FALSE, warning=FALSE, fig.width=100, fig.cap='Selected SSt confidence intervals with entered limits', fig.align='center'} -->
|
||||
|
||||
<!-- png("CIplot.png") -->
|
||||
<!-- print(CIplot) -->
|
||||
<!-- dev.off() -->
|
||||
|
||||
|
||||
<!-- ``` -->
|
||||
|
||||
|
||||
<!-- {width=60%} -->
|
||||
|
||||
|
||||
## Fitting results of the 4 models with bend points
|
||||
|
||||
The results of the non-linear fitting procedure for the restricted model (5 parameters) is listed in table 4:
|
||||
|
||||
```{r PLAausw, echo=FALSE, warning=FALSE, results='asis'}
|
||||
|
||||
kable(PLAausw, format = "markdown", caption= "Restricted 4PL evaluation", digits=3, row.names = F)
|
||||
|
||||
|
||||
```
|
||||
|
||||
|
||||
A depiction of the CI and corresponding limits of relative potency is shown here:
|
||||
|
||||
```{r, label='relpotPlot', echo=FALSE, warning=FALSE, fig.height=2, fig.width=3.5, fig.cap="Rel potency with CIs and limits", fig.align='left', results='asis'}
|
||||
|
||||
print(relpotTestPlot)
|
||||
|
||||
|
||||
```
|
||||
|
||||
|
||||
The bend points for test and reference sample are in table 5:
|
||||
|
||||
```{r PLBend, echo=FALSE, warning=FALSE, results='asis'}
|
||||
|
||||
kable(PLBend, format = "markdown", caption= "Bendpoints (Sebaugh) of restricted 4PL", digits=3)
|
||||
|
||||
|
||||
```
|
||||
|
||||
The results of the non-linear fitting procedure for the unrestricted model (8 parameters) is listed in table 6:
|
||||
|
||||
```{r UnRPLAausw, echo=FALSE, warning=FALSE, results='asis'}
|
||||
|
||||
kable(UnRPLAausw, format = "markdown", caption= "UNrestricted 4PL evaluation", digits=3, row.names = F)
|
||||
|
||||
```
|
||||
|
||||
|
||||
```{r UnRPLBend, echo=FALSE, warning=FALSE, results='asis'}
|
||||
|
||||
kable(UnRPLBend, format = "markdown", caption= "Bend points of 4PL unrestricted", digits=3, row.names = F)
|
||||
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
```{r LogPLAausw, echo=FALSE, warning=FALSE, results='asis'}
|
||||
|
||||
kable(LogPLAausw, format = "markdown", caption= "Restricted 4PL evaluation with log-transformed response", digits=3)
|
||||
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
```{r LogUnRPLAausw, echo=FALSE, warning=FALSE, results='asis'}
|
||||
|
||||
kable(LogUnrPLAausw, format = "markdown", caption= "Unrestricted 4PL evaluation with log-transformed response", digits=3)
|
||||
|
||||
|
||||
```
|
||||
|
||||
|
||||
# Appendix: Formulas
|
||||
|
||||
## 4PL regression
|
||||
|
||||
$$
|
||||
Y = D + \frac{A-D} {1+(\frac{C} {x})^B } + \epsilon
|
||||
$$
|
||||
|
||||
|
||||
## log-logistic 4P regression
|
||||
|
||||
$$
|
||||
Y = D + \frac{A-D} {1+e^{(B*(C - log(x))) }} + \epsilon
|
||||
$$
|
||||
|
||||
where: x ... concentration of the analyte
|
||||
|
||||
A: upper asymptote
|
||||
|
||||
B: slope
|
||||
|
||||
D: lower asymptote
|
||||
|
||||
C ... EC50
|
||||
|
||||
# Literature
|
||||
|
||||
Finney, D.J.: (1978) Statistical Method in Biological Assay, London: Charles Griffin House, 3rd edition (pp. 80-82)
|
||||
|
||||
Franz, V.H.: Ratios: A short guide to confidence limits and proper use. arXiv:0710.2024v1, 10 Oct 2007
|
||||
|
||||
VerHoef, J.M.: Who invented the Delta Method? The American Statistician, 2012, 66:2, 124-127 DOI: 10.1080/00031305.2012.687494
|
||||
|
||||
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
|
After Width: | Height: | Size: 208 KiB |
Vendored
BIN
Binary file not shown.
+1520
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,59 @@
|
||||
---
|
||||
title: "RoxygenFileTest"
|
||||
author: "F Innerbichler"
|
||||
date: "2026-05-13"
|
||||
output: pdf_document
|
||||
---
|
||||
|
||||
```{r setup, include=FALSE}
|
||||
knitr::opts_chunk$set(echo = TRUE)
|
||||
library(shiny)
|
||||
source("Global.R")
|
||||
|
||||
library(testthat)
|
||||
|
||||
```
|
||||
|
||||
```{r LinPotTab, echo=F}
|
||||
|
||||
|
||||
library(car)
|
||||
CIRC <- data.frame(log_dose = c(-2.5,-2.5,-2.5, -3.2,-3.2,-3.2,-3.9,-3.9,-3.9,
|
||||
-3.2,-3.2,-3.2,-3.9,-3.9,-3.9,-4.7,-4.7,-4.7),
|
||||
replname= c("R_dil1","R_dil1","R_dil1", "R_dil2","R_dil2","R_dil2", "R_dil3","R_dil3","R_dil3",
|
||||
"T_dil1","T_dil1","T_dil1", "T_dil2","T_dil2","T_dil2", "T_dil3","T_dil3","T_dil3"),
|
||||
readout = c(72.1,75.8,76.04,59.8,61,62.7,43.6,45,41.5,53.5,62.2,65.9,48.3,43.8,43.14,28.17,29.2,31.2),
|
||||
isRef=c(rep(1,9), rep(0,9)),
|
||||
isSample = c(rep(0,9), rep(1,9)))
|
||||
Lim <- c(rep(0,8), 70,130)
|
||||
PureErrF <- TRUE
|
||||
|
||||
|
||||
TestTab <- as.matrix(LinPotTab(circles=CIRC, Lim, PureErrF))
|
||||
# SolTab is the Solution table
|
||||
SolTab <- matrix(c(104.959, 87.994, 125.196, 0, 83.836, 119.281),nrow=1)
|
||||
colnames(SolTab) <- c("Potency", "lower 95%CI", "upper 95%CI", "test_result", "lowerRel95%CI", "upperRel95%CI")
|
||||
#all.equal(TestTab, SolTab)
|
||||
|
||||
expect_equal(TestTab, SolTab, check.attributes = FALSE)
|
||||
# no output means "all_equal"
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
```{r pressure, echo=FALSE}
|
||||
|
||||
```
|
||||
|
||||
Note that the `echo = FALSE` parameter was added to the code chunk to prevent printing of the R code that generated the plot.
|
||||
|
||||
|
||||
|
||||
``` {r}
|
||||
y<-1:4;mean(y)
|
||||
#> [1] 2.5
|
||||
```
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
SCRUM jobs
|
||||
|
||||
*) Sessioninfo geht noch ins Leere:
|
||||
tabPanel("Configuration",
|
||||
verbatimTextOutput("sessioninfo"))
|
||||
*) Checks ob EXCEL file den Vorgaben entspricht:
|
||||
**) Mindestens 2 Referenz- und gleich viele Testsample Spalten.
|
||||
**) Check ob Spalte mit den Verdünnungen den regex Vorgaben entspricht (Ind <- grep("dilu | dose | Dose | Conc | conc",cn)
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,3 @@
|
||||
template:
|
||||
bootstrap: 5
|
||||
|
||||
Vendored
BIN
Binary file not shown.
@@ -0,0 +1,265 @@
|
||||
---
|
||||
output:
|
||||
pdf_document:
|
||||
extra_dependencies: ["float"]
|
||||
number_sections: true
|
||||
toc: true
|
||||
toc_depth: 3
|
||||
header_includes:
|
||||
-\setlength{\headheight}{22pt}%
|
||||
-\usepackage{pdflscape}
|
||||
-\usepackage{longtable}
|
||||
-\usepackage{fancyheadr}
|
||||
-\pagestyle{fancy}
|
||||
-\fancyhf{}
|
||||
-\fancyfoot[C]{Page \thepage \ of \pageref{LastPage}}
|
||||
-\usepackage{lastpage}
|
||||
-\rhead{\includegraphics[width=.15\textwidth]{`r getwd()`/logov2.png}}
|
||||
params:
|
||||
FileName: NA
|
||||
newTitle: NA
|
||||
author: NA
|
||||
REP: NA
|
||||
REPlin: NA
|
||||
coeffsLin: NA
|
||||
NoP: NA
|
||||
Assay: NA
|
||||
author: "Author: `r params$author`"
|
||||
title: |
|
||||
| {width=1in}
|
||||
| Linear bioassay evaluation
|
||||
subtitle: |
|
||||
`r params$FileName`
|
||||
|
||||
<left> Unique time: </left> <right> `r Sys.time()`</right>
|
||||
date: "`r paste(params$NoP, params$Assay)`"
|
||||
|
||||
---
|
||||
|
||||
|
||||
|
||||
```{r setup, include=FALSE}
|
||||
|
||||
knitr::opts_chunk$set(echo = TRUE)
|
||||
|
||||
library(knitr)
|
||||
library(DT)
|
||||
|
||||
REP <- params$REP
|
||||
REPlin <- params$REPlin
|
||||
author <- params$author
|
||||
coeffsLin <- params$coeffsLin
|
||||
|
||||
all_l <- REP$all_l
|
||||
circles <- REPlin$circles
|
||||
#ANOVAXLS <- REP$ANOVAXLS
|
||||
SuModAB <- REPlin$SuModAB
|
||||
SuModABu <- REPlin$SuModABu
|
||||
LinTests <- REPlin$LinTests
|
||||
XLplotLin <- REPlin$pLin
|
||||
LinPotTab <- REPlin$LinPotTab
|
||||
|
||||
XLdat2 <- REP$XLdat2
|
||||
|
||||
LinTests1 <- LinTests[,1:3]
|
||||
ANOVAlin <- LinTests[,4:ncol(LinTests)]
|
||||
|
||||
|
||||
```
|
||||
|
||||
|
||||
\newpage
|
||||
|
||||
# Introduction
|
||||
|
||||
Bioassay potency estimation uses statistical methods to quantify the strength of a biological product or drug by comparing its response to that of a reference standard. Biological responses are inherently variable, affected by assay conditions, cell systems or organisms, and measurement noise. To control this variability, a linear regression approach is used to obtain reliable potency values. Three consecutive dilution steps showing the steepest slope are used for linear fitting.
|
||||
USP<1034> recommends calculation of standard errors of ratios of the parameters using Fieller's theorem [Finney D.J. 1978] or using the "delta" method (for a discussion about the "delta" method see [Ver Hoef 2012]). The present analysis calculated the relative potency with the "delta" method. The formula of the relative potency is in the Appendix.
|
||||
|
||||
# Raw data
|
||||
|
||||
All data used for evaluation is shown in table 1.
|
||||
|
||||
```{r Alll, echo=FALSE, warning=FALSE, results='asis'}
|
||||
|
||||
kable(XLdat2, format = "markdown", caption= "Uploaded data (test and reference) ", digits=3)
|
||||
|
||||
```
|
||||
|
||||
The linerar regression is calculated on the readout listed in table 2.
|
||||
|
||||
```{r Circles, echo=FALSE, warning=FALSE, results='asis'}
|
||||
|
||||
kable(circles, format = "markdown", caption= "Concentrations and readout used for linear regression", digits=3, row.names = F)
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
# Results
|
||||
|
||||
## Overall result
|
||||
|
||||
```{r Over_all, echo=FALSE, comment=NA, warning=NA, message=NA}
|
||||
|
||||
#browser()
|
||||
potFlag <- 0
|
||||
if (LinPotTab[1,"test_result"]==1) potFlag <- 1
|
||||
AnalysisFlag <- FALSE
|
||||
if (potFlag==1 | sum(LinTests$test_results)>0) AnalysisFlag <- TRUE
|
||||
|
||||
colFmt <- function() {
|
||||
|
||||
outputFormat <- knitr::opts_knit$get("rmarkdown.pandoc.to")
|
||||
if(AnalysisFlag) {
|
||||
text <- paste("\\textcolor{red}{Analysis failed}",sep="")
|
||||
} else {
|
||||
text <- paste("\\textcolor{black}{Analysis succeeded}",sep="")
|
||||
}
|
||||
return(text)
|
||||
}
|
||||
|
||||
|
||||
```
|
||||
|
||||
`r colFmt()`
|
||||
|
||||
|
||||
## Plots and ANOVA
|
||||
|
||||
Plots in Figure 1 show the restricted and unrestricted model, respectively.
|
||||
|
||||
```{r LinPlot, echo=FALSE, warning=FALSE, fig.height=4, fig.width=6, fig.cap="Plot of models", fig.align='left'}
|
||||
|
||||
library(cowplot)
|
||||
|
||||
|
||||
plot_grid(XLplotLin)
|
||||
|
||||
|
||||
|
||||
```
|
||||
|
||||
|
||||
The relative potency can be read from tabale 3.
|
||||
|
||||
```{r LinPotTab, echo=FALSE, warning=FALSE, results='asis'}
|
||||
|
||||
kable(LinPotTab, format = "markdown", caption= "Potency table", digits=3)
|
||||
|
||||
|
||||
```
|
||||
|
||||
0 ... test passed;
|
||||
|
||||
1 ... test failed);
|
||||
|
||||
|
||||
The ANOVA of the unconstrained model is listed in table 4.
|
||||
|
||||
```{r anovaxls, echo=FALSE, warning=FALSE, results='asis'}
|
||||
|
||||
kable(ANOVAlin, format = "markdown", caption= "ANOVA table unrestricted", digits=3)
|
||||
|
||||
RMSE <- sqrt(ANOVAlin[5,4])
|
||||
|
||||
```
|
||||
|
||||
The standard deviation of the model is `r RMSE`.
|
||||
|
||||
The assay suitability tests are shown in table 5.
|
||||
|
||||
|
||||
```{r SST_ergebn, echo=FALSE, cache=FALSE, warning=FALSE, message=FALSE, tidy=TRUE}
|
||||
|
||||
kable(LinTests1, row.names = F, format = "markdown", caption="Assay suitability test results", digits=3)
|
||||
|
||||
|
||||
```
|
||||
|
||||
The estimate is the p-value of the test.
|
||||
F-tests on regression, significance of slopes, and preparation need to have a p-value <0.05 to pass.
|
||||
All other tests pass if p-value > 0.05.
|
||||
|
||||
0 ... test passed;
|
||||
|
||||
1 ... test failed);
|
||||
|
||||
(NOTE: F-tests are sensitive, when the residual variability of the method is small. On the other hand effects may not be detected if residual variability is high.)
|
||||
|
||||
## Fitting results
|
||||
|
||||
The results of the linear fitting procedure for the restricted model is listed in table 6:
|
||||
|
||||
```{r SumCSSI, echo=FALSE, warning=FALSE, results='asis'}
|
||||
|
||||
kable(SuModAB, format = "markdown", caption= "Restricted linear regression (CSSI)", digits=3, row.names = F)
|
||||
|
||||
|
||||
```
|
||||
|
||||
CSSI: common slope, separate intercept
|
||||
|
||||
The results of the linear fitting procedure for the unrestricted model is listed in table 7.
|
||||
|
||||
|
||||
```{r SumSSSI, echo=FALSE, warning=FALSE, results='asis'}
|
||||
|
||||
kable(SuModABu, format = "markdown", caption= "Restricted linear regression (SSSI)", digits=3, row.names = F)
|
||||
|
||||
|
||||
```
|
||||
|
||||
SSSI: separate slope, separate intercept
|
||||
|
||||
# Signature
|
||||
|
||||
<!-- Signature and date:\\ -->
|
||||
<!-- \noindent\framebox(200,50) -->
|
||||
<!-- \begin{minipage}[t][40pt][c]{190pt} -->
|
||||
<!-- \centering -->
|
||||
<!-- % Leave this blank for a physical signature -->
|
||||
<!-- \end{minipage} -->
|
||||
|
||||
|
||||
\vspace{1.5cm}
|
||||
\noindent
|
||||
\begin{tabular}{p{6cm}p{1cm}p{6cm}}
|
||||
\cline{1-1} \cline{3-3}
|
||||
Date & & Signature
|
||||
\end{tabular}
|
||||
|
||||
|
||||
|
||||
# Appendix: Formulas
|
||||
|
||||
## Potency of linear PLA
|
||||
|
||||
Relative potency of the test sample to the reference is calculated as:
|
||||
$$
|
||||
relPot_{log} = \frac{I_{ref} - I_{test}}{k}
|
||||
$$
|
||||
where: \\ I... intercept of reference or test\\
|
||||
k ... common slope
|
||||
|
||||
The standard error of the linear restricted model is used to get the confidence interval of the relative potency with the formula:
|
||||
$$
|
||||
CI_{rel Pot} = exp(relPot_{log} \pm se(relPot_{log})*q^{t_{n-p}}_{1-\frac{\alpha}{2}})
|
||||
$$
|
||||
In general, the confidence intervals are calculated as follows:
|
||||
$$
|
||||
CI = \hat\theta\pm se(\hat\theta)*q^{t_{n-p}}_{1-\frac{\alpha}{2}}
|
||||
$$
|
||||
…where $\hat\theta$ is a fitted parameter or a linear combination thereof, q is the 1-alpha/2 quantile of the Student’s t-distribution with n-p degrees of freedom and se is the standard error derived from any covariance matrix.
|
||||
|
||||
|
||||
# Literature
|
||||
|
||||
Finney, D.J.: (1978) Statistical Method in Biological Assay, London: Charles Griffin House, 3rd edition (pp. 80-82)
|
||||
|
||||
Franz, V.H.: Ratios: A short guide to confidence limits and proper use. arXiv:0710.2024v1, 10 Oct 2007
|
||||
|
||||
VerHoef, J.M.: Who invented the Delta Method? The American Statistician, 2012, 66:2, 124-127 DOI: 10.1080/00031305.2012.687494
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,331 @@
|
||||
---
|
||||
output:
|
||||
pdf_document:
|
||||
extra_dependencies: ["float"]
|
||||
number_sections: true
|
||||
toc: true
|
||||
toc_depth: 3
|
||||
header_includes:
|
||||
-\usepackage{fancyheadr}
|
||||
-\setlength{\headheight}{22pt}%
|
||||
-\usepackage{lastpage}
|
||||
-\pagestyle{fancy}
|
||||
-\usepackage{pdflscape}
|
||||
-\usepackage{longtable}
|
||||
-\rhead{\includegraphics[width=.15\textwidth]{`r getwd()`/logov2.png}}
|
||||
params:
|
||||
FileName: NA
|
||||
author: NA
|
||||
NoP: NA
|
||||
Assay: NA
|
||||
REP: NA
|
||||
coeffs: NA
|
||||
author: "Author: `r params$author`"
|
||||
title: |
|
||||
| {width=1in}
|
||||
| 4PL bioassay evaluation
|
||||
subtitle: |
|
||||
`r params$FileName`
|
||||
|
||||
<left> Unique time: </left> <right> `r Sys.time()`</right>
|
||||
date: "`r paste(params$NoP, params$Assay)`"
|
||||
|
||||
---
|
||||
|
||||
<!-- \fancyfoot[C]{\thepage\ of \pageref{LastPage}} -->
|
||||
<!-- \newpage -->
|
||||
|
||||
<!-- \newpage -->
|
||||
|
||||
```{r setup, include=FALSE}
|
||||
|
||||
knitr::opts_chunk$set(echo = TRUE)
|
||||
|
||||
library(knitr)
|
||||
library(DT)
|
||||
library(kableExtra)
|
||||
|
||||
REP <- params$REP
|
||||
author <- params$author
|
||||
coeffs <- params$coeffs
|
||||
|
||||
all_l <- REP$all_l
|
||||
ANOVAXLS <- REP$ANOVAXLS
|
||||
XLplot4pl <- REP$XLplot4pl
|
||||
DiagnTable <- REP$DiagnTable
|
||||
UnRPLAausw <- REP$UnRPLAausw
|
||||
UnRPLBend <- REP$UnRPLBend
|
||||
PLAausw <- REP$PLAausw
|
||||
PLbend <- REP$PLBend
|
||||
pottab4plXL <- REP$pottab4plXL
|
||||
Lim <- REP$Lim
|
||||
XLdat2 <- REP$XLdat2
|
||||
PureErr <- REP$PureErr
|
||||
|
||||
CIplot <- REP$CIplot
|
||||
testsTab <- REP$testsTab
|
||||
relpotTestPlot <- REP$relpotTestPlot
|
||||
|
||||
#browser()
|
||||
|
||||
```
|
||||
|
||||
|
||||
# Introduction
|
||||
|
||||
Bioassay potency estimation uses statistical methods to quantify the strength of a biological product or drug by comparing its response to that of a reference standard. Because biological responses are inherently variable, affected by assay conditions, cell systems or organisms, and measurement noise, the 4-parametric logistic regression is used to obtain reliable potency values.
|
||||
USP<1034> recommends calculation of standard errors of ratios of the parameters using Fieller's theorem [Finney DJ 1978] or using the "delta" method (for a discussion about the "delta" method see [Ver Hoef 2012]). However, the presented gradient approach using the differences on the log-scale is mathematically more stable und thus preferable compared to a ratio approach ([Franz VH 2007]).
|
||||
|
||||
# Raw data
|
||||
|
||||
All data used for the 4PL evaluation is shown in table 1:
|
||||
|
||||
```{r alll, echo=FALSE, warning=FALSE, results='asis'}
|
||||
|
||||
kable(XLdat2, format = "markdown", caption= "Uploaded data (test and reference) ", digits=3)
|
||||
|
||||
```
|
||||
|
||||
|
||||
# Results
|
||||
|
||||
## Overall result
|
||||
|
||||
```{r Over_all, echo=FALSE, comment=NA, warning=NA, message=NA}
|
||||
|
||||
# browser()
|
||||
potFlag <- 0
|
||||
if (pottab4plXL["test_result"][[1]][1]==1) potFlag <- 1
|
||||
AnalysisFlag <- FALSE
|
||||
if (potFlag==1 | sum(testsTab$test_results)>0) AnalysisFlag <- TRUE
|
||||
|
||||
colFmt <- function() {
|
||||
|
||||
outputFormat <- knitr::opts_knit$get("rmarkdown.pandoc.to")
|
||||
if(AnalysisFlag) {
|
||||
text <- paste("\\textcolor{red}{Analysis failed}",sep="")
|
||||
} else {
|
||||
text <- paste("\\textcolor{black}{Analysis succeeded}",sep="")
|
||||
}
|
||||
return(text)
|
||||
}
|
||||
|
||||
|
||||
```
|
||||
|
||||
`r colFmt()`
|
||||
|
||||
|
||||
## 4pl-regression
|
||||
|
||||
Relative potency (absolute and relative confidence limits) are shown in Table 2. `r if(PureErr) {"Pure Error is used for calculations."}`
|
||||
`r if (!PureErr) {"RMSE of restricted model is used for confidence limit calculation."}`
|
||||
|
||||
```{r Pot_tab4pl, echo=FALSE, comment=NA, warning=NA, message=NA}
|
||||
|
||||
#browser()
|
||||
if (pottab4plXL["test_result"][[1]][1]==1) { cat(paste("FAILED: relative potency CL result of restricted model outside limits: ", Lim[[9]], "to" ,Lim[[10]] ))}
|
||||
if (pottab4plXL["test_result"][[1]][1]==0) { cat(paste("PASSED: relative potency CL result of restricted model within limits: ", Lim[[9]], "to" ,Lim[[10]] ))}
|
||||
kable(pottab4plXL, format = "markdown", caption= "Relative potency with absolute and relative CLs ", digits=3, row.names = F) %>%
|
||||
kable_styling(latex_options = "hold_position")
|
||||
|
||||
|
||||
```
|
||||
NOTE: results of unrestricted model for Information only.
|
||||
|
||||
|
||||
## Plot of the data and models
|
||||
|
||||
Plots in Figure 1 show the restricted and unrestricted model, respectively.
|
||||
|
||||
|
||||
```{r XLplot, echo=FALSE, warning=FALSE, fig.height=4, fig.width=6, fig.cap="Plot of models", fig.align='left', comment=F, message=F, results='asis', fig.pos='H'}
|
||||
|
||||
library(cowplot)
|
||||
|
||||
|
||||
plot_grid(XLplot4pl)
|
||||
|
||||
|
||||
```
|
||||
|
||||
|
||||
## ANOVA table
|
||||
|
||||
The ANOVA of the unconstrained model is listed in table 3. Bates and Watts proposed a test on parallelism which compares the residual sum of squares of the restricted model (ResRSSE) with the residual sum of squares of the unrestricted model (UnresRSSE). If the UnresRSSE is significantly smaller than the ResRSSE, the p-value of "Non-parallelism" is smaller than 0.05 (line 4 in table 3). This test is for information only as it may be overly sensitive in case of small overall variability of the data.
|
||||
|
||||
```{r anovaxls, echo=FALSE, warning=FALSE, results='asis'}
|
||||
|
||||
kable(ANOVAXLS, format = "markdown", caption= "Analysis of variance", digits=3) %>%
|
||||
kable_styling(latex_options = "hold_position")
|
||||
|
||||
|
||||
```
|
||||
|
||||
## Assay suitability tests
|
||||
|
||||
Table 4 lists the chosen suitability test results with confidence limits, where applicable. F-tests should be read with caution, if the overall variability is small, as the test gets overly sensitive.
|
||||
|
||||
|
||||
```{r SST_ergebn, echo=FALSE, cache=FALSE, warning=FALSE, message=FALSE, tidy=TRUE}
|
||||
|
||||
kable(testsTab, row.names = F, format = "markdown", caption="Assay suitability results", digits=4)
|
||||
|
||||
|
||||
```
|
||||
|
||||
|
||||
\footnotesize
|
||||
|
||||
```{r Fussnote, echo=F, comment=NA}
|
||||
|
||||
cat("*...The estimate for F-test on regression and on non-linearity is the p-value")
|
||||
cat( "F-test on regression passes if F-value > F-crit and thus p < 0.05")
|
||||
cat( "F-test on non-linearity passes if F-value < F-crit and thus p > 0.05")
|
||||
cat( "Test results outcome:")
|
||||
cat(" 0 ... test passed (for EQ tests: CL within limits);")
|
||||
cat(" 1 ... test failed (for EQ tests: CL not within limits);")
|
||||
|
||||
|
||||
|
||||
```
|
||||
|
||||
\normalsize
|
||||
|
||||
|
||||
```{r AST_Ergebn, echo=FALSE, cache=FALSE, warning=FALSE, message=FALSE, tidy=TRUE}
|
||||
|
||||
TestsTabFlag <- FALSE
|
||||
if (sum(testsTab$test_results)>0) TestsTabFlag <- TRUE
|
||||
colFmt2 <- function() {
|
||||
|
||||
outputFormat <- knitr::opts_knit$get("rmarkdown.pandoc.to")
|
||||
if(TestsTabFlag) {
|
||||
text <- paste("\\textcolor{red}{Assay suitability tests failed}",sep="")
|
||||
} else {
|
||||
text <- paste("\\textcolor{black}{Assay suitability tests succeeded}",sep="")
|
||||
}
|
||||
return(text)
|
||||
}
|
||||
|
||||
|
||||
```
|
||||
|
||||
|
||||
`r colFmt2()`
|
||||
|
||||
|
||||
|
||||
|
||||
## Fitting results with curve points
|
||||
|
||||
The results of the non-linear fitting procedure for the restricted model (5 parameters) is listed in table 5:
|
||||
|
||||
```{r PLAausw, echo=FALSE, warning=FALSE, results='asis'}
|
||||
|
||||
kable(PLAausw, format = "markdown", caption= "Restricted 4PL model", digits=3, row.names = F)
|
||||
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
Sebaugh et al proposed bend points for test and reference samples, that define the points with highest turning behavior. Table 6 lists these bendpoints as well as asymptote points ~ twice as far from the center as the bendpoints.
|
||||
|
||||
```{r PLBend, echo=FALSE, warning=FALSE, results='asis'}
|
||||
|
||||
kable(PLbend, format = "markdown", caption= "Bendpoints and asymptote points of restricted 4PL model", digits=3)
|
||||
|
||||
|
||||
```
|
||||
|
||||
The results of the non-linear fitting procedure for the unrestricted model (8 parameters) is listed in table 7:
|
||||
|
||||
```{r UnRPLAausw, echo=FALSE, warning=FALSE, results='asis'}
|
||||
|
||||
kable(UnRPLAausw, format = "markdown", caption= "Unrestricted 4PL model", digits=3, row.names = F)
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
# Signature
|
||||
|
||||
|
||||
\vspace{1.5cm}
|
||||
\noindent
|
||||
\begin{tabular}{p{6cm}p{1cm}p{6cm}}
|
||||
\cline{1-1} \cline{3-3}
|
||||
Date & & Signature
|
||||
\end{tabular}
|
||||
|
||||
|
||||
\newpage
|
||||
|
||||
# Appendix: Formulas
|
||||
|
||||
## 4PL regression
|
||||
|
||||
$$
|
||||
Y = D + \frac{A-D} {1+(\frac{C} {x})^B } + \epsilon
|
||||
$$
|
||||
|
||||
where: x ... concentration of the analyte
|
||||
|
||||
A: upper asymptote
|
||||
|
||||
B: slope
|
||||
|
||||
D: lower asymptote
|
||||
|
||||
C ... EC50
|
||||
|
||||
|
||||
## log-logistic 4P regression
|
||||
|
||||
$$
|
||||
Y = D + \frac{A-D} {1+e^{(B*(C - log(x))) }} + \epsilon
|
||||
$$
|
||||
|
||||
|
||||
|
||||
## Intercept for slope at EC50
|
||||
|
||||
$$
|
||||
I = A+\frac{D-A}{2}-B_{true}*EC50
|
||||
$$
|
||||
|
||||
## Slope at EC50
|
||||
|
||||
$$
|
||||
B_{true}=B*\frac{D-A}{4}
|
||||
$$
|
||||
|
||||
## Confidence intervals
|
||||
|
||||
In general, the confidence intervals are calculated as follows:
|
||||
$$
|
||||
CI = \hat\theta\pm se(\hat\theta)*q^{t_{n-p}}_{1-\frac{\alpha}{2}}
|
||||
$$
|
||||
…where $\hat\theta$ is a fitted parameter or a linear combination thereof, q is the 1-alpha/2 quantile of the Student’s t-distribution with n-p degrees of freedom and se is the standard error derived from any covariance matrix.
|
||||
|
||||
Let $\theta$ be the 4+1 parameters of the fit (a, b, d, EC50 of reference and EC50 difference). It can be shown that the least squares estimator $\hat\theta$ is normally distributed with asymptotic covariance matrix. The gradient method provides one of several ways to calculate the covariance matrix:
|
||||
|
||||
$$
|
||||
\hat{V(\theta)}= \sigma^2(A(\hat\theta)^T*A(\hat\theta))^{-1}
|
||||
$$
|
||||
where A($\theta$) is the n x p matrix of the first partial derivatives for each parameter (i.e. gradient) realized at the fitted parameter estimates. The RMSE of the model or the pure error is used as estimate of $\sigma$. The square root of the diagonals of $\hat{V(\theta)}$ gives the standard errors and with that confidence intervals (CI) can be computed.
|
||||
|
||||
# Literature
|
||||
|
||||
Finney, D.J.: (1978) Statistical Method in Biological Assay, London: Charles Griffin House, 3rd edition (pp. 80-82)
|
||||
|
||||
Franz, V.H.: Ratios: A short guide to confidence limits and proper use. arXiv:0710.2024v1, 10 Oct 2007
|
||||
|
||||
VerHoef, J.M.: Who invented the Delta Method? The American Statistician, 2012, 66:2, 124-127 DOI: 10.1080/00031305.2012.687494
|
||||
|
||||
Bates, D.M., Watts, D.G. (1988). Comparing models. In: Nonlinear Regression Analysis and Its Applications. New York: Wiley, pp 103-108
|
||||
|
||||
Bates, D.M., Watts, D.G. (1988) 2. In: Nonlinear Regression Analysis and Its Applications. New York: Wiley, pp 52-58
|
||||
|
||||
|
||||
|
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 23 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 35 KiB |
+118
@@ -0,0 +1,118 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
width="10mm"
|
||||
height="10mm"
|
||||
viewBox="0 0 10 10"
|
||||
version="1.1"
|
||||
id="svg1"
|
||||
inkscape:export-filename="logov2.png"
|
||||
inkscape:export-xdpi="1300.48"
|
||||
inkscape:export-ydpi="1300.48"
|
||||
inkscape:version="1.4.4 (dcaf3e7d9e, 2026-05-05)"
|
||||
sodipodi:docname="logov2.svg"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:svg="http://www.w3.org/2000/svg">
|
||||
<sodipodi:namedview
|
||||
id="namedview1"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#000000"
|
||||
borderopacity="0.25"
|
||||
inkscape:showpageshadow="2"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pagecheckerboard="0"
|
||||
inkscape:deskcolor="#d1d1d1"
|
||||
inkscape:document-units="mm"
|
||||
showguides="true"
|
||||
inkscape:zoom="23.455313"
|
||||
inkscape:cx="9.5500753"
|
||||
inkscape:cy="17.885074"
|
||||
inkscape:window-width="1267"
|
||||
inkscape:window-height="1400"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="0"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="layer1"
|
||||
inkscape:export-bgcolor="#ffffffff">
|
||||
<sodipodi:guide
|
||||
position="4.9999999,9.9999997"
|
||||
orientation="-1,0"
|
||||
id="guide1"
|
||||
inkscape:locked="false"
|
||||
inkscape:label=""
|
||||
inkscape:color="rgb(0,134,229)" />
|
||||
<sodipodi:guide
|
||||
position="0,4.9999999"
|
||||
orientation="0,1"
|
||||
id="guide2"
|
||||
inkscape:locked="false"
|
||||
inkscape:label=""
|
||||
inkscape:color="rgb(0,134,229)" />
|
||||
<sodipodi:guide
|
||||
position="0,1.9999999"
|
||||
orientation="0,1"
|
||||
id="guide3"
|
||||
inkscape:locked="false"
|
||||
inkscape:label=""
|
||||
inkscape:color="rgb(0,134,229)" />
|
||||
<sodipodi:guide
|
||||
position="0,7.9999998"
|
||||
orientation="0,1"
|
||||
id="guide4"
|
||||
inkscape:locked="false"
|
||||
inkscape:label=""
|
||||
inkscape:color="rgb(0,134,229)" />
|
||||
<sodipodi:guide
|
||||
position="0.49999999,9.9999997"
|
||||
orientation="-1,0"
|
||||
id="guide5"
|
||||
inkscape:locked="false"
|
||||
inkscape:label=""
|
||||
inkscape:color="rgb(0,134,229)" />
|
||||
<sodipodi:guide
|
||||
position="9.4999997,9.9999997"
|
||||
orientation="-1,0"
|
||||
id="guide6"
|
||||
inkscape:locked="false"
|
||||
inkscape:label=""
|
||||
inkscape:color="rgb(0,134,229)" />
|
||||
</sodipodi:namedview>
|
||||
<defs
|
||||
id="defs1" />
|
||||
<g
|
||||
inkscape:label="Layer 1"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer1">
|
||||
<circle
|
||||
style="fill:#418fb7;fill-opacity:1;stroke:#000000;stroke-width:0.264583;stroke-opacity:1"
|
||||
id="path2"
|
||||
cx="5"
|
||||
cy="5"
|
||||
r="3.4559603" />
|
||||
<circle
|
||||
style="display:inline;fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:0.7;stroke-dasharray:none;stroke-opacity:1"
|
||||
id="circle8"
|
||||
cx="5"
|
||||
cy="5"
|
||||
r="3.4559603" />
|
||||
<circle
|
||||
style="fill:none;fill-opacity:1;stroke:#000000;stroke-width:0.3;stroke-opacity:1;stroke-dasharray:none"
|
||||
id="circle7"
|
||||
cx="5"
|
||||
cy="5"
|
||||
r="3.4559603" />
|
||||
<path
|
||||
style="fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:0.7;stroke-linecap:round;stroke-dasharray:none;stroke-opacity:1"
|
||||
d="m 0.5,8 c 4,0 5.0000001,-5.9999999 9,-6"
|
||||
id="path7"
|
||||
sodipodi:nodetypes="cc" />
|
||||
<path
|
||||
style="fill:none;fill-opacity:1;stroke:#000000;stroke-width:0.3;stroke-linecap:round;stroke-dasharray:none;stroke-opacity:1"
|
||||
d="m 0.5,8 c 4,0 5.0000001,-5.9999999 9,-6"
|
||||
id="path6"
|
||||
sodipodi:nodetypes="cc" />
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 3.6 KiB |
+20
@@ -0,0 +1,20 @@
|
||||
library(shiny)
|
||||
library(shinydashboard)
|
||||
library(shinyjs)
|
||||
library(shinyAce)
|
||||
library(shinycssloaders)
|
||||
library(shinyBS)
|
||||
library(purrr)
|
||||
library(gslnls)
|
||||
library(tidyverse)
|
||||
library(ggplot2)
|
||||
library(reshape2)
|
||||
library(openxlsx)
|
||||
library(DT)
|
||||
library(ggpubr)
|
||||
library(gridExtra)
|
||||
library(drc)
|
||||
library(twopartm)
|
||||
library(car)
|
||||
library(dplyr)
|
||||
library(scales)
|
||||
Vendored
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
After Width: | Height: | Size: 292 KiB |
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user