This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
---------------------------- | |
month patient hasahamd | |
------- --------- ---------- | |
0 10008 1 | |
0 10011 1 | |
0 10015 1 | |
0 10023 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
---------------------------- | |
month patient hasahamd | |
------- --------- ---------- | |
0 10008 1 | |
0 10011 1 | |
0 10015 1 | |
0 10023 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# calculate ICC for lmer model object | |
icc <- function(m){ | |
vc <- as.data.frame((VarCorr(m))) | |
l <- vc$vcov | |
data_frame(grp=vc$grp, icc=sapply(l, function(x){x/sum(l)})) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<a href="javascript:var%20auto%20={names:%20'Steve%20Buscemi%20Catherine%20Keener%20Dermot%20Mulroney%20Danielle%20Zerneck%20James%20LeGros%20Rica%20Martens%20Peter%20Dinklage%20Kevin%20Corrigan%20Hilary%20Gilford%20Robert%20Wightman%20Tom%20Jarmusch%20Michael%20Griffiths%20Matthew%20Grace%20Ryan%20Bowker%20Francesca%20DiMauro',blurb:%20'Excepteur%20pariatur%20cillum%20labore%20ea%20proident%20et%20deserunt.%20Ex%20commodo%20ea%20esse%20incididunt%20deserunt%20dolor%20ea%20minim%20do%20qui%20irure.%20Qui%20aute%20irure%20ut%20ad%20id%20duis%20esse%20tempor%20occaecat%20exercitation%20excepteur%20do%20nostrud.%20Aute%20ex%20fugiat%20tempor%20laboris%20ex%20consequat%20consequat%20tempor%20anim%20ipsum%20consectetur%20et%20proident%20cupidatat%20duis%20nulla%20reprehenderit.%20Velit%20adipisicing%20occaecat%20nulla%20officia%20irure%20anim%20dolor%20quis%20cupidatat%20cupidatat%20deserunt%20esse%20Lorem%20exercitation%20in%20commodo.%20Amet%20ea%20labore%20duis%20mollit%20sit%20labore%20laborum%20sit%20aliqua%2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# The example below shows why WAIC could be useful when studies are underpowered. | |
# Here we simulate data with a weak polynomial relationship between x an y, with | |
# only a small sample. Although the effect of the polynomial term does not reach | |
# conventional standards for statistical significance, comparing WAIC (an estimate | |
# of how effective each model will be at predicting new, out-of-sample data) indicates | |
# we should assign a higher probability that `m2` is 'correct', when compared with `m1` | |
# (more than twice as likely). | |
library(rethinking) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"cells": [ | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"The example below shows why WAIC could be useful when studies are underpowered. Here we simulate data with a weak polynomial relationship between x an y, with only a small sample. Although the effect of the polynomial term does not reach conventional standards for statistical significance, comparing WAIC (an estimate of how effective each model will be at predicting new, out-of-sample data) indicates we should assign a higher probability that `m2` is 'correct', when compared with `m1` (more than twice as likely)." | |
] | |
}, | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
If I have these data: | |
ID T Y | |
1 1 33 | |
1 2 32 | |
2 1 21 | |
2 2 26 | |
How do I make this extra column: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
. do "/var/folders/47/f2b3zfds1y5gq4vp7m6___cr0000gn/T//SD44048.000000" | |
. clear all | |
. set seed 123 | |
. | |
. * recruit subjects (if only this easy...) | |
. set obs 2000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
clear all | |
set seed 123 | |
* recruit subjects (if only this easy...) | |
set obs 2000 | |
* assign to groups | |
gen mbct = mod(_n, 2) | |
* depression baseline score |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
. do "/var/folders/47/f2b3zfds1y5gq4vp7m6___cr0000gn/T//SD44048.000000" | |
. clear all | |
. set seed 123 | |
. | |
. * recruit subjects (if only this easy...) | |
. set obs 2000 |