Programming Leftovers
-
Rlang ☛ How Many Ways to Color This Grid: Teaching Combinatorics Using R
You have a 2×2 grid of squares, and you need to paint each square one of four colors: red, blue, green, or yellow. The restriction is that no two adjacent squares (sharing a side) can have the same color. How many valid ways you can color the grid?
-
Lucy D'Agostino McGowan & Nick Strayer ☛ Elevator Dings: A Severance Analysis –
This data consists of all elevator dings in the Severance episodes along with the episode number, time stamp, pitch of the ding, and the action associated.
-
Max Bernstein ☛ Visualizing big data
I don’t have any meaningful lessons from this other than visualization is hard and a skill on its own.
-
[Repeat] Rlang ☛ Accounting for ties in a Bayesian proportional hazards model
Over my past few posts, I’ve been progressively building towards a Bayesian model for a stepped-wedge cluster randomized trial with a time-to-event outcome, where time will be modeled using a spline function. I started with a simple Cox proportional hazards model for a traditional RCT, ignoring time as a factor. In the next post, I introduced a nonlinear time effect. For the third post—one I initially thought was ready to publish—I extended the model to a cluster randomized trial without explicitly incorporating time. I was then working on the grand finale, the full model, when I ran into an issue: I couldn’t recover the effect-size parameter used to generate the data.
After an embarrassingly long debugging process, I finally realized the problem—many events shared the same event times, and my model failed to account for ties. This issue hadn’t been apparent in the earlier models, but the final version was particularly sensitive to it. So, I decided to step back and first implement a model that properly handles ties before moving ahead.
-
Golang
-
Branur Leach ☛ The right way to do data fixtures in Go
Every test suite should start early in building a strong convention to generate data fixtures. If it doesn’t, data fixtures will still emerge (they’re that necessary), but in a way that’s poorly designed, with no API (or a poorly designed one), and not standardized.
-