I am using the "rqpd" package to run the following panel data of quantile regression in R:

cre.form1 <- dbirwt ~ smoke + dmage + agesq + novisit + pretri2 + 
pretri3 | momid3 |smoke
crem.fit1 <- rqpd(cre.form1, panel(method="cre", taus <- c(0.9)),data=bwd)

the rqpd package form here

I can get the result via


However, I would like to know the Pseudo R2 (goodness of fit) - which the summary command seems to deliver for OLS regressions, but not in case of panel data in quantile regressions. Does anybody know, how to extract the Pseudo R2?

1 Answers

Stephan On

I don't know the rqpd package. In General the pR^2 is:

1 - deviance/null.deviance

I am using a the standard logistic regression example:

utils::data(anorexia, package = "MASS")
anorex.1 <- glm(Postwt ~ Prewt + Treat + offset(Prewt),
                family = gaussian, data = anorexia)

When I calculate the pR^2, I am using:

anorex.1 %>% glance() %>%
  mutate(pR2 = 1 - deviance/null.deviance)

Output would be:

# A tibble: 1 x 8
  null.deviance df.null logLik   AIC   BIC deviance df.residual   pR2
          <dbl>   <int>  <dbl> <dbl> <dbl>    <dbl>       <int> <dbl>
1         4525.      71  -240.  490.  501.    3311.          68 0.268

pR^2 would be 0.268. Hope that helps.