利用循环和lm语句获得了5000个标记的针对表型性状Trait1的线性拟合模型,想把每个模型中标记的P值提取出来并赋给每个标记,该如何操作。拟合模型的结果应该是一个列表,但是我在str(fit1)中没有找到相应的p-value。该怎么办,谢谢!
> str(fit[1])
List of 1
$ :List of 13
..$ coefficients : Named num [1:2] 65.42 5.61
.. ..- attr(*, "names")= chr [1:2] "(Intercept)" "mydata[, 2 + i]"
..$ residuals : Named num [1:229] 21.5 19.9 15.7 11.6 12.2 ...
.. ..- attr(*, "names")= chr [1:229] "1" "2" "3" "4" ...
..$ effects : Named num [1:229] -1012.95 37.7 16.35 9.61 10.21 ...
.. ..- attr(*, "names")= chr [1:229] "(Intercept)" "mydata[, 2 + i]" "" "" ...
..$ rank : int 2
..$ fitted.values: Named num [1:229] 65.4 65.4 71 65.4 65.4 ...
.. ..- attr(*, "names")= chr [1:229] "1" "2" "3" "4" ...
..$ assign : int [1:2] 0 1
..$ qr :List of 5
.. ..$ qr : num [1:229, 1:2] -15.1327 0.0661 0.0661 0.0661 0.0661 ...
.. .. ..- attr(*, "dimnames")=List of 2
.. .. .. ..$ : chr [1:229] "1" "2" "3" "4" ...
.. .. .. ..$ : chr [1:2] "(Intercept)" "mydata[, 2 + i]"
.. .. ..- attr(*, "assign")= int [1:2] 0 1
.. ..$ qraux: num [1:2] 1.07 1.04
.. ..$ pivot: int [1:2] 1 2
.. ..$ tol : num 1e-07
.. ..$ rank : int 2
.. ..- attr(*, "class")= chr "qr"
..$ df.residual : int 227
..$ na.action :Class 'omit' Named int [1:6] 24 29 35 105 145 209
.. .. ..- attr(*, "names")= chr [1:6] "24" "29" "35" "105" ...
..$ xlevels : Named list()
..$ call : language lm(formula = plant.height ~ mydata[, 2 + i], data = mydata)
..$ terms :Classes 'terms', 'formula' length 3 plant.height ~ mydata[, 2 + i]
.. .. ..- attr(*, "variables")= language list(plant.height, mydata[, 2 + i])
.. .. ..- attr(*, "factors")= int [1:2, 1] 0 1
.. .. .. ..- attr(*, "dimnames")=List of 2
.. .. .. .. ..$ : chr [1:2] "plant.height" "mydata[, 2 + i]"
.. .. .. .. ..$ : chr "mydata[, 2 + i]"
.. .. ..- attr(*, "term.labels")= chr "mydata[, 2 + i]"
.. .. ..- attr(*, "order")= int 1
.. .. ..- attr(*, "intercept")= int 1
.. .. ..- attr(*, "response")= int 1
.. .. ..- attr(*, ".Environment")=<environment: R_GlobalEnv>
.. .. ..- attr(*, "predvars")= language list(plant.height, mydata[, 2 + i])
.. .. ..- attr(*, "dataClasses")= Named chr [1:2] "numeric" "numeric"
.. .. .. ..- attr(*, "names")= chr [1:2] "plant.height" "mydata[, 2 + i]"
..$ model :'data.frame': 229 obs. of 2 variables:
.. ..$ plant.height : num [1:229] 86.9 85.3 86.7 77 77.6 ...
.. ..$ mydata[, 2 + i]: int [1:229] 0 0 1 0 0 1 0 0 1 0 ...
.. ..- attr(*, "terms")=Classes 'terms', 'formula' length 3 plant.height ~ mydata[, 2 + i]
.. .. .. ..- attr(*, "variables")= language list(plant.height, mydata[, 2 + i])
.. .. .. ..- attr(*, "factors")= int [1:2, 1] 0 1
.. .. .. .. ..- attr(*, "dimnames")=List of 2
.. .. .. .. .. ..$ : chr [1:2] "plant.height" "mydata[, 2 + i]"
.. .. .. .. .. ..$ : chr "mydata[, 2 + i]"
.. .. .. ..- attr(*, "term.labels")= chr "mydata[, 2 + i]"
.. .. .. ..- attr(*, "order")= int 1
.. .. .. ..- attr(*, "intercept")= int 1
.. .. .. ..- attr(*, "response")= int 1
.. .. .. ..- attr(*, ".Environment")=<environment: R_GlobalEnv>
.. .. .. ..- attr(*, "predvars")= language list(plant.height, mydata[, 2 + i])
.. .. .. ..- attr(*, "dataClasses")= Named chr [1:2] "numeric" "numeric"
.. .. .. .. ..- attr(*, "names")= chr [1:2] "plant.height" "mydata[, 2 + i]"
.. ..- attr(*, "na.action")=Class 'omit' Named int [1:6] 24 29 35 105 145 209
.. .. .. ..- attr(*, "names")= chr [1:6] "24" "29" "35" "105" ...
..- attr(*, "class")= chr "lm"