1
The mode is the most common number that appears in your set of data. To find the mode count how often each number appears and the number that appears the most times is the mode.https://www.ncl.ac.uk/webtemplate/ask-assets/external/maths-resources/statistics/descriptive-statistics/mean-median-and-mode.html#:~:text=Mode-,Definition,most%20times%20is%20the%20mode.
Mode: The most frequent number—that is, the number that occurs the highest number of times.https://www.khanacademy.org/math/statistics-probability/summarizing-quantitative-data/mean-median-basics/a/mean-median-and-mode-review
;; Count Items - Lee Mac ;
;; Returns a list of dotted pairs detailing the number of ;
;; occurrences of each item in a supplied list. ;
(defun CountItems ( l / x c )
(if (setq x (car l))
(progn
(setq c (length l)
l (vl-remove x (cdr l))
)
(cons (cons x (- c (length l))) (CountItems l))
)
)
)
(defun mode (l)
(setq l (vl-sort (countitems l) '(lambda (a b) (> (cdr a) (cdr b)))))
)
_$ (mode '(1 2 3 3 3 3 4 5 6 6 7 8 8 8 8))
((3 . 4) (8 . 4) (6 . 2) (1 . 1) (2 . 1) (4 . 1) (5 . 1) (7 . 1))
I think I must be missing something here, here is the code I have:Code - C#: [Select]
activeDoc.SendStringToExecute("_.qsave\n", false, false, false);
Sorry, no time to look at code but what happens in the following situation?My most recent post will return 11. My understanding is that the mode would be undefined for your data set because there is not a single number with the highest count in the data set.
11, 11, 33, 33, 54
Should be: (11, 33)