# Output

There are six simulation output elements corresponding to the six kinds of data a simulation may produce:

- `timeSeriesFrames` - Record the species populations and reactions counts at specified frames. In this way one can plot the realizations as a function of time.
- `timeSeriesAllReactions` - Record every reaction event for each trajectory.
- `histogramFrames` - Record histograms of species populations at specified frames.
- `histogramAverage` - Record histograms of average species populations.
- `statisticsFrames` - Record the mean and standard deviation of species populations at specified frames.
- `statisticsAverage` - Record the time-averaged mean and standard deviation of species populations.

Each of the simulation output elements store the identifiers for the model and method used to produce the output.

Trajectories recorded at frames.
In a timeSeriesFrames element one records the list of frame times, the indices of the recorded species and the indices of the recorded reactions. For each trajectory generated, there is a list of populations and a list of reactions counts. The number of populations in each list is the product of the number of frames and the number of recorded species. The populations at a given frame are contiguous. Likewise for the recorded species.

      <timeSeriesFrames model="Identifier" method="Identifier">
        <frameTimes>
          List of numbers.
        </frameTimes>
        <recordedSpecies>
          List of indices.
        </recordedSpecies>
        <recordedReactions>
          List of indices.
        </recordedReactions>
        For each trajectory:
          <populations>
            List of numbers.
          </populations>
          <reactionCounts>
            List of numbers.
          </reactionCounts>
      </timeSeriesFrames>

Trajectories with all reaction events.
In a timeSeriesAllReactions element one stores the simulation initial time and final time as attributes. These quantities can't be deduced from a list of frame times. For each trajectory generated one records the initial populations, a list of reaction indices, and a list of reaction times. The initial populations are needed because there may be a nonzero equilibration time. Each index/time pair specifies a reaction event.

      <timeSeriesAllReactions model="Identifier" method="Identifier"
       initialTime="Number" finalTime="Number">
        For each trajectory:
          <initialPopulations>
            List of numbers.
          </initialPopulations>
          <indices>
            List of indices.
          </indices>
          <times>
            List of numbers.
          </times>
      </timeSeriesAllReactions>

Histograms for transient behavior.
Below is the histogramFrames element. The histogram multiplicity and the number of trajectories generated are stored as attributes. The top level elements are the list of frame times, the list of recorded species, and a histogram for each combination of frame and recorded species.

      <histogramFrames model="Identifier" method="Identifier"
       multiplicity="Integer" numberOfTrajectories="Integer">
        <frameTimes>
          List of numbers.
        </frameTimes>
        <recordedSpecies>
          List of indices.
        </recordedSpecies>
        One <histogram> element for each frame and each recorded species.
      </histogramFrames>

In addition to storing the actual histogram data, the histogram element stores statistics on the species populations. The following statistical fields are attributes: cardinality, sum of the weights, mean, and summed second centered moment. The cardinality is the number of samples. Samples from trajectory tree methods use non-uniform weights thus one needs to store the sum of the weights as well. Next is the mean. Instead of storing the variance or standard deviation, we store equivalent information in the summed second centered moment Σ(x - μ)2. When merging statistics from multiple histograms this quantity can be computed more accurately than the variance.

For a histogram one stores the lower bound and bin width as attributes. The number of bins can be deduced from the lists of bin values. One also stores the frame index and recorded species index as attributes. The histogram bin values are stored across a number of lists (the number is the multiplicity). By computing the histogram distance between each of the parts and the combined distribution, one can estimate the error in the combined histogram.

      <histogram cardinality="Number" sumOfWeights="Number"
       mean="Number" summedSecondCenteredMoment="Number" lowerBound="Number"
       width="Number" frame="Integer" species="Integer">
        For i in 1..multiplicty:
          <histogramElement>
            List of numbers.
          </histogramElement >
     </histogram>

Histograms for steady state solutions.
The histogramAverage element is used for recording steady state solutions.

      <histogramAverage model="Identifier" method="Identifier"
       multiplicity="Integer" numberOfTrajectories="Integer">
       <recordedSpecies>
          List of indices.
        </recordedSpecies>
        One <histogram> element for each recorded species.
      </histogramAverage>

Statistics for transient behavior.
Next we consider the statisticsFrames element. The top level elements are the list of frame times, the list of recorded species, and the packed list of means and standard deviations.

      <statisticsFrames model="Identifier" method="Identifier">
        <frameTimes>
          List of numbers.
        </frameTimes>
        <recordedSpecies>
          List of indices.
        </recordedSpecies>
        <statistics>
          Packed list of the mean and standard deviations.
        </statistics>
     </statisticsFrames>

Statistics for steady state solutions.
The statisticsAverage element is used for recording externally-generated steady state solutions

      <statisticsAverage model="Identifier" method="Identifier">
       <recordedSpecies>
          List of indices.
        </recordedSpecies>
        <statistics>
          Packed list of the mean and standard deviations.
        </statistics>
     </statisticsAverage>