Hi,

I am using JMSL 5.0.1 to calculate the Logistic Regression of a dataset using CategoricalGenLinModel, and in particular the Log Likelihood of it. My concern is that JMSL returns a Log Likelihood of -213.43823013251273, but R (version 2.12.1) returns a Log Likelihood of -297.5045. Is my setup of CategoricalGenLinModel incorrect when I calculate the Log Likelihood, which is the cause for the difference in LogLikelihood values from JMSL and R? Any help is appreciated.

Below is a sample of my JMSL code, the R commands I use and my dataset is attached as a CSV file.

Thank you,
Grover

JMSL code
Code:
	public static void main(String[] args) {
		try {

			String filepath = "C:\\Documents and Settings\\username\\LogisticRegressionSample.txt";
			BufferedReader reader = new BufferedReader(new FileReader(filepath));
			double[][] data = new double[522][2]; 
			//read column headers
			String line = reader.readLine();
			//read row of values
			int index = 0;
			while( (line = reader.readLine()) != null){
				String[] values = line.split(",");
				double independent = values[0].isEmpty()?Double.NaN:Double.parseDouble(values[0]);
				double dependent = values[1].isEmpty()?Double.NaN:Double.parseDouble(values[1]);
				data[index] = new double[]{independent,dependent};
				index++;
			}
			CategoricalGenLinModel model = new CategoricalGenLinModel(data,
					CategoricalGenLinModel.MODEL3);
    		        model.setLowerEndpointColumn(1);
    		        model.setInfiniteEstimateMethod(1);
    		        model.setModelIntercept(1);
    		        int[] nvef = {1};
    		        int[] indef = {0};
    		       model.setEffects(indef, nvef);
			model.solve();
			double logLikelihood = model.getOptimizedCriterion();
			System.out.println("Likelihood: "+logLikelihood);
						
		} catch (Exception e) {
			e.printStackTrace();
		} 

	}
R Commands
Code:
> data = read.csv('C:/Documents and Settings/username/LogisticRegressionSample.txt')
> attach(data)
> colnames(data)
[1] "INDEPENDENT" "DEPENDENT"  
> model <- glm(DEPENDENT ~ INDEPENDENT,family=binomial(link=logit))
> logLik(model)
'log Lik.' -297.5045 (df=2)