|
Dew Stats for .NET
|
Logistic regression.
public LogisticRegress(TVec y, TVec n, TVec b, TMtx A, double Offset, TVec YCalc, TVec BStd, double Tolerance);
|
Parameters |
Description |
|
y |
response vector containing binomial counts. |
|
n |
number of trials for each count. Y is assumed to be binomial(p,N). |
|
b |
regression parameter estimates. |
|
A |
matrix of covariates, including the constant vector if required. |
|
Offset |
offset if required. |
|
YCalc |
fitted values. |
|
BStd |
Regression parameter estimates errors.This is an estimate of the precision of the B estimates. |
|
Tolerance |
Default precision for reweighted LQR. |
Fit logistic regression model.
The following example calculates coefficients for simple logistic regression. The counts are out of 10 in each case and there is one covariate[1].
using Dew.Math; using Dew.Stats; using Dew.Stats.Units; namespace Dew.Examples { private void Example() { Vector y = new Vector(0); Vector n = new Vector(0); Vector B = new Vector(0); Matrix X = new Matrix(0,0); y.SetIt(false,new double[] {2,0,3,1,5,5,6,9,5,9}); n.Size(y); n.SetVal(10.0); X.SetIt(false,10,2, new double[] {1,1, 1,2, 1,3, 1,4, 1,5, 1,6, 1,7, 1,8, 1,9, 1,10}); Regress.LogisticRegress(y,n,B,null); // B = (-2.58,0.42) } }
|
What do you think about this topic? Send feedback!
|
|
Copyright (c) 1999-2010 by Dew Research. All rights reserved.
|