Cross Validated is a question and answer site for people interested in statistics, machine learning, data analysis, data mining, and data visualization. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am interested to know, how to get the coefficient from VGAM package (generalized Poisson regression), because, when I want to get the coefficient, is just can to get the estimate with @ to get the estimate. An other coefficient can to get all of the part from coefficient with "$"...

My program like this:

fit <- vglm(y ~ x1, genpoisson,trace = TRUE)  
hasilgp <- summary(fit)  
koefgp <- hasilgp@coefficients  

And only the estimate can to attach... Any one help me...

share|improve this question

closed as off-topic by gung, Gavin Simpson, Glen_b, Nick Cox, Gala Jul 24 '13 at 7:32

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions about programming are off-topic here unless they involve statistical analysis in some fashion, but they can be asked on Stack Overflow." – Gavin Simpson, Nick Cox, Gala
If this question can be reworded to fit the rules in the help center, please edit the question.

There are so many errors in the English that it is difficult to determine what the question is. Any chance you can fix the grammatical mistakes? – whuber Jul 24 '13 at 2:34
I suspect this is actually an R question about the difference between working with S3 classes (that are accessed via $) & S4 classes (that are accessed via @). If you can improve the English, we can migrate this question to Stack Overflow for you. – gung Jul 24 '13 at 2:40
@gung is more than likely spot on, but the solution is probably not to delve into objects and rip out whatever you feel but to learn to use extractor functions, in this case coefficients() or its shorter alias coef(), as in coef(fit) – Gavin Simpson Jul 24 '13 at 2:45

You can ignore the differences if you use extractor functions rather than delve into model objects and take what you want. In this case, the correct extractor functions is coefficients() or its shorter alias coef(). This function has methods for a great number of model objects in R, written by the respective package authors so you don't have to wonder how to access aspects of the fit.

In this case try


The distinction between accessing via @ and $ is, as @gung mentions, due to the use of S4 class objects in the VGAM package. Those objects have slots and the accessor function is @. $ is used to access the components/elements of a list or data frame. S3 methods tend to return list objects describing the fit and hence you'll see people accessing those components with $.

In general, however, it is best to use extractor functions where available, e.g. coef(), fitted(), predict(), ....

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.