Scheduled service maintenance on November 22


On Friday, November 22, 2024, between 06:00 CET and 18:00 CET, GIN services will undergo planned maintenance. Extended service interruptions should be expected. We will try to keep downtimes to a minimum, but recommend that users avoid critical tasks, large data uploads, or DOI requests during this time.

We apologize for any inconvenience.

Browse Source

[DATALAD] Recorded changes

Lucas Gautheron 9 hours ago
parent
commit
0fbd39728b

+ 20 - 0
code/models/blocks/behavior_model_parameters_simple.stan

@@ -0,0 +1,20 @@
+vector<lower=0>[n_classes] alpha_child_level; // variance across recordings for a given child
+// array[2] vector<lower=0>[n_classes-1] alpha_corpus_level; // variance among children
+// matrix<lower=0>[n_classes-1,n_corpora] mu_corpus_level; // child-level average
+vector<lower=0>[n_classes-1] alpha_pop_level; // variance among corpora
+vector<lower=0>[n_classes] mu_pop_level; // population level averages
+//vector<lower=0>[n_classes-1] alpha_pop; // mean child-level variance
+
+// siblings
+real beta_sib_och; // effect of having siblings on OCH speech
+real beta_sib_adu; // effect of having siblings on ADU speech
+real<lower=0,upper=1> p_sib; // prob of having siblings
+
+
+// average effect of age
+real alpha_dev;
+real<lower=0> sigma_dev;
+
+// effect of excess ADU input
+real beta_dev;
+real beta_direct;

+ 13 - 0
code/models/blocks/behavior_model_priors_simple.stan

@@ -0,0 +1,13 @@
+alpha_child_level ~ gamma(4,1);
+mu_pop_level ~ exponential(4); // 250 vocs/hour
+alpha_pop_level ~ gamma(25, 1); // sd = 0.35 x \mu
+
+has_siblings ~ binomial(has_siblings+no_siblings, p_sib);
+p_sib ~ uniform(0, 1);
+beta_sib_och ~ normal(0, 1);
+beta_sib_adu ~ normal(0, 1);
+
+alpha_dev ~ normal(0, 1);
+sigma_dev ~ exponential(1);
+beta_dev ~ normal(0, 1);
+beta_direct ~ normal(0, 1);

+ 20 - 0
code/models/blocks/behavior_model_simple.stan

@@ -0,0 +1,20 @@
+vector<lower=0>[n_classes] alpha_child_level; // variance across recordings for a given child
+// array[2] vector<lower=0>[n_classes-1] alpha_corpus_level; // variance among children
+// matrix<lower=0>[n_classes-1,n_corpora] mu_corpus_level; // child-level average
+vector<lower=0>[n_classes-1] alpha_pop_level; // variance among corpora
+vector<lower=0>[n_classes] mu_pop_level; // population level averages
+//vector<lower=0>[n_classes-1] alpha_pop; // mean child-level variance
+
+// siblings
+real beta_sib_och; // effect of having siblings on OCH speech
+real beta_sib_adu; // effect of having siblings on ADU speech
+real<lower=0,upper=1> p_sib; // prob of having siblings
+
+
+// average effect of age
+real alpha_dev;
+real<lower=0> sigma_dev;
+
+// effect of excess ADU input
+real beta_dev;
+real beta_direct;

+ 59 - 0
code/models/blocks/behavior_observations_model_simple.stan

@@ -0,0 +1,59 @@
+// P(recs|child)
+real mu_adu = p_sib*(mu_pop_level[3]+mu_pop_level[4])+(1-p_sib)*(mu_pop_level[3]+mu_pop_level[4])*exp(beta_sib_adu/10.0);
+
+target += reduce_sum(
+    recs_priors_lpmf, children, 1,
+    n_recs, n_classes, recs_duration, age,
+    truth_vocs,
+    mu_pop_level, mu_adu, mu_child_level, alpha_child_level,
+    child_dev_age, alpha_dev, sigma_dev, beta_dev, beta_direct
+);
+
+// P(child|corpus)
+vector [2] ll;
+for (c in 1:n_children) {
+    // if there is sibling data
+    if (child_siblings[c]>=0) {
+        int distrib = child_siblings[c]==0?2:1;
+
+        mu_child_level[c,1] ~ gamma(
+            alpha_pop_level[distrib,1],
+            (alpha_pop_level[distrib,1]/(mu_pop_level[2,corpus[c]]*exp(
+                child_siblings[c]==0?beta_sib_och:0 
+            )))
+        );
+        mu_child_level[c,2:] ~ gamma(
+            alpha_pop_level[distrib,2:],
+            (alpha_pop_level[distrib,2:]./(mu_pop_level[3:,corpus[c]]*exp(
+                child_siblings[c]==0?beta_sib_adu/10.0:0 
+            )))
+        );
+    }
+    // otherwise
+    else {
+        // assuming no sibling
+        ll[1] = log(1-p_sib)+gamma_lpdf(
+            mu_child_level[c,1] | alpha_pop_level[2,1], alpha_pop_level[2,2]/(mu_pop_level[2,corpus[c]]*exp(beta_sib_och))
+        );
+        ll[1] += gamma_lpdf(
+            mu_child_level[c,2] | alpha_pop_level[2,2], alpha_pop_level[2,3]/(mu_pop_level[3,corpus[c]]*exp(beta_sib_adu/10.0))
+        );
+        ll[1] += gamma_lpdf(
+            mu_child_level[c,3] | alpha_pop_level[2,3], alpha_pop_level[2,4]/(mu_pop_level[4,corpus[c]]*exp(beta_sib_adu/10.0))
+        );
+
+        // assuming sibling
+        ll[2] = log(p_sib)+gamma_lpdf(
+            mu_child_level[c,1] | alpha_pop_level[1,1], alpha_pop_level[1,2]/(mu_pop_level[2,corpus[c]])
+        );
+        ll[2] += gamma_lpdf(
+            mu_child_level[c,2] | alpha_pop_level[1,2], alpha_pop_level[1,3]/(mu_pop_level[3,corpus[c]])
+        );
+        ll[2] += gamma_lpdf(
+            mu_child_level[c,3] | alpha_pop_level[1,3], alpha_pop_level[1,4]/(mu_pop_level[4,corpus[c]])
+        );
+        target += log_sum_exp(ll);
+    }
+}
+
+child_dev_age ~ normal(0, 1);