Aggregate linear regression

前端 未结 3 1258
逝去的感伤
逝去的感伤 2021-01-21 01:14

Sorry I am quite new to R, but I have a dataframe with gamelogs for multiple players. I am trying to get the slope coefficient for each player\'s points over all of their games.

3条回答
  •  遥遥无期
    2021-01-21 01:52

    library nlme has a function for this as well, lmList

    library(nlme)
    coef(lmList(game ~ pts | name, gamelogs))
    #        (Intercept)         pts
    # player1    7.714286 -0.42857143
    # player2    4.230769  0.08241758
    

提交回复
热议问题