################################################################################ # Test file for functions of plateflow # F. Innerbichler # 13.5.2026 ################################################################################ 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 LinPotTab(circles=CIRC, Lim, PureErrF) # Potency lower 95%CI upper 95%CI test_result lowerRel95%CI upperRel95%CI # isSample 104.959 87.994 125.196 0 83.836 119.281 as=3; bs=1; cs=-4; ds=10; at=3; bt=1; dt=10;r=0.0001;ct=cs-r;sd_fac=0.1; gt=1; gs=1; lnConc=c(1,0,-1,-2,-3,-4,-5,-6) heteroNoise <- FALSE noDilS <- 3 noD <- 8 Calc_DilRes(as,bs,cs,ds,at,bt,dt,r,ct,sd_fac,gt,gs,log_conc=lnConc, heteroNoise, noDilS, noD) # R_dil1 R_dil2 R_dil3 T_dil1 T_dil2 T_dil3 log_dose # [1,] 9.953324 9.958311 9.952765 9.964621 9.951204 9.962239 1 # [2,] 9.878524 9.877231 9.884573 9.866374 9.874134 9.878356 0 # [3,] 9.654425 9.671862 9.680914 9.665887 9.670981 9.680247 -1 # [4,] 9.174863 9.167155 9.143036 9.177929 9.165979 9.163067 -2 # [5,] 8.120441 8.122103 8.110990 8.107848 8.124945 8.109104 -3 # [6,] 6.495730 6.497168 6.501670 6.503780 6.497561 6.500025 -4 # [7,] 4.886209 4.877895 4.883961 4.890778 4.874703 4.889223 -5 # [8,] 3.829636 3.819950 3.830449 3.836558 3.831859 3.828217 -6 dat <- data.frame(REF1=c(1547, 1620, 1644, 2504, 3426, 3512, 3401, 3787), REF2=c(1492, 1536, 1384, 2286, 3046, 3479, 3516, 3497), REF3=c(1468, 1827, 1558, 2252, 3002, 3349, 2945, 3665), TEST1=c(1405, 1523, 1502, 1474, 2383, 3221, 3589, 3445), TEST2=c(1420, 1516, 1544, 1512, 2226, 3219, 3327, 3591), TEST3=c(1399, 1376, 1588, 1475, 2148, 3083, 2942, 3466), log_dose=c(5.01,3.401,2.708,2.015,1.32176,0.62861,-0.0645385,-1.6739764)) TransF<- FALSE Dat<- list() p <- plot_f(dat,TransF) print(p) # Plot4PL.png # Error in chol2inv(object$m$Rmat()) : # element (2, 2) is zero, so the inverse cannot be computed # In addition: # Warning messages: # 1: In nlsModel(formula, mf, cFit, .swts, jac) : # singular gradient matrix at parameter estimates # 2: In nlsModel(formula, mf, cFit, .swts, jac) : # singular gradient matrix at parameter estimates dat <- data.frame(R_dil1 =c(10221, 18258, 31993, 49336, 68332, 83527, 95584, 102229), R_dil2=c( 10136, 19078, 31925, 49003, 68034, 83776, 95495, 101608), T_dil1=c( 10830, 19891, 33915, 52131, 70617, 85784, 95937, 102791), T_dil2=c( 11169, 20153, 34007, 52179, 69962, 85543, 96439, 102655), log_dose=c( -1.2029, -1.89712, -2.590267, -3.2834, -3.97656, -4.66917, -5.362323, -6.05334)) CIRC <- data.frame(log_dose=c( -2.590267, -2.590267, -3.2834 , -3.2834,-3.97656, -3.97656, -2.590267, -2.590267,-3.2834, -3.2834, -3.97656, -3.97656), replname= c("R_dil1","R_dil2","R_dil1", "R_dil2","R_dil1","R_dil2", "T_dil1","T_dil2","T_dil1", "T_dil2","T_dil1","T_dil2"), readout = c(31993, 31925, 49336, 49003 , 68332, 68034 , 33915, 34007, 52131, 52179 , 70617, 69962), isRef=c(rep(1,6), rep(0,6)), isSample = c(rep(0,6), rep(1,6))) Lim <- c(rep(0,8),70,130) # only Lim 9 and 10 relevant PureErrF <- TRUE ANOVAlintests(ro_new=dat, circles=CIRC, Lim=Lim, PureErrF) # [[1]] # test test_results estimate Source df SumSquares MS F.value p.value # 1 F-test on sign. of regression 0 0.00000 Treatment 3 3889.33189 1296.44396 127.75497 0 # 2 F_test on non-lin 0 0.58832 Preparation 1 969.90761 969.90761 31.85908 0 # 3 F-test on R^2 A 0 0.25260 Regression 1 2903.63083 2903.63083 286.13136 0 # 4 F_test on R^2 B 0 0.85290 Non-parallelism 1 4.53646 4.53646 0.52154 0.484 # 5 F-test on slope A 0 0.00000 Resid Error 14 133.03173 9.50227 # 6 F-test on slope B 0 0.00000 Non-linearity 2 11.25699 5.62850 0.55465 0.58832 # 7 F-test on non-parallelism 0 0.48400 Pure error 12 121.77473 10.14789 # 8 F-test on preparation 0 0.00000 Total 17 4011.10663 235.94745 # # [[2]] # parameter Estimate Std. Error t value Pr(>|t|) # (Intercept) intercept REF 131.223810 6.039254 21.7284793 5.288214e-11 # log_dose slope REF 22.342857 1.857866 12.0260887 4.720297e-08 # isSample intercepts diff. -4.977419 9.167857 -0.5429207 5.971246e-01 # log_dose:isSample slope difference -1.698577 2.540472 -0.6686068 5.164021e-01 # # [[3]] # log_dose:isSample log_dose:isSample # -1.698577 -7.556917 4.159763 # # [[4]] # parameter Estimate Std. Error t value Pr(>|t|) # (Intercept) intercept REF 128.316878 4.191623 30.6126966 1.0000000 # log_dose slope REF 21.434441 1.267154 16.9154178 1.0000000 # isSample intercepts diff. 1.037479 1.765952 0.5874899 0.5951663 ro_new <- data.frame(R_dil1 =c(10221, 18258, 31993, 49336, 68332, 83527, 95584, 102229), R_dil2=c( 10136, 19078, 31925, 49003, 68034, 83776, 95495, 101608), T_dil1=c( 10830, 19891, 33915, 52131, 70617, 85784, 95937, 102791), T_dil2=c( 11169, 20153, 34007, 52179, 69962, 85543, 96439, 102655), log_dose=c( -1.2029, -1.89712, -2.590267, -3.2834, -3.97656, -4.66917, -5.362323, -6.05334)) PureErrF <- TRUE pot4plFUNC(ro_new, PureErrF) # pot_est "restricted" "0.911577062498655" "0.902232125904588" "0.921018789971077" #potU_est "unrestricted" "0.900218901786783" "0.874169901564974" "0.92704412458425" #r "ln-transformed restr" "0.914213577701921" "0.902850729973349" "0.925719432800612" #r "ln-transformed unrestr" "0.990574387419529" "0.75948098671897" "1.29198443959817" xs=2; xt=3.2; se_xt=0.34;se_xs=0.23; DFs=32-16 ParamCI_F(xt,xs,se_xt, se_xs, CoVar,DFs, Conf=0.975) # [1] 1.14808 2.22981 dat <- data.frame(REF1=c(1547, 1620, 1644, 2504, 3426, 3512, 3401, 3787), REF2=c(1492, 1536, 1384, 2286, 3046, 3479, 3516, 3497), REF3=c(1468, 1827, 1558, 2252, 3002, 3349, 2945, 3665), TEST1=c(1405, 1523, 1502, 1474, 2383, 3221, 3589, 3445), TEST2=c(1420, 1516, 1544, 1512, 2226, 3219, 3327, 3591), TEST3=c(1399, 1376, 1588, 1475, 2148, 3083, 2942, 3466), log_dose=c(5.01,3.401,2.708,2.015,1.32176,0.62861,-0.0645385,-1.6739764)) Lim <- c(-1, 1, 0.005 , 2, 0.5, 2, 0.5,2,75,133, 75, 133) PureErrF <- FALSE #' tests_FUNC(dat, Lim,PureErrF) # test test_results estimate lower_limit upper_limit lower_CI upper_CI # 1 F-test on sign. of regression* 0 0.00000 - - 166.34405 153.405644181258 # 2 EQ test on lower asymptotes difference 1 -76.27934 -1 1 -270.281 117.723 # 3 EQ test ratio of lower asymptotes 0 0.95010 0.005 2 0.84509 1.06817 # 4 EQ test ratio of Hill slopes 1 0.92581 0.5 2 0.58023 2.01077 # 5 EQ test ratio of upper asymptotes 0 0.95010 0.5 2 0.92865 1.03996 # 6 F-test on non-linearity* 0 0.12180 - - - - # 7 EQ test ratio of asymptote difference 1 1.00851 75 133 0.8744 1.16319 # 8 geom. rel. CI restr. model 1 211.16000 75 133 1.81 2.46 # 9 geom. rel. CI unrestr. model 1 197.72000 75 133 1.63 2.4 tests_FUNC(dat, Lim,PureErrFlag=T) # test test_results estimate lower_limit upper_limit lower_CI upper_CI # 1 F-test on sign. of regression* 0 0.00000 - - 166.34405 153.405644181258 # 2 EQ test on lower asymptotes difference 1 -76.27935 -1 1 -270.281 117.723 # 3 EQ test ratio of lower asymptotes 0 0.95010 0.005 2 0.85388 1.05716 # 4 EQ test ratio of Hill slopes 0 0.92581 0.5 2 0.61299 1.90329 # 5 EQ test ratio of upper asymptotes 0 0.95010 0.5 2 0.93331 1.03477 # 6 F-test on non-linearity* 0 0.06397 - - - - # 7 EQ test ratio of asymptote difference 1 1.00851 75 133 0.8855 1.14861 # 8 geom. rel. CI restr. model 1 211.16000 75 133 1.81 2.46 # 9 geom. rel. CI unrestr. model 1 197.72000 75 133 1.63 2.4 ro_new <- data.frame(REF1=c(1547, 1620, 1644, 2504, 3426, 3512, 3401, 3787), REF2=c(1492, 1536, 1384, 2286, 3046, 3479, 3516, 3497), REF3=c(1468, 1827, 1558, 2252, 3002, 3349, 2945, 3665), TEST1=c(1405, 1523, 1502, 1474, 2383, 3221, 3589, 3445), TEST2=c(1420, 1516, 1544, 1512, 2226, 3219, 3327, 3591), TEST3=c(1399, 1376, 1588, 1475, 2148, 3083, 2942, 3466), log_dose=c(5.01,3.401,2.708,2.015,1.32176,0.62861,-0.0645385,-1.6739764)) ANOVA4plUnresfunc(ro_new) # Source DF SumSquares MeanSquares F.value p_value # 1 Treatment 7 36070704.40 5152957.772 179.14139 0 # 2 Preparation 1 1131295.02 1131295.02083 39.32921 0 # 3 Regression 3 36031469.73 12023568.134 417.54192 0 # 4 Non-Parallelism 3 39234.65 13078.216 0.45466 0.715 # 5 Residual Error 40 1150590.09 28764.75235 # 6 Non-linearity 8 397524.76 49690.59506 67.56807 0 # 7 Pure Error 32 23533.29 735.41536 # 8 Total 47 37221294.48 ro_new <- data.frame(REF1=c(1547, 1620, 1644, 2504, 3426, 3512, 3401, 3787), REF2=c(1492, 1536, 1384, 2286, 3046, 3479, 3516, 3497), REF3=c(1468, 1827, 1558, 2252, 3002, 3349, 2945, 3665), TEST1=c(1405, 1523, 1502, 1474, 2383, 3221, 3589, 3445), TEST2=c(1420, 1516, 1544, 1512, 2226, 3219, 3327, 3591), TEST3=c(1399, 1376, 1588, 1475, 2148, 3083, 2942, 3466), log_dose=c(5.01,3.401,2.708,2.015,1.32176,0.62861,-0.0645385,-1.6739764)) perConcTab(ro_new, noDilSeries=3) # 5.01 3.401 2.708 2.015 1.32176 0.62861 -0.06454 -1.67398 # REF1 1547.0000000 1620.000000 1644.000000 2504.000000 3426.000000 3512.000000 3401.000000 3787.000000 # REF2 1492.0000000 1536.000000 1384.000000 2286.000000 3046.000000 3479.000000 3516.000000 3497.000000 # REF3 1468.0000000 1827.000000 1558.000000 2252.000000 3002.000000 3349.000000 2945.000000 3665.000000 # avs 1502.3333333 1661.000000 1528.666667 2347.333333 3158.000000 3446.666667 3287.333333 3649.666667 # sds 40.5010288 149.769823 132.458799 136.738193 233.135154 86.176176 301.993929 145.606776 # cv 2.6958750 9.016847 8.664989 5.825257 7.382367 2.500276 9.186593 3.989591 # TEST1 1405.0000000 1523.000000 1502.000000 1474.000000 2383.000000 3221.000000 3589.000000 3445.000000 # TEST2 1420.0000000 1516.000000 1544.000000 1512.000000 2226.000000 3219.000000 3327.000000 3591.000000 # TEST3 1399.0000000 1376.000000 1588.000000 1475.000000 2148.000000 3083.000000 2942.000000 3466.000000 # avs_test 1408.0000000 1471.666667 1544.666667 1487.000000 2252.333333 3174.333333 3286.000000 3500.666667 # sds_test 10.8166538 82.923660 43.003876 21.656408 119.692662 79.103308 325.442775 78.932461 # cv_test 0.7682283 5.634677 2.784023 1.456383 5.314163 2.491966 9.903919 2.254784 x <- 1; Div <- 3;N <- 0; res <- c(); noDil <- 7 divFUN(x,Div,N,res,noDil) # [1] 0.3333333333 0.1111111111 0.0370370370 0.0123456790 0.0041152263 0.0013717421 0.0004572474