Show that Kernel density estimate integrates to 1












1












$begingroup$


I'm trying to show that the Kernel density estimate



$$ f(x) = frac1{nb}sum_{i=1}^nK left(frac {X_i - x}bright) $$



actually integrates to 1. The $X_i$ are iid and K is a symmetric probability density function; in particular, K integrates to 1. What I get is



$$int_{-infty}^{infty} frac1{nb}sum_{i=1}^nKleft(frac {X_i - x}bright) dx$$
$$ = frac1{nb}int_{-infty}^{infty} sum_{i=1}^nKleft(frac {X_i - x}bright) dx $$



$$=frac1{nb}sum_{i=1}^nint_{-infty}^{infty} Kleft(frac {X_i - x}bright) dx$$
$$=frac1{b}int_{-infty}^{infty} Kleft(frac {X_i - x}bright) dx$$



Using as a substitution



$$ u = frac {X_i - x}b$$
$$ dx = -b du$$



we get



$$=frac1{b}int_{-infty}^{infty} K(u) (-b) du $$
$$= (-b) frac1{b}int_{-infty}^{infty} K(u) du = -1$$



Something must have gone wrong with the integration. I know that $f(x)$ is often defined differently, as



$$ f'(x) = frac1{nb}sum_{i=1}^nKleft(frac {x - X_i}bright) $$



and with this version I can show that it integrates to 1. However $f'(x)$ and $f(x)$ should be equivalent as $K$ is symmetric. So there is some flaw in my calculations (my knowledge about integration with substitution is purely heuristic).










share|cite|improve this question











$endgroup$

















    1












    $begingroup$


    I'm trying to show that the Kernel density estimate



    $$ f(x) = frac1{nb}sum_{i=1}^nK left(frac {X_i - x}bright) $$



    actually integrates to 1. The $X_i$ are iid and K is a symmetric probability density function; in particular, K integrates to 1. What I get is



    $$int_{-infty}^{infty} frac1{nb}sum_{i=1}^nKleft(frac {X_i - x}bright) dx$$
    $$ = frac1{nb}int_{-infty}^{infty} sum_{i=1}^nKleft(frac {X_i - x}bright) dx $$



    $$=frac1{nb}sum_{i=1}^nint_{-infty}^{infty} Kleft(frac {X_i - x}bright) dx$$
    $$=frac1{b}int_{-infty}^{infty} Kleft(frac {X_i - x}bright) dx$$



    Using as a substitution



    $$ u = frac {X_i - x}b$$
    $$ dx = -b du$$



    we get



    $$=frac1{b}int_{-infty}^{infty} K(u) (-b) du $$
    $$= (-b) frac1{b}int_{-infty}^{infty} K(u) du = -1$$



    Something must have gone wrong with the integration. I know that $f(x)$ is often defined differently, as



    $$ f'(x) = frac1{nb}sum_{i=1}^nKleft(frac {x - X_i}bright) $$



    and with this version I can show that it integrates to 1. However $f'(x)$ and $f(x)$ should be equivalent as $K$ is symmetric. So there is some flaw in my calculations (my knowledge about integration with substitution is purely heuristic).










    share|cite|improve this question











    $endgroup$















      1












      1








      1





      $begingroup$


      I'm trying to show that the Kernel density estimate



      $$ f(x) = frac1{nb}sum_{i=1}^nK left(frac {X_i - x}bright) $$



      actually integrates to 1. The $X_i$ are iid and K is a symmetric probability density function; in particular, K integrates to 1. What I get is



      $$int_{-infty}^{infty} frac1{nb}sum_{i=1}^nKleft(frac {X_i - x}bright) dx$$
      $$ = frac1{nb}int_{-infty}^{infty} sum_{i=1}^nKleft(frac {X_i - x}bright) dx $$



      $$=frac1{nb}sum_{i=1}^nint_{-infty}^{infty} Kleft(frac {X_i - x}bright) dx$$
      $$=frac1{b}int_{-infty}^{infty} Kleft(frac {X_i - x}bright) dx$$



      Using as a substitution



      $$ u = frac {X_i - x}b$$
      $$ dx = -b du$$



      we get



      $$=frac1{b}int_{-infty}^{infty} K(u) (-b) du $$
      $$= (-b) frac1{b}int_{-infty}^{infty} K(u) du = -1$$



      Something must have gone wrong with the integration. I know that $f(x)$ is often defined differently, as



      $$ f'(x) = frac1{nb}sum_{i=1}^nKleft(frac {x - X_i}bright) $$



      and with this version I can show that it integrates to 1. However $f'(x)$ and $f(x)$ should be equivalent as $K$ is symmetric. So there is some flaw in my calculations (my knowledge about integration with substitution is purely heuristic).










      share|cite|improve this question











      $endgroup$




      I'm trying to show that the Kernel density estimate



      $$ f(x) = frac1{nb}sum_{i=1}^nK left(frac {X_i - x}bright) $$



      actually integrates to 1. The $X_i$ are iid and K is a symmetric probability density function; in particular, K integrates to 1. What I get is



      $$int_{-infty}^{infty} frac1{nb}sum_{i=1}^nKleft(frac {X_i - x}bright) dx$$
      $$ = frac1{nb}int_{-infty}^{infty} sum_{i=1}^nKleft(frac {X_i - x}bright) dx $$



      $$=frac1{nb}sum_{i=1}^nint_{-infty}^{infty} Kleft(frac {X_i - x}bright) dx$$
      $$=frac1{b}int_{-infty}^{infty} Kleft(frac {X_i - x}bright) dx$$



      Using as a substitution



      $$ u = frac {X_i - x}b$$
      $$ dx = -b du$$



      we get



      $$=frac1{b}int_{-infty}^{infty} K(u) (-b) du $$
      $$= (-b) frac1{b}int_{-infty}^{infty} K(u) du = -1$$



      Something must have gone wrong with the integration. I know that $f(x)$ is often defined differently, as



      $$ f'(x) = frac1{nb}sum_{i=1}^nKleft(frac {x - X_i}bright) $$



      and with this version I can show that it integrates to 1. However $f'(x)$ and $f(x)$ should be equivalent as $K$ is symmetric. So there is some flaw in my calculations (my knowledge about integration with substitution is purely heuristic).







      integration statistics probability-distributions improper-integrals






      share|cite|improve this question















      share|cite|improve this question













      share|cite|improve this question




      share|cite|improve this question








      edited Jan 9 at 16:28









      Chinnapparaj R

      5,4331928




      5,4331928










      asked Jan 9 at 16:26









      CariieCariie

      133




      133






















          1 Answer
          1






          active

          oldest

          votes


















          0












          $begingroup$

          $require{cancel}$
          begin{align}
          int_{-infty}^{+infty} f(x)~{rm d}x &= frac{1}{nb}sum_{i = 1}^n int_{-infty}^{+infty} Kleft(frac{X_i - x}{b}right){rm d}x & text{with } ~u = frac{X_i - x}{b},~{rm d}u = -{rm d}x/b \
          &= -frac{1}{n}sum_{i=1}^n int_{+infty}^{-infty} K(u)~{rm du} \
          &= frac{1}{n}sum_{i=1}^n cancelto{1}{int_{-infty}^{+infty}K(u){rm d}u} \
          &= frac{1}{cancel{n}} cancel{n} = 1
          end{align}



          The part you need to pay attention to is the limits, when $xto +infty$ you have $u to -infty$ and vice versa. So the limits of the integral change of order






          share|cite|improve this answer









          $endgroup$













            Your Answer





            StackExchange.ifUsing("editor", function () {
            return StackExchange.using("mathjaxEditing", function () {
            StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
            StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
            });
            });
            }, "mathjax-editing");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "69"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            noCode: true, onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3067653%2fshow-that-kernel-density-estimate-integrates-to-1%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0












            $begingroup$

            $require{cancel}$
            begin{align}
            int_{-infty}^{+infty} f(x)~{rm d}x &= frac{1}{nb}sum_{i = 1}^n int_{-infty}^{+infty} Kleft(frac{X_i - x}{b}right){rm d}x & text{with } ~u = frac{X_i - x}{b},~{rm d}u = -{rm d}x/b \
            &= -frac{1}{n}sum_{i=1}^n int_{+infty}^{-infty} K(u)~{rm du} \
            &= frac{1}{n}sum_{i=1}^n cancelto{1}{int_{-infty}^{+infty}K(u){rm d}u} \
            &= frac{1}{cancel{n}} cancel{n} = 1
            end{align}



            The part you need to pay attention to is the limits, when $xto +infty$ you have $u to -infty$ and vice versa. So the limits of the integral change of order






            share|cite|improve this answer









            $endgroup$


















              0












              $begingroup$

              $require{cancel}$
              begin{align}
              int_{-infty}^{+infty} f(x)~{rm d}x &= frac{1}{nb}sum_{i = 1}^n int_{-infty}^{+infty} Kleft(frac{X_i - x}{b}right){rm d}x & text{with } ~u = frac{X_i - x}{b},~{rm d}u = -{rm d}x/b \
              &= -frac{1}{n}sum_{i=1}^n int_{+infty}^{-infty} K(u)~{rm du} \
              &= frac{1}{n}sum_{i=1}^n cancelto{1}{int_{-infty}^{+infty}K(u){rm d}u} \
              &= frac{1}{cancel{n}} cancel{n} = 1
              end{align}



              The part you need to pay attention to is the limits, when $xto +infty$ you have $u to -infty$ and vice versa. So the limits of the integral change of order






              share|cite|improve this answer









              $endgroup$
















                0












                0








                0





                $begingroup$

                $require{cancel}$
                begin{align}
                int_{-infty}^{+infty} f(x)~{rm d}x &= frac{1}{nb}sum_{i = 1}^n int_{-infty}^{+infty} Kleft(frac{X_i - x}{b}right){rm d}x & text{with } ~u = frac{X_i - x}{b},~{rm d}u = -{rm d}x/b \
                &= -frac{1}{n}sum_{i=1}^n int_{+infty}^{-infty} K(u)~{rm du} \
                &= frac{1}{n}sum_{i=1}^n cancelto{1}{int_{-infty}^{+infty}K(u){rm d}u} \
                &= frac{1}{cancel{n}} cancel{n} = 1
                end{align}



                The part you need to pay attention to is the limits, when $xto +infty$ you have $u to -infty$ and vice versa. So the limits of the integral change of order






                share|cite|improve this answer









                $endgroup$



                $require{cancel}$
                begin{align}
                int_{-infty}^{+infty} f(x)~{rm d}x &= frac{1}{nb}sum_{i = 1}^n int_{-infty}^{+infty} Kleft(frac{X_i - x}{b}right){rm d}x & text{with } ~u = frac{X_i - x}{b},~{rm d}u = -{rm d}x/b \
                &= -frac{1}{n}sum_{i=1}^n int_{+infty}^{-infty} K(u)~{rm du} \
                &= frac{1}{n}sum_{i=1}^n cancelto{1}{int_{-infty}^{+infty}K(u){rm d}u} \
                &= frac{1}{cancel{n}} cancel{n} = 1
                end{align}



                The part you need to pay attention to is the limits, when $xto +infty$ you have $u to -infty$ and vice versa. So the limits of the integral change of order







                share|cite|improve this answer












                share|cite|improve this answer



                share|cite|improve this answer










                answered Jan 9 at 16:37









                caveraccaverac

                14.5k31130




                14.5k31130






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Mathematics Stack Exchange!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    Use MathJax to format equations. MathJax reference.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3067653%2fshow-that-kernel-density-estimate-integrates-to-1%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    'app-layout' is not a known element: how to share Component with different Modules

                    android studio warns about leanback feature tag usage required on manifest while using Unity exported app?

                    WPF add header to Image with URL pettitions [duplicate]