Data Distribution

Data Distribution

ข่าวและบทความที่เกี่ยวข้อง

All Data Distribution

PostType Filter En

บทความ

เตรียมข้อมูลอย่างไรให้โมเดล Linear Regression ดีขึ้น
เราจะเตรียมข้อมูลด้วยการตรวจสอบทั้ง 4 วิธี ได้แก่ ความเป็นเชิงเส้น,การแจกแจง,ความแปรปรวน และความเป็นอิสระต่อกัน
10 October 2022

บทความ

4 เหตุผลที่จะทำให้คุณตกหลุมรัก Box Plot
ในบทความนี้ ผมจะมาพาผู้อ่านทุกท่านทำความรู้จักกับ Box Plot แผนภาพอันทรงพลังที่ใช้ในการวิเคราะห์การกระจายตัวของข้อมูล บอกได้เลยว่าสามารถใช้วิเคราะห์ได้ดีไม่แพ้ Histogram เลยครับ! การวิเคราะห์การกระจายตัวของข้อมูล คำถามที่เกี่ยวข้องกับการวิเคราะห์การกระจายตัวของข้อมูล มีอยู่ในชีวิตประจำวันของเราทุกคน ยกตัวอย่างเช่น ซึ่งหลาย ๆ คน จะคุ้นเคยกับการตอบคำถามด้านบนด้วย Histogram ซึ่งก็ถือว่าเป็นตัวเลือก “คลาสสิก” เพราะทุกคนจะเคยเรียนรู้สิ่งนี้มาก่อนในวิชาคณิตศาสตร์ โดย Histogram เป็นการนำข้อมูลเชิงปริมาณ (Numerical Data) มา “นับจำนวนครั้ง” ที่พบค่าของข้อมูล ตามช่วงข้อมูลหรืออันตรภาคชั้น (Bins) และเมื่อเราสร้าง Histogram แล้ว เราสามารถตอบคำถามด้านบนได้หลากหลาย เช่น บทความนี้จะขอนำเสนอ 4 เหตุผลที่จะทำให้ผู้อ่านตกหลุมรัก Box Plot โดยจะมีการอธิบายรายละเอียดวิธีการทำงานของ Box Plot ภายในเนื้อหาด้วย เริ่มต้นที่เหตุผลข้อที่หนึ่งในส่วนถัดไปกันเลยครับ ? เหตุผลข้อ 1: Box Plot ประหยัดพื้นที่ ในยุคดิจิทัลทุกวันนี้ Business Intelligence, Visual Analytics, และ Data Visualization ได้เข้ามามีบทบาทในองค์กรต่าง ๆ ทั้งเรื่องการบริหารจัดการ การดูสถานะ การวางแผน และการตัดสินใจ ทำให้พื้นที่บนหน้าจออุปกรณ์พกพาต่าง ๆ ของเรากลายเป็น Real Estate ยุคใหม่ แน่นอนว่า การนำเสนอข้อมูลอะไรที่ใช้เนื้อที่เยอะเกินไป ดูจะไม่ค่อยคุ้มเสียแล้ว ซึ่งในการแสดงข้อมูลชุดเดียวกัน Box Plot สามารถย่อส่วนพื้นที่ที่จำเป็นต่อการแสดงข้อมูลจากแผนภาพสองมิติ (2D) เหลือเพียงมิติเดียว (1D) ทำให้เป็นแผนภาพที่เหมาะกับยุคดิจิทัลที่พื้นที่บนหน้าจอของเรามีจำกัด แต่ Box Plot ที่ถูกย่อส่วนลงมาแล้ว จะยังตอบคำถามหลาย ๆ คำถามได้เหมือน Histogram หรือไม่? เรามาดูเหตุผลข้อถัดไปกันครับ เหตุผลข้อ 2: Box Plot อัดแน่นไปด้วยข้อมูล แผนภาพ Box Plot ได้ชดเชยขนาดที่เล็ก ด้วยหลักการวาดส่วนสำคัญต่าง ๆ ของกล่องด้วยปริมาณที่สำคัญทางสถิติ ทำให้ Box Plot ยังคงให้ข้อมูลและข้อสังเกตได้หลากหลายประการ แต่ก่อนอื่นเราลองมาทำความรู้จักกับส่วนประกอบต่าง ๆ ของ Box Plot กันก่อนครับ Box Plot ประกอบไปด้วยส่วนของ “กล่อง” (Box) กับส่วนของ “หนวด” (Whiskers) และมีจุด ๆ แสดงข้อมูลจริง​ โดยอาจอยู่ได้ทั้งในและนอกหนวด (บางครั้งเราจะเห็นบางเวอร์ชันของแผนภาพที่โชว์จุดข้อมูลนอก Whiskers อย่างเดียว ก็ยังนับเป็น Box Plot อยู่) ซึ่งตำแหน่งของ Box และ Whiskers ถูกสร้างขึ้นมาได้ โดยตัวเลขทางสถิติทั้งหมดถึง 5 ตัวด้วยกัน เรียกรวมกันว่า The Five-Number Summary ประกอบไปด้วย: เพื่อยกตัวอย่างให้เห็นภาพ สมมติว่าเรานำข้อมูลอายุขัยของประชากรเพศชาย (Life Expectancy for Males) มาวางเรียงกัน จากน้อยไปหามาก แล้วหาค่าตามหลัก The Five-Number Summary แล้วคำนวณได้ว่า ค่าเหล่านี้ถูกนำไปใช้ทำจุดสำคัญต่าง ๆ บน Box Plot เป็นกล่องและหนวดนั่นเอง ดังภาพด้านล่าง ซึ่งมีข้อสังเกตว่า หากเราลองมาใช้ตัวเลข 5 ตัวนี้ แปลผล Box Plot เบื้องต้นกัน เราจะได้ข้อสังเกตหลาย ๆ อย่างได้ไม่ด้อยไปกว่า (หรือในบางมิติ เหนือกว่า) Histogram เช่น ท่านที่ช่างสังเกตจะพบว่ามีตำแหน่งสำคัญที่ผมยังไม่ได้อธิบายใน Box Plot คือตัวเลข 44 บนหนวด Whisker ข้างซ้าย และสิ่งที่น่าสงสัยอีกประการหนึ่งคือ เหตุใดค่า 80 ที่เป็น Maximum จึงไปอยู่บนปลายหนวดข้างขวาพอดี? เป็นความบังเอิญหรือไม่? ข้อสังเกต เหล่านี้สามารถถูกอธิบายได้ว่า จริง ๆ แล้ว จาก Five-Number Summary เราจะต้องมีการคำนวณปริมาณทางสถิติเพิ่มบางประการ กล่าวคือ: เราเอาค่า IQR มาคำนวณค่า​ปลายหนวดทั้งสองข้าง ดังนี้: เสมือนว่าเป็นการ “ขยาย” ตัวกล่องออกไปด้านข้างด้วยความกว้าง 1.5 เท่าของกล่อง แต่ขยายไม่เกินข้อมูลสูงสุดหรือข้อมูลต่ำสุดที่มีอยู่จริง ซึ่งกฎ 1.5 * IQR ได้รับการยอมรับอย่างแพร่หลาย โดยนิยามข้อมูลที่อยู่นอกช่วง [Q1 – 1.5 * IQR, Q3 + 1.5 * IQR] ได้ว่าเป็น ค่าสุดโต่ง หรือ Outliers (คือค่าเหล่านี้ นับว่าหายากมาก ๆ) ยกตัวอย่างเช่น ถ้าข้อมูลมีการกระจายตัวแบบปกติ (Normal Distribution) ข้อมูลที่อยู่นอกช่วง Lower Whisker และ Upper Whisker จะมีเพียง 0.7% เท่านั้น จึงถูกจัดเป็น Outliers เราจะเห็นได้ว่าแผนภาพ Box Plot ถึงแม้จะมีขนาดเล็กมากเมื่อเทียบกับ Histogram แต่ให้ข้อมูลและข้อสังเกตได้น่าสนใจหลายประการ ไม่ว่าจะเป็นลักษณะการกระจายตัว เช่น ข้อมูลเบ้ซ้ายหรือเบ้ขวา, ค่ากลางของข้อมูล, ช่วงของข้อมูลส่วนใหญ่, ช่วงของข้อมูลเกือบทั้งหมด, และค่าสุดโต่ง ซึ่งข้อสังเกตหลายข้ออาจสังเกตได้ง่ายกว่า Histogram ไม่ว่าจะเป็นค่ากลางมัธยฐาน, ค่าสุดโต่ง, ช่วงของข้อมูลส่วนใหญ่ เพราะมีตำแหน่งสำคัญต่าง ๆ ที่ถูกคำนวณและถูกกำกับอยู่ในแผนภาพอย่างชัดเจน หากท่านผู้อ่านได้อ่านมาถึงจุดนี้แล้วเริ่มรู้สึกหลงรัก Box Plot ผมขอเสนอเหตุผลอีกสองข้อที่จะทำให้ Box Plot น่าใช้งานมากขึ้นไปอีก เรามาดูข้อถัดไปกันเลยครับ เหตุผลข้อ 3: Box Plot ยืดหยุ่นในการนำเสนอ เนื่องจาก Box Plot เป็นแผนภาพ 1D ทำให้มีความยืดหยุ่นและสามารถถูกนำเสนอในรูปแบบแนวนอนหรือแนวตั้งก็ได้ ผมได้แสดงตัวอย่าง Box Plot ในแนวนอนด้านบนแล้ว เรามาดูตัวอย่างการนำเสนอ Box Plot ในแนวตั้ง ซึ่งผมจะนำเสนอพร้อมกับเหตุผลข้อสุดท้ายครับ...
7 September 2022
PDPA Icon

