Fast linear regression by group

后端 未结 5 1922
后悔当初
后悔当初 2020-12-08 08:31

I have 500K users and I need to compute a linear regression (with intercept) for each of them.

Each user has around 30 records.

I t

5条回答
  •  北海茫月
    2020-12-08 09:01

    An example using Rfast.

    Assuming a single response and 500K predictor variables.

    y <- rnorm(30)
    x <- matrnorm(500*1000,30)
    system.time( Rfast::univglms(y, x,"normal") )  ## 0.70 seconds
    

    Assuming 500K response variables and a singl predictor variable.

    system.time( Rfast::mvbetas(x,y) )  ## 0.60 seconds
    

    Note: The above times will decrease in the nearby future.

提交回复
热议问题