bugGNU Octave - Bugs: bug #39280, Wrong results of empirical_pdf

 
 

bug #39280: Wrong results of empirical_pdf

Submitter:  None
Submitted:  Wed 19 Jun 2013 06:35:21 AM UTC
   
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Fixed Assigned to:  None
Originator Name:  Lutz Kelch Originator Email:  -email is unavailable-
Open/Closed:  * Closed Release:  * 3.6.4
Operating System:  * Microsoft Windows Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Mon 09 Nov 2015 10:56:32 PM UTC, comment #6: 

This bug is a duplicate of #41008 which has been fixed.  Closing report.

Rik <rik5>
Group administrator
Thu 20 Jun 2013 01:08:55 PM UTC, comment #5: 

You are right if you assume that the documentation
about the the arguments is correct.

But, it appears that both the documentation and the function
are incorrect. Both empirical_pdf and discrete_PDF
need checking. Their current tests are incomplete.

Michael Godfrey <godfrey>
Group Member
Thu 20 Jun 2013 12:47:53 PM UTC, comment #4: 

but in sum(empirical_pdf([1 2 3], [1 2 2 3])) all values are specified, but the result is just 0.75

Lutz Kelch <luke15153>
Thu 20 Jun 2013 12:44:02 PM UTC, comment #3: 

The documentation for empirical_pdf says that
it computes the PDF value at the specified points.
This would only sum to 1 if all possible values were
specified.

Michael Godfrey <godfrey>
Group Member
Thu 20 Jun 2013 06:24:00 AM UTC, comment #2: 

in my opinion the result is wrong.

Usually the sum resp. integral over all pdf values should be (about) one. For the normal distribution it works, sum(normpdf([-5:5],0,1)) is 1.
But  sum(empirical_pdf([1 2 3], [1 2 2 3])) gives 0.75, what is wrong in my opinion.

Lutz Kelch <luke15153>
Wed 19 Jun 2013 05:22:54 PM UTC, comment #1: 

empirical_pdf is given as:

function pdf = empirical_pdf (x, data)

  if (nargin != 2)
    print_usage ();
  endif

  if (! isvector (data))
    error ("empirical_pdf: DATA must be a vector");
  endif

  pdf = discrete_pdf (x, data, ones (size (data)));

endfunction

It is appears that the documentation is incorrect.

Michael Godfrey <godfrey>
Group Member
Wed 19 Jun 2013 06:35:21 AM UTC, original submission:  

empirical_pdf should give the probability distribution of empirical data.

A call to empirical_pdf([1 2 3], [1 2 2 3]) gives (0.25 0.25 0.25), but in my opinion it should by (0.25, 0.5 0.25).

The value for '2' should be 0.5 as half of the given data are '2'.

Regards,

Lutz

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by luke15153 (Posted a comment)
  • -email is unavailable- added by godfrey (Posted a comment)
  • -email is unavailable- added by None (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2015-11-09 rik5 CategoryOctave Package Octave Function
        StatusNone Fixed
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code