大家好,
我无法在R包DRC中绘制drm。
我的数据包含三个变量;浓度(测定中使用的化合物浓度的数字向量,单位为mg / L),除草剂(化合物类型的特征向量),抑制(每个测试处理的抑制数字载体)。
剂量反应曲线工作正常,曲线和模型单独工作。
我尝试重新组织数据框,以便在顶部使用不同的除草剂(即D或E而不是A或B),并且持续不合适的曲线似乎影响前两种除草剂,无论它们是什么。
提前致谢!
我的代码如下所示,错误(Q 3)是最后一行:
multi.m1 <- drm(mydata$Inhib~mydata$Concentration, data = mydata, Herbicide, fct = LL.4())
plot(multi.m1) ##try limit y axis, change x axis for broken
plot(multi.m1, col = TRUE, pch = 20:25, xlab = "Concentration", ylab = "Inhibition", broken = TRUE)
plot(multi.m1, ylim = c(-5, 102), broken = TRUE, add = TRUE,
type = "confidence") #why does x axis break appear wonky? -> ask the oracle
Error in parmMat[, groupLevels, drop = FALSE] : subscript out of bounds
编辑,mydata:
Concentration Herbicide Inhib
1 2.2375e-02 C 84.1171273
2 2.2375e-02 C 83.2708908
3 2.2375e-02 C 80.7519653
4 8.9500e-03 C 73.7143264
5 8.9500e-03 C 76.9312856
6 8.9500e-03 C 69.5508871
7 3.5800e-03 C 58.9470598
8 3.5800e-03 C 60.3750236
9 3.5800e-03 C 58.1370479
10 1.4320e-03 C 30.2296338
11 1.4320e-03 C 26.6788108
12 1.4320e-03 C 45.5096997
13 5.7300e-04 C 9.0653245
14 5.7300e-04 C -3.1497620
15 5.7300e-04 C 2.0924363
16 2.2375e-02 C 62.8053281
17 2.2375e-02 C 62.8053281
18 2.2375e-02 C 69.8827947
19 8.9500e-03 C 59.6812753
20 8.9500e-03 C 59.6812753
21 8.9500e-03 C 59.6812753
22 3.5800e-03 C 49.1470273
23 3.5800e-03 C 50.3237083
24 3.5800e-03 C 45.8087647
25 1.4320e-03 C 27.2677293
26 1.4320e-03 C 22.1870253
27 1.4320e-03 C 30.0683330
28 5.7300e-04 C 15.5899507
29 5.7300e-04 C 6.5319619
30 5.7300e-04 C 5.7281208
31 5.6200e+02 D 63.9535852
32 5.6200e+02 D 61.6934485
33 5.6200e+02 D 63.9535852
34 2.2500e+02 D 59.5337963
35 2.2500e+02 D 57.4660724
36 2.2500e+02 D 66.3240151
37 9.0000e+01 D 41.9942602
38 9.0000e+01 D 45.0317602
39 9.0000e+01 D 46.6248268
40 3.6000e+01 D 21.8067846
41 3.6000e+01 D 21.8067846
42 3.6000e+01 D 24.8129501
43 1.4400e+01 D 13.7654019
44 1.4400e+01 D 10.5784119
45 1.4400e+01 D 12.9488419
46 5.6200e+02 D 101.8769351
47 5.6200e+02 D 102.1410258
48 5.6200e+02 D 93.7975216
49 2.2500e+02 D 93.5444549
50 2.2500e+02 D 92.1264940
51 2.2500e+02 D 92.4857338
52 9.0000e+01 D 75.5170610
53 9.0000e+01 D 71.5852452
54 9.0000e+01 D 73.0984175
55 3.6000e+01 D 53.5097851
56 3.6000e+01 D 54.2592274
57 3.6000e+01 D 60.2304326
58 1.4400e+01 D 34.6248616
59 1.4400e+01 D 28.6424632
60 1.4400e+01 D 30.8926163
61 4.0000e-02 E 71.3055968
62 4.0000e-02 E 67.3600153
63 4.0000e-02 E 63.7579815
64 2.8571e-02 E 57.3765637
65 2.8571e-02 E 49.3390342
66 2.8571e-02 E 60.4444317
67 2.0408e-02 E 44.7345962
68 2.0408e-02 E 43.6592819
69 2.0408e-02 E 36.8254304
70 1.4577e-02 E 32.5538843
71 1.4577e-02 E 25.1417758
72 1.4577e-02 E 32.5538843
73 1.0472e-02 E 13.4025320
74 1.0472e-02 E 23.8062641
75 1.0472e-02 E 17.7074226
76 4.0000e-02 E 91.6851862
77 4.0000e-02 E 75.5919138
78 4.0000e-02 E 91.5043781
79 2.8571e-02 E 66.4345965
80 2.8571e-02 E 73.3145119
81 2.8571e-02 E 62.6140016
82 2.0408e-02 E 52.0485485
83 2.0408e-02 E 56.1078884
84 2.0408e-02 E 49.0660567
85 1.4577e-02 E 50.9756413
86 1.4577e-02 E 47.8435190
87 1.4577e-02 E 39.5595697
88 1.0472e-02 E 36.4083394
89 1.0472e-02 E 27.2520151
90 1.0472e-02 E 36.8735853
91 2.5000e-01 A 59.6812753
92 2.5000e-01 A 66.1900088
93 2.5000e-01 A 59.6812753
94 1.0000e-01 A 41.7461116
95 1.0000e-01 A 48.0034967
96 1.0000e-01 A 50.3237083
97 4.0000e-02 A 33.8648039
98 4.0000e-02 A 16.1005569
99 4.0000e-02 A 23.3988362
100 1.6000e-02 A 13.6094285
101 1.6000e-02 A 5.7281208
102 1.6000e-02 A 9.4777989
103 6.4000e-03 A 2.6630689
104 6.4000e-03 A 0.1587632
105 6.4000e-03 A -0.1867083
106 2.5000e-01 A 75.2770560
107 2.5000e-01 A 74.4016723
108 2.5000e-01 A 74.0126249
109 1.0000e-01 A 51.1490611
110 1.0000e-01 A 54.9412310
111 1.0000e-01 A 52.9289775
112 4.0000e-02 A 36.6921613
113 4.0000e-02 A 20.3596646
114 4.0000e-02 A 28.7826960
115 1.6000e-02 A 7.9617212
116 1.6000e-02 A 3.5240504
117 1.6000e-02 A 1.4995895
118 6.4000e-03 A -4.7738737
119 6.4000e-03 A -11.5182880
120 6.4000e-03 A -6.8625243
121 2.1020e-02 B 65.1307269
122 2.1020e-02 B 63.7534772
123 2.1020e-02 B 69.6048270
124 1.4500e-02 B 39.1407346
125 1.4500e-02 B 37.1314501
126 1.4500e-02 B 36.4855432
127 1.0000e-02 B 31.1355743
128 1.0000e-02 B 25.5101867
129 1.0000e-02 B 35.2270466
130 6.8965e-03 B 20.2249022
131 6.8965e-03 B 11.1906726
132 6.8965e-03 B 21.9030270
133 4.7500e-03 B 9.9321760
134 4.7500e-03 B 10.8719563
135 4.7500e-03 B 11.1906726
136 2.1020e-02 B 83.0444344
137 2.1020e-02 B 80.0717309
138 2.1020e-02 B 83.0444344
139 1.4500e-02 B 64.4239326
140 1.4500e-02 B 68.1575575
141 1.4500e-02 B 69.0731273
142 1.0000e-02 B 42.8229958
143 1.0000e-02 B 48.0750454
144 1.0000e-02 B 58.4858694
145 6.8965e-03 B 48.3924985
146 6.8965e-03 B 47.2534892
147 6.8965e-03 B 32.4004160
148 4.7500e-03 B 25.4700950
149 4.7500e-03 B 31.1661066
150 4.7500e-03 B 28.5676908
答案 0 :(得分:2)
将模型上限固定在100可能会加剧过度拟合的问题,也可能与正在研究的生物学不一致。关于上限的另外两个选项可能更合适。
第一种是使用upperl
;
multi.m2 <- drm(Inhib~Concentration, data = mydata, Herbicide,
fct = LL.4(),
upperl=c(NA,NA,100,NA))
第二个选项是使用pmodels
指导drm计算所有除草剂汇总数据的上限。
multi.m3 <- drm(Inhib~Concentration, data = mydata, Herbicide,
fct = LL.4(),
pmodels=data.fram(Herbicide,Herbicide,1,Herbicide))
答案 1 :(得分:1)
显然,正如您所期望的那样,上限没有特定的默认值100。但是,在您完成文档跟踪之后强加一个并不困难:
?drm
?LL.4
?ryegrass # where you can see the naming of parameters of LL.4 parameters
因此,只将LL.4限制的第三个参数设置为预期的100,我们得到:
multi.m1 <- drm(Inhib~Concentration, data = mydata[c(3,1,2)], Herbicide,
fct = LL.4(fixed=c(NA, NA, 100, NA),
names = c("Slope", "Lower Limit", "Upper Limit", "ED50")))
plot(multi.m1, col = TRUE, pch = 20:25, xlab = "Concentration", ylab = "Inhibition")
如果您还需要在下限上设置零,则前进的方向是明确的。甲骨文已经发言了。