瀏覽代碼

[DATALAD] Recorded changes

Lucas Gautheron 8 月之前
父節點
當前提交
45713a8eac
共有 1 個文件被更改,包括 17 次插入17 次删除
  1. 17 17
      code/models/enumeration_poisson_direct_dev.stan

+ 17 - 17
code/models/enumeration_poisson_direct_dev.stan

@@ -83,10 +83,10 @@ functions {
                 ll += normal_lpdf(vocs[k,:] | expect, sqrt(expect));
 
                 ll += normal_lpdf(
-                    log(truth_vocs[k,1]) | mu_c+tc[k] + conv*(log(truth_vocs[k,3]+truth_vocs[k,4])), 1/phi[1]
+                    truth_vocs[k,1]/1000 | mu_c+tc[k] + conv*(truth_vocs[k,3]+truth_vocs[k,4])/1000, phi[1]
                 );
                 ll += normal_lpdf(
-                    log(truth_vocs[k,3]+truth_vocs[k,4]) | mu_a+ta[children[k-start+1]], 1/phi[2]
+                    (truth_vocs[k,3]+truth_vocs[k,4])/1000 | mu_a+ta[children[k-start+1]], phi[2]
                 );
             }
 
@@ -120,7 +120,7 @@ data {
     array [n_clips,n_classes] int<lower=0> truth_total;
     array [n_clips] real<lower=0> clip_duration;
 
-    int<lower=1> n_validation;
+    int<lower=0> n_validation;
 
     // actual speech rates
     int<lower=1> n_rates;
@@ -146,7 +146,7 @@ parameters {
     real mu_beta_0; // average effect of age
     real<lower=0> sigma_beta_0; // effect of age disperson
     vector [n_children] z_beta_0; // effect of age z-score
-    real<lower=0> beta_a; // effect of excess ADU speech
+    real beta_a; // effect of excess ADU speech
     real conv; // conversational/contextual effects
 
     // confusion parameters
@@ -171,8 +171,8 @@ transformed parameters {
     vector [n_recs] tc;
     vector [n_children] ta;
 
-    beta_0 = mu_beta_0 + z_beta_0/sigma_beta_0;
-    ta = z_ta/sigma_a;
+    beta_0 = mu_beta_0 + z_beta_0*sigma_beta_0;
+    ta = z_ta*sigma_a;
 
     for (k in 1:n_recs) {
         tc[k] = beta_0[children[k]]*age[k]/12 + beta_a*ta[children[k]]*sigma_a*age[k]/12;
@@ -190,20 +190,20 @@ model {
        mu_c, mu_a, tc, ta, conv, phi
     );
 
-    target += normal_lpdf(mu_c | 0, 5);
+    mu_c ~ normal(0, 5);
 
-    target += normal_lpdf(mu_a | 0, 5);
-    target += exponential_lpdf(sigma_a | 1);
-    target += normal_lpdf(z_ta | 0, 1);
+    mu_a ~ normal(0, 5);
+    sigma_a ~ exponential(1);
+    z_ta ~ normal(0, 1);
 
-    target += normal_lpdf(mu_beta_0 | 0, 1);
-    target += exponential_lpdf(sigma_beta_0 | 1);
-    target += normal_lpdf(z_beta_0 | 0, 1);
+    mu_beta_0 ~ normal(0, 1);
+    sigma_beta_0 ~ exponential(1);
+    z_beta_0 ~ normal(0, 1);
 
-    target += exponential_lpdf(beta_a | 1);
-    target += normal_lpdf(conv | 0, 1);
+    beta_a ~ normal(0, 1);
+    conv ~ normal(0, 1);
 
-    target += exponential_lpdf(phi | 1);
+    phi ~ exponential(1);
 
     for (k in 1:n_recs) {
         for (i in 1:n_classes) {
@@ -246,7 +246,7 @@ model {
     speech_rate_mu_prior ~ exponential(2);
     for (i in 1:n_classes) {
         speech_rate_alpha[i,:] ~ normal(1, 1);
-        speech_rate_mu[i,:] ~ gamma(2, 2/speech_rate_mu_prior[i]);
+        speech_rate_mu[i,:] ~ gamma(4, 4/speech_rate_mu_prior[i]);
     }
 
     for (g in 1:n_rates) {