STATA นำเข้าข้อมูล โดย Copy จาก Excel และทดลองใช้คำสั่ง Scatter Plot


STATA นำเข้าข้อมูล โดย Copy จาก Excel และทดลองใช้คำสั่ง Scatter Plot

STATA นำเข้าข้อมูล โดย Copy จาก Excel

ตาราง Excel เช่น Mumps, Measles, Rubella

ลองกำหนดให้ Mumps และ Measles ไม่เป็นอิสระต่อกัน
คือมี Correlation แบบ Positive (R มีค่าเป็นบวก)

ถ้า Mumps มีค่ามาก Measles ก็จะมีค่ามาก 

ถ้า Mumps มีค่าน้อย Measles ก็จะมีค่าน้อย 

กำหนดให้ Measles มีค่าประมาณ 2 เท่าของ Mumps บวกลบได้นิดหน่อย

และกำหนดให้ Rubella เป็นตัวแปรมีค่ามากหรือน้อยแบบเป็นอิสระ
โดยไม่มี Correlation ไม่เกี่ยวข้องกันกับ Mumps และ Measles (R มีค่าเป็น 0)

 

  • Start  Excel enter data
  • At cell A1 Rt Mouse Click and drag, Highlight the data, 
  • Select menu Edit and click Copy (or Control+C).
  • Start Stata and open the Data Editor by Menu or type edit at the Stata dot prompt.
  • Paste data into editor by selecting Edit and clicking Paste (or Control+V).

  • Data Editor

    กดปุ่ม Preserve

    และปิดหน้าต่าง Data Editor โดย Click [X]  ปิด ที่มุมบนขวา

    ทดลองใช้คำสั่ง

    .list 

     

     

    ทดลองใช้คำสั่ง

    .graph twoway scatter mumps measles

     

    เนืองจากกำหนดไว้แต่แรกว่า Measles มีค่าประมาณ 2 เท่าของ Mumps บวกลบได้นิดหน่อย
    จะเห็นว่า Mumps และ Measles มี Correlation สามารถลากเส้นตรงได้
    ถ้าทำ Regression จะได้สมการ Y = aX + b

     

     

    ทดลองใช้คำสั่ง

    .graph twoway scatter mumps rubella

     

    เนืองจากกำหนดให้ Rubella มีค่าเป็นอิสระ ไม่มี Associationกับ Mumps
    จะเห็นว่า Mumps และ Rubella กระจายกันไปทั่ว ไม่มี Correlation
    Correlation Coefficiency หรือ R = 0


    บทความเกี่ยวข้องกับ STATA
     
    STATA 10 Command for  Cohort,
    Case Control (unmatched matched),
    Cross Sectional Study
    สร้าง: พฤ. 11 มิ.ย. 2552
    Link to: http://gotoknow.org/blog/epistat/267326

    STATA 10 Meta analysis
    สร้าง: พฤ. 11 มิ.ย. 2552
    Link to: http://gotoknow.org/blog/epistat/267323

    Blog Epistat
    Link to: http://gotoknow.org/blog/epistat

    Blog General Practice
    Link to: http://gotoknow.org/blog/nopadol

    คำสำคัญ (Tags): #scater mumps measles
    หมายเลขบันทึก: 382103เขียนเมื่อ 5 สิงหาคม 2010 20:43 น. ()แก้ไขเมื่อ 6 กันยายน 2013 23:19 น. ()สัญญาอนุญาต: ครีเอทีฟคอมมอนส์แบบ แสดงที่มา-ไม่ใช้เพื่อการค้า-อนุญาตแบบเดียวกันจำนวนที่อ่านจำนวนที่อ่าน:


    ความเห็น (0)

    ไม่มีความเห็น

    พบปัญหาการใช้งานกรุณาแจ้ง LINE ID @gotoknow
    ClassStart
    ระบบจัดการการเรียนการสอนผ่านอินเทอร์เน็ต
    ทั้งเว็บทั้งแอปใช้งานฟรี
    ClassStart Books
    โครงการหนังสือจากคลาสสตาร์ท