# which bandwidth I should choose?

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

when h=1

when h=2

when h=5

## 1 Answer

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.

• 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? Jan 9, 2018 at 3:42
• 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.
– Carl
Jan 9, 2018 at 3:58
• 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. Jan 9, 2018 at 4:17
• 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.
– Carl
Jan 9, 2018 at 4:41
• 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? Jan 10, 2018 at 14:14