@@ -5,21 +5,21 @@ id1 = rand(1:(N/K), N)
55id2 = rand (1 : K, N)
66x1 = randn (N)
77x2 = randn (N)
8- w = cos (id1)
9- y= 3 .* x1 .+ 5 .* x2 .+ cos (id1) .+ cos (id2).^ 2 .+ randn (N)
8+ w = cos . (id1)
9+ y= 3 .* x1 .+ 5 .* x2 .+ cos . (id1) .+ cos . (id2).^ 2 .+ randn (N)
1010df = DataFrame (id1 = pool (id1), id2 = pool (id2), x1 = x1, x2 = x2, w = w, y = y)
11- @time reg (y ~ x1 + x2, df )
11+ @time reg (df, @model ( y ~ x1 + x2) )
1212# 1.258554 seconds (723 allocations: 1.205 GB, 18.70% gc time)
1313# 852MB to obtain the matrix etc, and then 1.205 for Regressions part
14- @time reg (y ~ x1 + x2, df, VcovCluster ( : id2 ))
14+ @time reg (df, @model ( y ~ x1 + x2, vcov = cluster ( id2) ))
1515# 1.569679 seconds (843 allocations: 1.293 GB, 25.21% gc time)
16- @time reg (y ~ x1 + x2 |> id1, df )
16+ @time reg (df, @model ( y ~ x1 + x2, fe = id1) )
1717# 1.476390 seconds (890 allocations: 1.175 GB, 20.15% gc time)
18- @time reg (y ~ x1 + x2 |> id1, df, VcovCluster ( : id1 ))
18+ @time reg (df, @model ( y ~ x1 + x2, fe = id1, vcov = cluster ( id1) ))
1919# 1.974738 seconds (1.04 k allocations: 1.255 GB, 15.85% gc time)
20- @time reg (y ~ x1 + x2 |> id1 + id2, df )
20+ @time reg (df, @model ( y ~ x1 + x2, fe = id1 + id2) )
2121# 4.554836 seconds (1.01 k allocations: 1.188 GB, 9.56% gc time)
22- @time reg (y ~ x1 + x2 |> id1, df, weight = :w )
22+ @time reg (df, @model ( y ~ x1 + x2, fe = id1, weights = w) )
2323# 2.000850 seconds (20.00 M allocations: 1.010 GB, 18.82% gc time)
24- @time reg (y ~ x1 + x2 |> id1 + id2, df, weight = :w )
24+ @time reg (df, @model ( y ~ x1 + x2, fe = id1 + id2, weights = w) )
2525# 4.118974 seconds (20.00 M allocations: 1.018 GB, 9.60% gc time)
0 commit comments