|
NEWS
|
|
NLREG has been selected as the "Editor"s Pick" by
SoftSeek.
|
|
|
NLREG is in use at hundreds of universities, laboratories, and government agencies around the world (over 20 countries). For a list of a few organizations using NLREG click here.
|
|
|
If you have categorical variables, you may want to use a Decision Tree to model your data. Check out the DTREG Decision Tree Builder.
|
|
|
You also should check out the News Rover program that automatically scans Usenet newsgroups, downloads messages of interest to you, decodes binary file attachments, reconstructs files split across multiple messages, and eliminates spam and duplicate files.
|
|
|
|
|
|
|
NLREG DLL COM Library Example Visual Basic Program
Here is a complete Visual Basic program that calls the NLREG DLL COM library to perform a regression
to the function y=a+b*x. Click here to see the NLREG DLL
COM Library reference manual.
Private Sub Command1_Click()
'
' Reference the NLREG COM library
'
Dim nlreg As NLREGCOMLib.nlreg
Set nlreg = New NLREGCOMLib.nlreg
'
' Misc. data declarations.
'
Dim ProgramSource As String
Dim Report As String
Dim VarName As String
Dim Status As Long
Dim NumVar As Long
Dim Xindex, Yindex As Long
Dim Aindex, Bindex As Long
Dim Avalue, Bvalue As Double
Dim Index As Long
Dim PredictedY, Rsquared As Double
'
' Initialize the NLREG library.
'
nlreg.Initialize (0)
'
' Compile the NLREG program.
' Note: If the program is in a file, use CompileFile().
'
ProgramSource = "Variables x,y; Parameters a,b; Function y=a+b*x; data;"
Status = nlreg.Compile(ProgramSource)
If (Status <> 1) Then
' Some sort of compile error occurred.
Report = nlreg.GetAnalysisReport(0)
Stop
End If
'
' Check information about the variables.
'
NumVar = nlreg.NumInputVariables()
For Index = 0 To NumVar - 1 Step 1
VarName = nlreg.InputVariableName(Index)
Next
'
' Get index numbers for the input variables.
'
Xindex = nlreg.InputVariableFind("x")
Yindex = nlreg.InputVariableFind("y")
'
' Provide a set of x,y data values.
'
Status = nlreg.SetDataRows(5)
Status = nlreg.SetDataValue(0, Xindex, 1#)
Status = nlreg.SetDataValue(0, Yindex, 3#)
Status = nlreg.SetDataValue(1, Xindex, 2#)
Status = nlreg.SetDataValue(1, Yindex, 5#)
Status = nlreg.SetDataValue(2, Xindex, 3#)
Status = nlreg.SetDataValue(2, Yindex, 7.1)
Status = nlreg.SetDataValue(3, Xindex, 4#)
Status = nlreg.SetDataValue(3, Yindex, 8.5)
Status = nlreg.SetDataValue(4, Xindex, 5#)
Status = nlreg.SetDataValue(4, Yindex, 11.2)
'
' Perform the regression analysis.
'
Status = nlreg.Compute()
If (Status < 0) Then
' Some sort of error occurred during the analysis.
Report = nlreg.GetAnalysisReport(0)
Stop
End If
'
' Get the report from the analysis.
'
Report = nlreg.GetAnalysisReport(0)
'
' Get the computed values of the 'a' and 'b' parameters.
'
Aindex = nlreg.ParameterFind("a")
Bindex = nlreg.ParameterFind("b")
Avalue = nlreg.ParameterValue(Aindex, 0)
Bvalue = nlreg.ParameterValue(Bindex, 0)
'
' Use the fitted function to predict some y values given x values.
'
Status = nlreg.SetEvaluationValue(Xindex, 5#)
PredictedY = nlreg.EvaluateFunction(0)
Status = nlreg.SetEvaluationValue(Xindex, 6.5)
PredictedY = nlreg.EvaluateFunction(0)
'
' Get the proportion of variance explained (R^2) for the model.
'
Rsquared = nlreg.GetStatistic(6)
'
' End of program
'
End Sub
Return to NLREG home page
Download demonstration copy of NLREG.
Download manuals for NLREG.
Purchase NLREG.
DTREG Decision Tree building software.
|