Example 2: Example: Poisson Model.

In this example, the following data illustrate the Poisson model when all types of interval data are present. The example also illustrates the use of classification variables and the detection of potentially infinite estimates (which turn out here to be finite). These potential estimates lead to the two iteration summaries. The input data is

ilt irt icen Class 1 Class 2
0 5 0 1 0
9 4 3 0 0
0 4 1 0 0
9 0 2 1 1
0 1 0 0 1

A linear model \mu + \beta_1 x_1 + \beta_2 x_2 is fit where x_1 = 1 if the Class 1 variable is 0, x_1 = 1, otherwise, and the x_2 variable is similarly defined.
using System;
using Imsl.Math;
using Imsl.Stat;

public class CategoricalGenLinModelEx2
{
	public static void  Main(String[] args)
	{
		// Set up a PrintMatrix object for later use.
		PrintMatrixFormat mf;
		PrintMatrix p;
		p = new PrintMatrix();
		mf = new PrintMatrixFormat();
		mf.SetNoRowLabels();
		mf.SetNoColumnLabels();
                mf.NumberFormat = "0.0000";

		
		double[,] x = {            
                                {0.0, 5.0, 0.0, 1.0, 0.0},
                                {9.0, 4.0, 3.0, 0.0, 0.0},
                                {0.0, 4.0, 1.0, 0.0, 0.0},
                                {9.0, 0.0, 2.0, 1.0, 1.0},
                                {0.0, 1.0, 0.0, 0.0, 1.0}};
		CategoricalGenLinModel CATGLM;
		CATGLM = new CategoricalGenLinModel(x,
         CategoricalGenLinModel.DistributionParameterModel.Model0);
		CATGLM.UpperEndpointColumn = 0;
		CATGLM.LowerEndpointColumn = 1;
		CATGLM.OptionalDistributionParameterColumn = 1;
		CATGLM.CensorColumn = 2;
		CATGLM.InfiniteEstimateMethod = 0;
		CATGLM.ModelIntercept = 1;
		int[] indcl = new int[]{3, 4};
		CATGLM.ClassificationVariableColumn = indcl;
		int[] nvef = new int[]{1, 1};
		int[] indef = new int[]{3, 4};
		CATGLM.SetEffects(indef, nvef);
		CATGLM.UpperBound = 4;
		
		
		p.SetTitle("Coefficient Statistics");
		p.Print(mf, CATGLM.Solve());
		Console.Out.WriteLine("Log likelihood " + CATGLM.OptimizedCriterion);
		p.SetTitle("Asymptotic Coefficient Covariance");
		p.SetMatrixType(PrintMatrix.MatrixType.UpperTriangular);
		p.Print(mf, CATGLM.CovarianceMatrix);
		p.SetMatrixType(PrintMatrix.MatrixType.Full);
		p.SetTitle("Case Analysis");
		p.Print(mf, CATGLM.CaseAnalysis);
		p.SetTitle("Last Coefficient Update");
		p.Print(CATGLM.LastParameterUpdates);
		p.SetTitle("Covariate Means");
		p.Print(CATGLM.DesignVariableMeans);
		p.SetTitle("Distinct Values For Each Class Variable");
		p.Print(CATGLM.ClassificationVariableValues);
		Console.Out.WriteLine("Number of Missing Values " + CATGLM.NRowsMissing);
	}
}

Output

       Coefficient Statistics
                                    
-0.5488  1.1713  -0.4685  0.6395  
 0.5488  0.6098   0.8999  0.3684  
 0.5488  1.0825   0.5069  0.6123  

Log likelihood -3.11463849257844
Asymptotic Coefficient Covariance
                             
 1.3719  -0.3719  -1.1719  
          0.3719   0.1719  
                   1.1719  

               Case Analysis
                                            
5.0000   0.0000  2.2361  1.0000   0.0000  
6.9246  -0.4122  2.1078  0.7636  -0.1955  
6.9246   0.4122  1.1727  0.2364   0.3515  
0.0000   0.0000  0.0000  0.0000   NaN     
1.0000   0.0000  1.0000  1.0000   0.0000  

 Last Coefficient Update
             0            
0  -2.84092901922464E-07  
1   3.53822215072981E-10  
2   7.09878432577707E-07  

Covariate Means
    0   
0  0.6  
1  0.6  
2  0    

Distinct Values For Each Class Variable
   0  
0  0  
1  1  
2  0  
3  1  

Number of Missing Values 0

Link to C# source.