I'm a non-statistician trying to do a nonparametric kernel regression (1 input variable, 1 output variable) using Python, with the purpose of using it for prediction. My samples have weights, but I did not find any Python packages that support kernel regression with sample weights.

Being the naive person that I am, I'm thinking that maybe I can fake/approximate the weights by repeating each input sample many times (equal to its sample weight rounded to the nearest integer). Is that valid? Would that work? If some things will work correctly (e.g. using the result to predict mean) but other things will break (e.g. using the result to predict variance), please let me know which things will work with this naive plan.

I'm not a statistician, so mathematical/theoretical answers will probably not be understood by me. I'm hoping to get some simple answer so I can make a decision of whether to follow through with this naive plan or not. Thanks.


Yes that will work to give you an answer, but it will not help with any confidence intervals.

FYI, I am searching for an R package to do this (I would rather not alter some code if it already exists) and I did just what you said to get a rough feel for the answer before I did the work to do it correctly.

  • $\begingroup$ I think this is probably intended as a comment on the question rather than an answer in its own right. Have a look at our tour as it helps explain the distinction - our Q&A format may be very different to other internet forums you are used to. Once you have sufficient reputation you will be able to post comments on any post. $\endgroup$ – Silverfish Sep 21 '16 at 19:56
  • $\begingroup$ I think it's a fine answer but it merely reaffirms something the OP suspects. It would be much more useful if it included reasons for why the proposed ad hoc weighting method would work. $\endgroup$ – whuber Sep 21 '16 at 20:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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