We use cookies to optimize your browsing experience and improve our website’s performance. Learn more at our Privacy Policy and adjust your cookie settings at Settings

Privacy Preferences

You can choose your cookie settings by turning on/off each type of cookie as needed, except for necessary cookies.

Accept all
Manage Consent Preferences
  • Strictly Necessary Cookies
    Always Active

    This type of cookie is essential for providing services on the website of the Personal Data Protection Committee Office, allowing you to access various parts of the site. It also helps remember information you have previously provided through the website. Disabling this type of cookie will result in your inability to use key services of the Personal Data Protection Committee Office that require cookies to function.
    Cookies Details

  • Performance Cookies

    This type of cookie helps the Big Data Institute (Public Organization) understand user interactions with its website services, including which pages or areas of the site are most popular, as well as analyze other related data. The Big Data Institute (Public Organization) also uses this information to improve website performance and gain a better understanding of user behavior. Although the data collected by these cookies is non-identifiable and used solely for statistical analysis, disabling them will prevent the Big Data Institute (Public Organization) from knowing the number of website visitors and from evaluating the quality of its services.

  • Functional Cookies

    This type of cookie enables the Big Data Institute (Public Organization)’s website to remember the choices you have made and deliver enhanced features and content tailored to your usage. For example, it can remember your username or changes you have made to font sizes or other customizable settings on the page. Disabling these cookies may result in the website not functioning properly.

  • Targeting Cookies

    "This type of cookie helps the Big Data Institute (Public Organization) understand user interactions with its website services, including which pages or areas of the site are most popular, as well as analyze other related data. The Big Data Institute (Public Organization) also uses this information to improve website performance and gain a better understanding of user behavior. Although the data collected by these cookies is non-identifiable and used solely for statistical analysis, disabling them will prevent the Big Data Institute (Public Organization) from knowing the number of website visitors and from evaluating the quality of its services.

Save settings
This site is registered on wpml.org as a development site. Switch to a production site key to remove this banner.