簡體   English   中英

分別在模型摘要中包含因變量的名稱

[英]Include a name of a dependent variable in model summary restrospectively

我有一個名為“ mylist”的列表,其中包含gam輸出。 第一個列表的摘要如下:

> summary(mylist[[1]][[1]])

Family: quasipoisson 
Link function: log 

Formula:
cardva ~ s(trend, k = 11 * 6, fx = T, bs = "cr") + s(temp_01,      k = 6, fx = F, bs = "cr") + rh_01 + as.factor(dow) + s(fluepi,     k = 4, fx = F, bs = "cr") + as.factor(holiday) + Lag(pm1010,    0)

Parametric coefficients:
                      Estimate Std. Error t value Pr(>|t|)    
(Intercept)          3.1584139  0.0331388  95.309  < 2e-16 ***
rh_01                0.0005441  0.0004024   1.352  0.17639    
as.factor(dow)2      0.0356757  0.0127979   2.788  0.00533 ** 
as.factor(dow)3      0.0388823  0.0128057   3.036  0.00241 ** 
as.factor(dow)4      0.0107302  0.0129014   0.832  0.40561    
as.factor(dow)5      0.0243382  0.0128705   1.891  0.05867 .  
as.factor(dow)6      0.0277954  0.0128360   2.165  0.03040 *  
as.factor(dow)7      0.0275593  0.0127373   2.164  0.03053 *  
as.factor(holiday)1  0.0444349  0.0147219   3.018  0.00255 ** 
Lag(pm1010, 0)      -0.0010816  0.0042891  -0.252  0.80091    

在取消列出列表之后,我提取了第一個列表的線性項的系數:

> head(plist)
[[1]]
                         Estimate   Std. Error    t value    Pr(>|t|)
(Intercept)          3.1584139271 0.0331388386 95.3085280 0.000000000
rh_01                0.0005441175 0.0004024202  1.3521128 0.176392590
as.factor(dow)2      0.0356757100 0.0127979429  2.7876128 0.005327293
as.factor(dow)3      0.0388823055 0.0128056733  3.0363343 0.002405504
as.factor(dow)4      0.0107302325 0.0129013816  0.8317119 0.405606249
as.factor(dow)5      0.0243382447 0.0128704711  1.8910143 0.058672841
as.factor(dow)6      0.0277953708 0.0128359850  2.1654256 0.030396240
as.factor(dow)7      0.0275592574 0.0127372874  2.1636677 0.030531063
as.factor(holiday)1  0.0444348611 0.0147218816  3.0182868 0.002553265
Lag(pm1010, 0)      -0.0010816252 0.0042890866 -0.2521808 0.800910389

我的問題是:是否可以在plist中包含因變量的名稱(在本例中為“心臟”)?

我要實現的是(故意減少輸出)

cardva          Estimate   Std. Error    t value    Pr(>|t|)
(Intercept)          3.1584139271 0.0331388386 95.3085280 0.000000000
rh_01                0.0005441175 0.0004024202  1.3521128 0.176392590
as.factor(dow)2      0.0356757100 0.0127979429  2.7876128 0.005327293

要么

                        Estimate   Std. Error    t value    Pr(>|t|) 
(Intercept)          3.1584139271 0.0331388386 95.3085280 0.000000000
rh_01                0.0005441175 0.0004024202  1.3521128 0.176392590
as.factor(dow)7      0.0275592574 0.0127372874  2.1636677 0.030531063
as.factor(holiday)1  0.0444348611 0.0147218816  3.0182868 0.002553265
cardva_Lag(pm1010, 0)      -0.0010816252 0.0042890866 -0.2521808 0.800910389

兩個選項:命名列表中的節點,以便隨后將其打印為:

names(plist)[1] <- 'cardva'
plist[1]
$cardva
                         Estimate   Std. Error    t value    Pr(>|t|)
(Intercept)          3.1584139271 0.0331388386 95.3085280 0.000000000
rh_01                0.0005441175 0.0004024202  1.3521128 0.176392590
as.factor(dow)2      0.0356757100 0.0127979429  2.7876128 0.005327293
as.factor(dow)3      0.0388823055 0.0128056733  3.0363343 0.002405504
as.factor(dow)4      0.0107302325 0.0129013816  0.8317119 0.405606249
as.factor(dow)5      0.0243382447 0.0128704711  1.8910143 0.058672841
as.factor(dow)6      0.0277953708 0.0128359850  2.1654256 0.030396240
as.factor(dow)7      0.0275592574 0.0127372874  2.1636677 0.030531063
as.factor(holiday)1  0.0444348611 0.0147218816  3.0182868 0.002553265
Lag(pm1010, 0)      -0.0010816252 0.0042890866 -0.2521808 0.800910389

要么:

temp <- plist[[1]] 
rownames(temp)[nrow(temp)] <- paste0( "cardva_", rownames(temp)[nrow(temp)]  )

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM