# [R] goodness of fit for nonlinear quantile regression

Tue Oct 8 15:36:34 CEST 2013

```Hello,

I am having trouble obtaining AIC or pseudo R^2 for nonlinear quantile
regression fits. I would like to use one of these measures to compare
non-nested models (each with a single, unique predictor variable).

I am trying to fit the following gaussian peak model using the quantreg package:

fit1.nlrq <- nlrq(y ~ a*exp(-((x-b)/c)**2), data=data, start =
list(a=.2,b=25.5,c=1), tau=0.5, trace=T);

(and so on, for multiple tau; I would like a local goodness of fit
measure at each tau, to help compare this model to a similar one that
uses, say, x1 as a predictor instead of x.)

Parameter estimates and predictions for the model looks as expected,
but when I try to use AIC(fit1.nlrq) or AIC.nlrq(fit1.nlrq) I get the
following output

numeric(0)
attr(,"edf")
[1] 0

Similarly, logLik(fit1.nlrq)

yields

'log Lik.'  (df=0)

Can someone advise? (The output for deviance does exist and is a number...)

As an alternative, I could perhaps calculate pseudo R2. I think this
would be [1 - (deviance of fitted model/ deviance of null model)] but
don't know how to obtain the deviance for the relevant null models.
Can someone offer code or advice on this front?

Perhaps someone has a more desirable alternative altogether for
comparing among non-nested, nonlinear, quantile regression models.

I am new to R and to R-help, please advise of posting mistakes or
missing information!

sessionInfo is as follows:

R version 3.0.0 (2013-04-03)
Platform: x86_64-w64-mingw32/x64 (64-bit)

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
[5] LC_TIME=English_United States.1252

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] quantreg_4.98 SparseM_1.02

loaded via a namespace (and not attached):
[1] tools_3.0.0

--