This file contains hidden or 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
| --- | |
| name: rmarkdown-manuscript-collab | |
| description: Use when collaborating on an Rmarkdown / Quarto / TeX manuscript where the prose is exclusively human-written. Triggers on mentions of "the paper", "the manuscript", "PNAS" or other journal templates, code chunks in the paper, bibliography updates, or any work touching a `.Rmd`, `.qmd`, or `.tex` manuscript file. Hard rule: never edit prose, captions, headers, or insert/move citation markers. Workflow: every change to a manuscript file goes through a PR for human review. | |
| --- | |
| # Collaborating on a human-authored Rmarkdown manuscript | |
| The author writes ALL prose. The agent never touches prose, captions, | |
| section headers, or citation markers in the manuscript. Code chunks, | |
| YAML, helper R files, rendering / template configuration, the |
This file contains hidden or 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
| library(tidyverse) | |
| library(wordbankr) | |
| eng_wg_inst <- wordbankr::get_instrument_data(form = "WG", language = "English (American)", | |
| item_info = TRUE, administration_info = TRUE) | |
| by_cat <- eng_wg_inst |> | |
| filter(item_kind == "word") |> | |
| group_by(data_id, lexical_category, age) |> | |
| summarise(prod = sum(produces), |
This file contains hidden or 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
| library(tidyverse) | |
| library(pwr) | |
| pwrs <- expand_grid(n = seq(0, 100, 10), | |
| es = seq(0, 1, .1)) |> | |
| mutate(pwr = map2_dbl(es, n, | |
| ~pwr.t.test(d = .x, n = .y)$power)) | |
| ggplot(pwrs, aes(x = n, y = pwr, col = as.factor(es))) + |
This file contains hidden or 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
| library(xkcd) | |
| library(tidyverse) | |
| d <- tibble(age = 1:20) |> | |
| mutate(upper = 1e6 * age * 12 + ifelse(age > 5, 2.5e5 * 52 * (age - 5), 0), | |
| lower = 1e5 * age * 12) |> | |
| pivot_longer(upper:lower, names_to = "bound", values_to = "vocabulary") | |
| pdf("~/Projects/AI commentaries/scale.pdf", width = 5, height = 4) | |
| ggplot(d, aes(x = age, y = vocabulary, col = bound)) + |
This file contains hidden or 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
| library(wordbankr) | |
| library(langcog) | |
| library(tidyverse) | |
| library(brms) | |
| library(forcats) | |
| library(survey) | |
| library(gamlss) | |
| theme_set(theme_mikabr()) | |
| font <- theme_mikabr()$text$family |
This file contains hidden or 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
| # relies on zoo package | |
| # function to find the baseline value | |
| baseline_looking <- function (lts) { | |
| # select lts > 12s | |
| lts_12 <- lts[lts > 12 & !is.na(lts)] | |
| # sum the first three | |
| baseline <- sum(lts_12[1:3], na.rm=TRUE) | |
This file contains hidden or 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
| library(tidyverse) | |
| library(assertthat) | |
| shuffle_data <- function(d) { | |
| d$participant_id <- shuffle(d$participant_id) | |
| return(d) | |
| } | |
| get_knower_level <- function (q, r, technique = "perfect") { |
This file contains hidden or 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
| # approach from | |
| # https://www.medrxiv.org/content/10.1101/2022.11.02.22281762v1.full.pdf | |
| library(tidyverse) | |
| library(survival) | |
| library(ggsurvfit) | |
| #devtools::install_github("maxlinde/baymedr") | |
| library(baymedr) | |
| # library(BayesSurvival) |
This file contains hidden or 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
| --- | |
| title: "mtcars example markdown" | |
| author: "Mike Frank" | |
| date: "2023-03-21" | |
| output: | |
| html_document: | |
| toc: true | |
| toc_float: true | |
| --- |
This file contains hidden or 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
| library(tidyverse) | |
| library(lme4) | |
| sgf <- read_csv("https://raw.githubusercontent.com/langcog/experimentology/main/data/tidyverse/stiller_scales_data.csv") |> | |
| mutate(age_group = cut(age, 2:5, include.lowest = TRUE), | |
| condition_f = factor(ifelse(condition == "Label", | |
| "Experimental", "Control")), | |
| age_centered = age - mean(age)) | |
| mod1 <- glmer(correct ~ age * condition + (1|subid) + (1|item), |
NewerOlder