How to use command line interface?

Welcome to the forum for Stat-JR users. Feel free to post your question about Stat-JR here. The Centre for Multilevel Modelling take no responsibility for the accuracy of these posts, we are unable to monitor them closely. Do go ahead and post your question and thank you in advance if you find the time to post any answers!

We will add further support to the Stat-JR website, such as FAQs and tutorials, as soon as it is available; the Stat-JR website can be found here: http://www.bristol.ac.uk/cmm/software/statjr/
Post Reply
SimonG03
Posts: 2
Joined: Mon Sep 21, 2015 2:49 pm

How to use command line interface?

Post by SimonG03 »

Hi everyone,

I am interested in the command line interface (CLI) of Stat-JR, and how I can use it for analysing my data. I use R for most of my computations; I would like to run Stat-JR from the command line rather than using the GUI, so I can stay within R if possible.
My Question(s): How can I use the CLI of Stat-JR? Is there documentation explaining this? Suppose I have already fit a model in Stat-JR, thus generating the code necessary to run it, can I use the CLI to fit the same model again using R?

So far, I've been using Stat-JR 1.0.2 via the browser-based GUI. As noted in [1] (see link below), there is a CLI for Stat-JR, which appears to be "under development", and which would allow Stat-JR to be run from external software. A neat feature, considering that most of the operations seem do be done by python and pre-compiled C++ code.
In the advanced documentation [2], I found a reference to a "Python command line interface". However, it is not discussed in that document how it can be used. In "~\StatJR\src\apps\scripting" there is an executable file called "runScript.exe", which triggers the same loading process as the main executable, but it doesn't start the TREE interface.

Is this the exetutable for the CLI? If so, how can I use it? Are there help files or man pages that explain the use of the CLI? If so, I would be happy if someone points me into the right direction; if not, I would be even more happy if someone could explain a few basic steps on "how to get started" :)

Thanks in advance! I'm looking forward to using this feature!

Best,
Simon

[1] http://www.bristol.ac.uk/cmm/software/s ... port/faqs/
[2] http://www.bristol.ac.uk/cmm/media/migr ... vanced.pdf
ChrisCharlton
Posts: 1348
Joined: Mon Oct 19, 2009 10:34 am

Re: How to use command line interface?

Post by ChrisCharlton »

Yes, it is possible to run Stat-JR templates from a command line, although as you have discovered the support for this is preliminary and the exact mechanism may change in the future (if you do attempt to use it we would be interested in your feedback). In another topic in this forum I have provided some syntax for running a Stat-JR model from R and then retrieving the MCMC chains:

https://www.cmm.bristol.ac.uk/forum/vie ... =879#p2201

Let us know if anything is unclear.
SimonG03
Posts: 2
Joined: Mon Sep 21, 2015 2:49 pm

Re: How to use command line interface?

Post by SimonG03 »

That already helps a lot. However, I am not sure yet if I stick with Stat-JR in this case because that would require me to write a new template to run in this manner.

Is there, perhaps, a good documentation on how to extend the current templates in Stat-JR? In the advanced documentation, there is a bit about extending templates and writing new ones, but it seems like great familiarity with Python and C++ is required to write them. Judging from that, the amount of work I would need to invest in that are outweighted (by far) by switching to a different program, even though I am genuinely interested in using Stat-JR.

I will have a look at the documentation and the example you provided. I'll let you know if there is any progress. I'd be happy to hear about a documentation on creating templates.

Best,
Simon
richardparker
Posts: 61
Joined: Fri Oct 23, 2009 1:49 pm

Re: How to use command line interface?

Post by richardparker »

Hi - thanks for your interest in the software. The forum message Chris linked to illustrates how to call Stat-JR from R and bring the results back. It's not actually necessary to write a Stat-JR template in order to do that (one can use the templates provided in the Stat-JR package), although it would be necessary to write a Stat-JR template if one wanted to extend Stat-JR's functionality.

Best wishes,

Richard
plopblurt
Posts: 9
Joined: Tue Jan 03, 2023 4:59 am

Re: How to use command line interface?

Post by plopblurt »

Hi everyone, basket random
A helpful documentation on how to extend the functionality of the templates currently available in Stat-JR? There is some discussion of extending templates and writing new ones in the more advanced documentation; however, it appears that an in-depth understanding of Python and C++ is necessary in order to write them.
ChrisCharlton
Posts: 1348
Joined: Mon Oct 19, 2009 10:34 am

Re: How to use command line interface?

Post by ChrisCharlton »

We don't have a lot of information on this outside the advanced guide. What kind of extensions are you hoping to add?
JoseSpencer
Posts: 2
Joined: Wed Jun 28, 2023 7:26 am

Re: How to use command line interface?

Post by JoseSpencer »

ChrisCharlton wrote: Wed Jan 04, 2023 11:19 am We don't have a lot of information on this outside the advanced guide. What kind of extensions are you hoping to add?
I want to learn all kinds of gadgetsSonic exe. Do you have a manual page on this?
Post Reply