I'm looking to solve the point where 2 opposite Weibull functions meet. I'm using the drc package, with a type 2 Weibull having 2 parameters in R
. I've fit both lines to my data, and now I have the e and b intercepts for the functions defining each line. I would like to now solve for where the x values are equivalent.
The Weibull (type2) 2 parameter function is: $$ f(x)= 1-\exp\left[-\exp\left(b\times (\log(x) - \log(e)\right))\right] $$ exponential decay line:
Estimate Std. Error t-value p-value
b:(Intercept) -2.226194 0.225339 -9.879323 0
e:(Intercept) 1.209326 0.072042 16.786444 0
exponential increase line:
Estimate Std. Error t-value p-value
b:(Intercept) 1.616248 0.145047 11.142956 0
e:(Intercept) 1.837511 0.072107 25.482970 0
Ideally I would also like to get a confidence interval for this point. I have this run in R so if I could input a suggested code that would be great.
This is for a paper I'm writing, and I would add the solver of this question to this publication. In the paper, I'm using the Weibull function to model a PCR reaction.
Here is the code for the exponential increasing instance:
# first import the raw data:
# I pull it from Excel
> CCrelative <- read.xlsx('CC relative fold increase.xlsx', 1)
> colnames(CCrelative) <- c("MolOffTarget", "x1", "x2")
> print(CCrelative)
#here it is after the import
MolOffTarget x1 x2
1 50001.0 8.474 8.372
2 5001.0 7.795 7.617
3 501.0 7.090 7.291
4 56.0 6.258 4.803
5 6.0 2.093 1.890
6 1.5 0.911 0.679
7 1.1 0.480 0.508
#now set the minimum of each column to 0 by subtracting the lowest value from each
> CClog0 <- transform(CCrelative, x1 = (x1-(CCrelative[7,2])), x2=(x2-(CCrelative[7,3])))
#now normalize to the maximum value
> CClogT <- transform(CClog0, x1 = (x1/(CClog0[1,2])), x2=(x2/(CClog0[1,3])))
# now make the first column log10 scale
> CClogT <- transform(CClogT, MolOffTarget = log10(MolOffTarget))
#now merge columns x1 and x2 into a new data frame
> CClogT2 <- data.frame(rep(CClogT$MolOffTarget, 2), c(CClogT$x1,CClogT$x2))
> colnames(CClogT2) <- c("MolOffTarget", "FAM")
> CClogT2.W2.2 <- drm(FAM ~ MolOffTarget, data = CClogT2, fct = W2.2())
Here is the code for the exponential decay:
> CCvicRelative <- read.xlsx('CCvicRelative fold increase.xlsx', 1)
> colnames(CCvicRelative) <- c("MolOffTarget", "x1", "x2")
> print(CCvicRelative)
MolOffTarget x1 x2
1 50001.0 -0.717 -0.706
2 5001.0 -0.565 -0.567
3 501.0 -0.360 -0.349
4 56.0 -0.001 0.584
5 6.0 1.568 1.582
6 1.5 1.767 1.822
7 1.1 1.802 1.844
#now set the minimum of each column to 0 by subtracting the lowest value from each
> CCvic0 <- transform(CCvicRelative, x1 = (x1-(CCvicRelative[1,2])), x2=(x2-(CCvicRelative[1,3])))
#now normalize to the maximum value
> CCvicT <- transform(CCvic0, x1 = (x1/(CCvic0[7,2])), x2=(x2/(CCvic0[7,3])))
# now make the first column log10 scale
> CCvicTlog <- transform(CCvicT, MolOffTarget = log10(MolOffTarget))
#now merge columns x1 and x2 into a new data frame
> CCvicT2 <- data.frame(rep(CCvicTlog$MolOffTarget, 2), c(CCvicTlog$x1,CCvicTlog$x2))
> colnames(CCvicT2) <- c("MolOffTarget", "VIC")
> CCvicT2.W2.2 <- drm(VIC ~ MolOffTarget, data = CCvicT2, fct = W2.2())
Apologies it's coming up a bit funny on this HTML.
It took me a bit to get used to this package. I was using Bioconductor packages before.
I made a mistake with the Weibull function earlier. The correct one is now present.
drc
package, I could help you writing the bootstrap function withR
(withboot
). $\endgroup$