2012-04-08 2 views
0

나는 비례 데이터에 부풀린 베타 회귀 모델을 맞추려고합니다. 패키지 gamlss을 사용하고 BEINF 패밀리를 지정합니다. 나는 $mu.coefficients의 p- 값을 어떻게 추출 할 수 있는지 궁금합니다. 내 코드 하단에 표시된 fit.3$mu.coefficients 명령을 입력하면 Mu 계수 추정치 만 나타납니다. 다음은 내 데이터의 예입니다.gamlss의 mu 매개 변수의 p- 값

mydata = data.frame(y = c(0.014931087, 0.003880983, 0.006048048, 0.014931087, 
+   0.016469269, 0.013111447, 0.012715517, 0.007981377), index = c(1,1,2,2,3,3,4,4)) 

mydata 
     y  index 
1 0.004517611  1 
2 0.004351405  1 
3 0.007952064  2 
4 0.004517611  2 
5 0.003434018  3 
6 0.003602046  4 
7 0.002370690  4 
8 0.002993016  4 

> library(gamlss) 
> fit.3 = gamlss(y ~ factor(index), family = BEINF, data = mydata) 
> summary(fit.3) 

******************************************************************* 
Family: c("BEINF", "Beta Inflated") 

Call: 
gamlss(formula = y ~ factor(index), family = BEINF, data = mydata) 


Fitting method: RS() 

------------------------------------------------------------------- 
Mu link function: logit 
Mu Coefficients: 

       Estimate Std. Error t value Pr(>|t|) 
(Intercept)  -5.3994  0.1204 -44.858 1.477e-06 
factor(index)2 0.2995  0.1591 1.883 1.329e-01 
factor(index)3 -0.2288  0.1805 -1.267 2.739e-01 
factor(index)4 -0.5017  0.1952 -2.570 6.197e-02 

------------------------------------------------------------------- 
Sigma link function: logit 
Sigma Coefficients: 
      Estimate Std. Error t value Pr(>|t|) 
(Intercept) -4.456  0.2514 -17.72 4.492e-07 
------------------------------------------------------------------- 
Nu link function: log 
Nu Coefficients: 
      Estimate Std. Error t value Pr(>|t|) 
(Intercept) -21.54  10194 -0.002113 0.9984 

------------------------------------------------------------------- 
Tau link function: log 
Tau Coefficients: 
      Estimate Std. Error t value Pr(>|t|) 
(Intercept) -21.63  10666 -0.002028 0.9984 

------------------------------------------------------------------- 
No. of observations in the fit: 8 
Degrees of Freedom for the fit: 7 
     Residual Deg. of Freedom: 1 
         at cycle: 12 

Global Deviance:  -93.08548 
      AIC:  -79.08548 
      SBC:  -78.52938 
******************************************************************* 

fit.3$mu.coefficients 
    (Intercept) factor(index)2 factor(index)3 factor(index)4 
    -5.3994238  0.2994738  -0.2287571  -0.5016511 

정말 감사드립니다.

+2

위 모델에 대한이 같은 summary.gamlss에 저장 옵션을 사용하지만이 코드와 혼합 결과를 표시하려면 가장 쉬운 방법은 해당 함수 을 변경하여 계산 대상을 반환하는 것입니다. –

답변

1

계산이 gamlss ::: summary.gamlss`, `에

fit.3 = gamlss(y ~ factor(index), family = BEINF, data = mydata)  
sfit.3<-summary(fit.3, save=TRUE) 
sfit.3$mu.coef.table 
sfit.3$sigma.coef.table 
#to get a list of all the slots in the object 
str(sfit.3) 
0
fit.3 = gamlss(y ~ factor(index), family = BEINF, data = mydata.ex)  
sfit.3<-summary(fit.3, save=TRUE) 
fit.3$mu.coefficients 
sfit.3$coef.table # Here use Brackets [] 
estimate.pval<-data.frame(Intercept=sfit.3$coef.table[1,1],pvalue=sfit.3$coef.table[1,4], 
          "factor(index)^2"=sfit.3$coef.table[2,1] ,pvalue=sfit.3$coef.table[2,4], 
          "factor(index)^3"=sfit.3$coef.table[3,1] ,pvalue=sfit.3$coef.table[3,4], 
         "factor(index)^4"=sfit.3$coef.table[4,1] ,pvalue=sfit.3$coef.table[4,4])