I applied local polynomial quantile regression to calculate the quantile curve at 0.025,0.25,0.5,0.75,0.975 percentiles. I tried to find the appropriate bandwidth by Visual inspection by I found this way very difficult to find the best bandwidth. How I should know that which bandwidth I should use. Also, I search a lot but I could not find any function in R to calculate the optimal value for bandwidth.Any advice?

when h=0.65 enter image description here

when h=1 enter image description here

when h=2 enter image description here

when h=5 enter image description here


1 Answer 1


Before that, take the logarithm of age and the square root of age and try those and other transforms on the x-axis. More exhaustively try lots more transforms on the x and y axes. When you find something linear, us that. Then if you want to smooth it, go ahead.

  • $\begingroup$ thanks for the comment. Do I need to check linearity (between x and y) before applying the local polynomial quantile regression? I didnot know that I need to check the linearity and using box-cox transformation before applying the (lpqr) function. Could you please provide me more information? It means that when the relationship between x and y is not linear I need to use nonlinear smoothing? $\endgroup$
    – shosho
    Jan 9, 2018 at 3:42
  • $\begingroup$ You do not have to check anything. However, if you wish to find a relationship between x and y that makes sense, the first step is to transform the data. Subsequent to that, the amount of smoothing performed may be less important than it would otherwise be, and in addition, the result of smoothing can then be compared to regression(s) results. $\endgroup$
    – Carl
    Jan 9, 2018 at 3:58
  • $\begingroup$ thanks for the comment. its means, I should transform the variables (for example Boxcox transformation) and then try to calculate the quantile curves? Please correct me if I am wrong. I am working on a project to calculate the age-specific reference curves for different variables and people are more interested to see the results based on original scales. I used dpill function to calculate the best bandwidth which is 0.65 but now I am confused now which plot I should choose. $\endgroup$
    – shosho
    Jan 9, 2018 at 4:17
  • $\begingroup$ You can get your curves from the transformed data and display it on the original scale. Alternatively, you can show the original numbers on the new scales. The best bandwidth is noisy because you are not finding a smooth model to explain the data, in fact, you are not explaining it, just repackaging it. $\endgroup$
    – Carl
    Jan 9, 2018 at 4:41
  • $\begingroup$ sure, I will take your advice, But based on my understanding the spline smoothing methods and polynomial methods can be used to transform and model nonlinearities. If I could make a relationship between two variables linear by using box-cox transformation then what would be the benefit of using smoothing techniques? $\endgroup$
    – shosho
    Jan 10, 2018 at 14:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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