2008年11月1日 星期六

迴歸(Regression)

重拾統計, 真是令人緬懷當年學生生活.

就從迴歸作起吧.


  1. 載入測試資料, 也可以自己輸入
    > load("j:/r/programs/testdata/usingr.rdata")
  2. 使用 moths 變數, 先輸入moths, 查看資料
  3. 以moths$meters 為應變數, moths$A、moths$P 為自變數
    > lm(moths$meters ~ moths$A+moths$P)
  4. 得到簡單迴歸的截距(Interception)及斜率(Slope)
    Coefficients:(Intercept) moths$A moths$P
    45.1017 0.3712 -0.6005

沒有留言: