Jeffrey Arnold avatar Jeffrey Arnold committed c446d2c

JagsLexer: changed extension to .jag

Comments (0)

Files changed (4)

pygments/lexers/_mapping.py

     'IokeLexer': ('pygments.lexers.jvm', 'Ioke', ('ioke', 'ik'), ('*.ik',), ('text/x-iokesrc',)),
     'IrcLogsLexer': ('pygments.lexers.text', 'IRC logs', ('irc',), ('*.weechatlog',), ('text/x-irclog',)),
     'JadeLexer': ('pygments.lexers.web', 'Jade', ('jade', 'JADE'), ('*.jade',), ('text/x-jade',)),
-    'JagsLexer': ('pygments.lexers.math', 'JAGS', ('jags',), ('*.bug', '*.jags'), ()),
+    'JagsLexer': ('pygments.lexers.math', 'JAGS', ('jags',), ('*.jag', '*.bug'), ()),
     'JavaLexer': ('pygments.lexers.jvm', 'Java', ('java',), ('*.java',), ('text/x-java',)),
     'JavascriptDjangoLexer': ('pygments.lexers.templates', 'JavaScript+Django/Jinja', ('js+django', 'javascript+django', 'js+jinja', 'javascript+jinja'), (), ('application/x-javascript+django', 'application/x-javascript+jinja', 'text/x-javascript+django', 'text/x-javascript+jinja', 'text/javascript+django', 'text/javascript+jinja')),
     'JavascriptErbLexer': ('pygments.lexers.templates', 'JavaScript+Ruby', ('js+erb', 'javascript+erb', 'js+ruby', 'javascript+ruby'), (), ('application/x-javascript+ruby', 'text/x-javascript+ruby', 'text/javascript+ruby')),

pygments/lexers/math.py

 
     name = 'JAGS'
     aliases = ['jags']
-    filenames = ['*.bug', '*.jags']
+    filenames = ['*.jag', '*.bug']
 
     ## JAGS
     _FUNCTIONS = [

tests/examplefiles/example.jag

+# lsat.jags example from classic-bugs examples in JAGS
+# See http://sourceforge.net/projects/mcmc-jags/files/Examples/2.x/
+var
+   response[R,T], m[R], culm[R], alpha[T], a[T], theta[N], r[N,T],
+   p[N,T], beta, theta.new, p.theta[T], p.item[R,T], P.theta[R];
+data {
+   for (j in 1:culm[1]) {
+      r[j, ] <- response[1, ];
+   }
+   for (i in 2:R) {
+      for (j in (culm[i - 1] + 1):culm[i]) {
+         r[j, ] <- response[i, ];
+      }
+   }
+}
+model {
+  # 2-parameter Rasch model
+  for (j in 1:N) {
+     for (k in 1:T) {
+        probit(p[j,k]) <- delta[k]*theta[j] - eta[k];
+        r[j,k] ~ dbern(p[j,k]);
+     }
+     theta[j] ~ dnorm(0,1);
+  }
+
+  # Priors
+  for (k in 1:T) {
+     eta[k] ~ dnorm(0,0.0001);       
+     e[k] <- eta[k] - mean(eta[]);  # sum-to-zero constraint
+
+     delta[k] ~ dnorm(0,1) T(0,);   # constrain variance to 1, slope +ve
+     d[k] <- delta[k]/pow(prod(delta), 1/T); # PRODUCT_k (d_k) = 1
+ 
+     g[k] <- e[k]/d[k];   # equivalent to B&A's threshold parameters
+  }
+
+  # Compute probability of response pattern i, for later use in computing G^2
+  theta.new ~ dnorm(0,1);          # ability parameter for random student 
+  for(k in 1:T) {
+       probit(p.theta[k]) <- delta[k]*theta.new - eta[k];
+       for(i in 1:R) {
+          p.item[i,k] <- p.theta[k]^response[i,k] * (1-p.theta[k])^(1-response[i,k]);
+       }
+  } 
+  for(i in 1:R) {    
+     P.theta[i] <- prod(p.item[i,])
+  }
+}

tests/examplefiles/example.jags

-# lsat.jags example from classic-bugs examples in JAGS
-# See http://sourceforge.net/projects/mcmc-jags/files/Examples/2.x/
-var
-   response[R,T], m[R], culm[R], alpha[T], a[T], theta[N], r[N,T],
-   p[N,T], beta, theta.new, p.theta[T], p.item[R,T], P.theta[R];
-data {
-   for (j in 1:culm[1]) {
-      r[j, ] <- response[1, ];
-   }
-   for (i in 2:R) {
-      for (j in (culm[i - 1] + 1):culm[i]) {
-         r[j, ] <- response[i, ];
-      }
-   }
-}
-model {
-  # 2-parameter Rasch model
-  for (j in 1:N) {
-     for (k in 1:T) {
-        probit(p[j,k]) <- delta[k]*theta[j] - eta[k];
-        r[j,k] ~ dbern(p[j,k]);
-     }
-     theta[j] ~ dnorm(0,1);
-  }
-
-  # Priors
-  for (k in 1:T) {
-     eta[k] ~ dnorm(0,0.0001);       
-     e[k] <- eta[k] - mean(eta[]);  # sum-to-zero constraint
-
-     delta[k] ~ dnorm(0,1) T(0,);   # constrain variance to 1, slope +ve
-     d[k] <- delta[k]/pow(prod(delta), 1/T); # PRODUCT_k (d_k) = 1
- 
-     g[k] <- e[k]/d[k];   # equivalent to B&A's threshold parameters
-  }
-
-  # Compute probability of response pattern i, for later use in computing G^2
-  theta.new ~ dnorm(0,1);          # ability parameter for random student 
-  for(k in 1:T) {
-       probit(p.theta[k]) <- delta[k]*theta.new - eta[k];
-       for(i in 1:R) {
-          p.item[i,k] <- p.theta[k]^response[i,k] * (1-p.theta[k])^(1-response[i,k]);
-       }
-  } 
-  for(i in 1:R) {    
-     P.theta[i] <- prod(p.item[i,])
-  }
-}
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.