2017-02-15 33 views
1

在R模型疏浚方法期間,是否有辦法保留最佳模型,例如,在最佳擬合模型的兩個Alkaike信息準則(AIC)單元內?我使用的是glmulti包,它返回最佳模型的AIC,但不允許可視化與這些值關聯的模型。在R模型疏浚期間保留了幾個最佳模型

在此先感謝。

這是我的例子(數據here):

results <- read.csv("gameresults.csv") 
require(glmulti) 
M <- glmulti(result~speed*svl*tailsize*strategy, 
      data=results, name = "glmulti.analysis", 
      intercept = TRUE, marginality = FALSE, 
      level = 2, minsize = 0, maxsize = -1, minK = 0, maxK = -1, 
      fitfunction = Multinom, method = "h", crit = "aic", 
      confsetsize = 100,includeobjects=TRUE) 

summary(M) 
+0

你有你已經嘗試過的例子嗎? –

+0

當然,它是。 –

回答

0

glmulti::glmulti返回可以像列表訪問的S4類對象的功能。您可以訪問所有模型,而不僅僅是最好的模型。由於我沒有你的函數和一些其他的可選輸入,我進行了模型的簡化版本只是作爲一個示範:

results <- read.csv("gameresults.csv") 
library(glmulti) 
M <- glmulti(result~speed*svl*strategy, data=results, crit = "aic", plotty = TRUE) 

enter image description here 這裏是所有車型,由@操作訪問列表:

[email protected] 
# [[1]] 
# result ~ 1 + speed + svl:speed + strategy:speed 
# <environment: 0x11a616750> 
# 
# [[2]] 
# result ~ 1 + speed + svl + svl:speed + strategy:speed 
# <environment: 0x11a616750> 
# 
# [[3]] 
# result ~ 1 + strategy + speed + svl:speed + strategy:speed 
# <environment: 0x11a616750> 
# 
## **I omitted the remaining 36-3=33 models** 

您可以繪製它們分別基於公式,使用支持使用模型公式的base圖形或任何軟件包。例如,我隨機選擇一個從列表:

plot(result ~ 1 + speed + svl, data=results) 
## Hit <Return> to see next plot: 
## Hit <Return> to see next plot: 

enter image description here

+0

非常感謝,但問題依然存在,對於我來說,用最低的AIC過濾模型並不是很清楚。在這個巨大的S4對象中有很多「AIC」插槽,即使我知道通向其中的路徑,我甚至不知道如何使用這些AIC值來解決我的原始問題。 –