[R] p-values from VGAM function vglm

David Winsemius dwinsemius at comcast.net
Sat Jun 6 01:53:38 CEST 2009


?str

It's a pretty fundamental function for understanding R objects.

 > str(summary(vglm.D93))
Formal class 'summary.vglm' [package "VGAM"] with 43 slots
  ..@ coef3           : num [1:5, 1:3] 3.04 -4.54e-01 -2.93e-01  
1.00e-15 9.33e-16 ...
  .. ..- attr(*, "dimnames")=List of 2
  .. .. ..$ : chr [1:5] "(Intercept)" "outcome2" "outcome3"  
"treatment2" ...
  .. .. ..$ : chr [1:3] "Value" "Std. Error" "t value"
  ..@ cov.unscaled    : num [1:5, 1:5] 0.0292 -0.0159 -0.0159 -0.02  
-0.02 ...
  .. ..- attr(*, "dimnames")=List of 2
  .. .. ..$ : chr [1:5] "(Intercept)" "outcome2" "outcome3"  
"treatment2" ...
  .. .. ..$ : chr [1:5] "(Intercept)" "outcome2" "outcome3"  
"treatment2" ...

<snipped about three pages of further output>



On Jun 5, 2009, at 7:28 PM, Steven Matthew Anderson wrote:

> Thank you for your reply.  Related question ... how do you know the  
> matrix of values in the summary(modl2) was called coef3?  Is there a  
> function for extracting that information?
>
> dt(summary( modl2 )@coef3[ , 3], 1)
>
> Thank you,
>
> Steve
>
>
>
>
>
>
>
> On Jun 5, 2009, at 2:18 PM, David Winsemius wrote:
>
>>
>> On Jun 5, 2009, at 3:15 PM, Steven Matthew Anderson wrote:
>>
>>> Anyone know how to get p-values for the t-values from the  
>>> coefficients produced in vglm?
>>> Attached is the code and output — see comment added to output to  
>>> show where I need p-values
>>>
>>>
>>> +     print(paste("**********   Using VGAM function gamma2  
>>> **********"))
>>> +     modl2<- 
>>> vglm(MidPoint~Count,gamma2,data=modl.subset,trace=TRUE,crit="c")
>>> +     print(coef(modl2,matrix=TRUE))
>>> +     print(summary(modl2))
>>>
>>>
>>> [1] "**********   Using VGAM function gamma2 **********"
>>> VGLM    linear loop  1 :  coefficients =
>>> 0.408464609241,  3.255887520104, -0.000220585671
>>> VGLM    linear loop  2 :  coefficients =
>>> 2.34723239e-01,  1.28969691e+00, -4.52393778e-05
>>> VGLM    linear loop  3 :  coefficients =
>>> 2.19500481e-01,  1.92534895e+00, -3.02160949e-05
>>> VGLM    linear loop  4 :  coefficients =
>>> 2.19383151e-01,  2.26845910e+00, -3.00838664e-05
>>> VGLM    linear loop  5 :  coefficients =
>>> 2.19383045e-01,  2.34645688e+00, -3.00836087e-05
>>> VGLM    linear loop  6 :  coefficients =
>>> 2.19383045e-01,  2.34977070e+00, -3.00836082e-05
>>> VGLM    linear loop  7 :  coefficients =
>>> 2.19383045e-01,  2.34977637e+00, -3.00836082e-05
>>> VGLM    linear loop  8 :  coefficients =
>>> 2.19383045e-01,  2.34977637e+00, -3.00836082e-05
>>>               log(mu) log(shape)
>>> (Intercept)  2.193830e-01   2.349776
>>> Count       -3.008361e-05   0.000000
>>>
>>> Call:
>>> vglm(formula = MidPoint ~ Count, family = gamma2, data =  
>>> modl.subset,
>>> trace = TRUE, crit = "c")
>>>
>>> Pearson Residuals:
>>>            Min       1Q   Median      3Q     Max
>>> log(mu)    -1.7037 -0.82997 0.072275 0.78520 1.72834
>>> log(shape) -2.5152 -0.32448 0.254698 0.58772 0.70678
>>>
>>>
>>> ######### NEED P-VALUES HERE #########
>>
>> Perhaps:
>>
>> dt(summary( modl2 )@coef3[ , 3], 1)
>>
>>
>>>
>>>
>>> Coefficients:
>>>                 Value Std. Error  t value
>>> (Intercept):1  2.1938e-01 5.2679e-02  4.16455
>>> (Intercept):2  2.3498e+00 1.7541e-01 13.39574
>>> Count         -3.0084e-05 8.9484e-05 -0.33619
>>>
>>> Number of linear predictors:  2
>>>
>>> Names of linear predictors: log(mu), log(shape)
>>>
>>> Dispersion Parameter for gamma2 family:   1
>>>
>>> Log-likelihood: -26.39268 on 123 degrees of freedom
>>>
>>> Number of Iterations: 8
>>>
>>>
>>> Steven Matthew Anderson
>>>
>>> Anderson Research, LLC
>>> Statistical Programming and Analysis
>>> SAS (R) Certified Professional
>>> AdAstra69 at mac.com
>> -- 
>> David Winsemius, MD
>> Heritage Laboratories
>> West Hartford, CT
>>
>
> Steven Matthew Anderson
>
> Anderson Research, LLC
> Statistical Programming and Analysis
> SAS (R) Certified Professional
> AdAstra69 at mac.com
>
> Ad Astra per Aspera
>
> שָׁלוֹם
>
>
>
>

David Winsemius, MD
Heritage Laboratories
West Hartford, CT




More information about the R-help mailing list