({{, (RefLink[ProbitModelFit, paclet:ref/ProbitModelFit])[{(Subscript[y, 1]),(Subscript[y, 2]),…},{(Subscript[f, 1]),(Subscript[f, 2]),…},x] 
constructs a binomial probit regression model of the form (1/2) (1+erf(((Subscript[β, 0])+(Subscript[β, 1])(Subscript[f, 1]) +(Subscript[β, 2])(Subscript[f, 2]) +⋯)/(Sqrt[2]))) that fits the (Subscript[y, i]) for successive x values 1, 2, ….}, {, (RefLink[ProbitModelFit, paclet:ref/ProbitModelFit])[{{(Subscript[x, 11]),(Subscript[x, 12]),…,(Subscript[y, 1])},{(Subscript[x, 21]),(Subscript[x, 22]),…,(Subscript[y, 2])},…},{(Subscript[f, 1]),(Subscript[f, 2]),…},{(Subscript[x, 1]),(Subscript[x, 2]),…}]
constructs a binomial probit regression model of the form (1/2) (1+erf(((Subscript[β, 0])+(Subscript[β, 1])(Subscript[f, 1]) +(Subscript[β, 2])(Subscript[f, 2]) +⋯)/(Sqrt[2]))) where the (Subscript[f, i]) depend on the variables (Subscript[x, k]).}, {, (RefLink[ProbitModelFit, paclet:ref/ProbitModelFit])[{m,v}]
constructs a binomial probit regression model from the design matrix m and response vector v.}})

OpenersNotesSection(Spacer1)Details and Options

(RefLink[ProbitModelFit, paclet:ref/ProbitModelFit]) returns a symbolic (RefLink[FittedModel, paclet:ref/FittedModel]) object to represent the probit model it constructs. The properties and diagnostics of the model can be obtained from model["property"].

The value of the best-fit function from (RefLink[ProbitModelFit, paclet:ref/ProbitModelFit]) at a particular point (Subscript[x, 1]), … can be found from model[(Subscript[x, 1]),…].

With data in the form {{(Subscript[x, 11]),(Subscript[x, 12]),…,(Subscript[y, 1])},{(Subscript[x, 21]),(Subscript[x, 22]),…,(Subscript[y, 2])},…}, the number of coordinates (Subscript[x, i1]), (Subscript[x, i2]), … should correspond to the number of variables (Subscript[x, i]).

The (Subscript[y, i]) are probabilities between 0 and 1.

Data in the form {(Subscript[y, 1]),(Subscript[y, 2]),…} is equivalent to data in the form {{1,(Subscript[y, 1])},{2,(Subscript[y, 2])},…}.

(RefLink[ProbitModelFit, paclet:ref/ProbitModelFit]) produces a probit model (OverHat[y])=(1/2) (1+erf(((Subscript[β, 0])+(Subscript[β, 1])(Subscript[f, 1]) + (Subscript[β, 2])(Subscript[f, 2])+⋯)/(Sqrt[2]))) under the assumption that the original (Subscript[n, i])(Subscript[(OverHat[y]), i]) are independent observations following binomial distributions with mean (Subscript[n, i])(Subscript[(OverHat[y]), i]).

In (RefLink[ProbitModelFit, paclet:ref/ProbitModelFit])[{m,v}], the design matrix m is formed from the values of basis functions (Subscript[f, i]) at data points in the form {{(Subscript[f, 1]),(Subscript[f, 2]),…},{(Subscript[f, 1]),(Subscript[f, 2]),…},…}. The response vector v is the list of responses {(Subscript[y, 1]),(Subscript[y, 2]),…}.

For a design matrix m and response vector v, the model is (OverHat[v])=(1/2) (1+erf(m.β/(Sqrt[2]))) where β is the vector of parameters to be estimated.

When a design matrix is used, the basis functions (Subscript[f, i]) can be specified using the form (RefLink[ProbitModelFit, paclet:ref/ProbitModelFit])[{m,v},{(Subscript[f, 1]),(Subscript[f, 2]),…}].

(RefLink[ProbitModelFit, paclet:ref/ProbitModelFit]) is equivalent to (RefLink[GeneralizedLinearModelFit, paclet:ref/GeneralizedLinearModelFit]) with (RefLink[ExponentialFamily, paclet:ref/ExponentialFamily])->"Binomial" and (RefLink[LinkFunction, paclet:ref/LinkFunction])->"ProbitLink".

(RefLink[ProbitModelFit, paclet:ref/ProbitModelFit]) takes the same options as (RefLink[GeneralizedLinearModelFit, paclet:ref/GeneralizedLinearModelFit]), with the exception of (RefLink[ExponentialFamily, paclet:ref/ExponentialFamily]) and (RefLink[LinkFunction, paclet:ref/LinkFunction]).

OpenersPrimaryExamplesSection(Spacer1)Examples  (25)

OpenersExampleSection0(Spacer1)Basic Examples  (1)

Define a dataset:

data={{1,0},{1,1},{1,1},{2,0},{2,0},{2,1},{2,1},{2,1},{2,1},{3,1},{3,1},{3,1},{3,1},{3,1}};

Fit a probit model to the data:

probit=ProbitModelFit[data,x,x]

See the functional forms of the model:

Normal[probit]

Evaluate the model at a point:

probit[1.5]

Plot the data points and the models:

Show[ListPlot[data],Plot[probit[x],{x,1,3}],PlotRange->All,AxesOrigin->{.9,-.1}]

Compute the fitted values for the model:

probit["PredictedResponse"]

Visualize the deviance residuals:

ListPlot[probit["DevianceResiduals"]]

OpenersExampleSection1(Spacer1)Scope  (10)

Fit data with success probability responses:

ProbitModelFit[{{1,1/3},{2,4/6},{3,5/5}},x,x]//Normal

Weight by the number of observations for each predictor value:

ProbitModelFit[{{1,1/3},{2,4/6},{3,5/5}},x,x,Weights->{3,6,5}]//Normal

This gives the same best fit function as success failure data:

sfdata={{1,0},{1,1},{1,0},{2,0},{2,0},{2,1},{2,1},{2,1},{2,1},{3,1},{3,1},{3,1},{3,1},{3,1}};
ProbitModelFit[sfdata,x,x] //Normal

Fit a model given a design matrix and response vector:

dm = {{1,1},{1,2},{1,3},{1,4}};
resp = {0,1,0,1};ProbitModelFit[{dm,resp}]

See the functional form:

Normal[%]

Fit the model referring to the basis functions as x and y:

ProbitModelFit[{dm,resp},{x,y}]//Normal

Obtain a list of available properties:

probit=ProbitModelFit[RandomReal[1,10],x,x]

probit["Properties"]

OpenersExampleSubsection0(Spacer1)Properties  (7)

OpenersExampleSubsubsection0(Spacer1)Data & Fitted Functions  (1)

Fit a probit model:

data=Join[RandomReal[10,{10,2}],Transpose[{RandomReal[1,10]}],2];

probit=ProbitModelFit[data,{x,y},{x,y}]

Extract the original data:

probit["Data"]

Obtain and plot the best fit:

{fit = probit["BestFit"],Show[Plot3D[fit,{x,0,10},{y,0,10}],Graphics3D[{PointSize[0.025],Point[probit["Data"]]}]]}

Obtain the fitted function as a pure function:

probit["Function"]

Get the design matrix and response vector for the fitting:

MatrixForm/@probit[{"DesignMatrix","Response"}]

OpenersExampleSubsubsection1(Spacer1)Residuals  (1)

Examine residuals for a fit:

data=Join[RandomReal[10,{100,2}],Transpose[{RandomReal[1,100]}],2];

probit=ProbitModelFit[data,{x,y},{x,y}]

{fr,ar,spr}=probit[{"FitResiduals","StandardizedPearsonResiduals","AnscombeResiduals"}];

Visualize the raw residuals:

ListPlot[fr]

Visualize Anscombe residuals and standardized Pearson residuals in stem plots:

Map[ListPlot[#,Filling->0]&,{ar,spr}]//Row

OpenersExampleSubsubsection2(Spacer1)Dispersion and Deviances  (1)

Fit a probit model to some data:

data=Flatten[Table[{x,y,1/(1+Exp[.2+.3x+.1y+RandomReal[{-1,1}]])},{x,RandomReal[5,10]},{y,RandomReal[5,10]}],1];probit=ProbitModelFit[data,{x,y},{x,y}]

The estimated dispersion is 1 by default:

probit["EstimatedDispersion"]

Use Pearson's (χ^2) as the dispersion estimator instead:

probit["EstimatedDispersion",DispersionEstimatorFunction->"PearsonChiSquare"]

Plot the deviances for each point:

ListPlot[probit["Deviances"],Filling->0]

Obtain the analysis of deviance table:

probit["DevianceTable"]

Get the residual deviances from the table:

probit["DevianceTableResidualDeviances"]

Extract the numeric entries from the table:

vals=probit["DevianceTableEntries"]

Use (RefLink[Grid, paclet:ref/Grid]) to add formatting:

Grid[Join[{{"","d.f.","dev.","res.\nd.f.","res.\ndev."}},Join[{{""},{"x"},{"y"}},Map[PadLeft[#,4,SpanFromLeft]&,vals],2]]]

OpenersExampleSubsubsection3(Spacer1)Parameter Estimation Diagnostics  (1)

Obtain a formatted table of parameter information:

data=Table[{i,RandomInteger[BinomialDistribution[20,.05+i/30+Sin[i]/10]]/20},{i,1,20,.2}];
probit=ProbitModelFit[data,{x,Sin[x],Cos[x]},x];

probit["ParameterTable"]

Extract the column of z-statistic values:

probit["ParameterZStatistics"]

Get the unformatted array of values from the table:

vals=probit["ParameterTableEntries"]

Add formatting using (RefLink[Grid, paclet:ref/Grid]):

Grid[Join[{{f,(OverHat[β]),(OverHat[σ]),z,P[Abs[Z]>Abs[z]]}},Join[{{1},{x},{Sin[x]},{Cos[x]}},vals,2]],Dividers->{GrayLevel[.5],GrayLevel[.5]}]//TraditionalForm

Add formatting via (RefLink[TableForm, paclet:ref/TableForm]):

TableForm[vals,TableHeadings->{{1,(Subscript[f, 1]),(Subscript[f, 2]),(Subscript[f, 3])},{(OverHat[β]),(OverHat[σ]),z,P[Abs[Z]>Abs[z]]}}]//TraditionalForm

OpenersExampleSubsubsection4(Spacer1)Influence Measures  (1)

Fit some data containing extreme values to a probit model:

data=Table[{i,1/2(1+Erf[(2+4i+RandomReal[])/Sqrt[2]])},{i,RandomReal[{1,10},20]}];
data[[{3,8},-1]]=1-data[[{3,8},-1]];
probit=ProbitModelFit[data,x,x]

Check Cook distances to identify highly influential points:

ListPlot[probit["CookDistances"],PlotRange->{0,All},Filling->0]

Check the diagonal elements of the hat matrix to assess influence of points on the fitting:

ListPlot[probit["HatDiagonal"],PlotRange->{0,All},Filling->0]

OpenersExampleSubsubsection5(Spacer1)Prediction Values  (1)

Fit a probit model:

data=Flatten[Table[{x,y,1/(1+Exp[.3x-.5y+RandomReal[{-1,1}]])},{x,RandomReal[5,3]},{y,RandomReal[5,3]}],1];probit=ProbitModelFit[data,{x,y},{x,y}]

Plot the predicted values against the observed values:

ListPlot[Transpose[probit[{"Response","PredictedResponse"}]],FrameLabel->{"observed","predicted"},Frame->True,Axes->False]

OpenersExampleSubsubsection6(Spacer1)Goodness-of-Fit Measures  (1)

Obtain a table of goodness-of-fit measures for a probit model:

data=Flatten[Table[{i,j,RandomReal[],1/2(1+Erf[(.2+.3i+j+RandomReal[])/Sqrt[2]])},{i,RandomReal[1,5]},{j,RandomReal[1,5]}],1];

probit=ProbitModelFit[data,{x,y,z},{x,y,z}]

Grid[Transpose[{#,probit[#]}&[{"AIC","BIC","LikelihoodRatioIndex","PearsonChiSquare"}]],Alignment->Left]

Compute goodness-of-fit measures for all subsets of predictor variables:

sub=Table[Join[{i},ProbitModelFit[data,i,{x,y,z}][{"AIC","BIC","LikelihoodRatioIndex","PearsonChiSquare"}]],{i,Subsets[{x,y,z}]}]

Rank the models by AIC:

Grid[Join[{{"Model","AIC","BIC","LikelihoodRatioIndex","PearsonChiSquare"}},SortBy[sub,-#[[2]]&]]]

OpenersExampleSection2(Spacer1)Generalizations & Extensions  (1)

Perform other mathematical operations on the functional form of the model:

probit=ProbitModelFit[Table[{i,RandomReal[{i-1,i}]/10},{i,10}],x,x]

Integrate symbolically and numerically:

Integrate[probit[x],x]

NIntegrate[probit[x],{x,1,5}]

Find a predictor value that gives a particular value for the model:

FindRoot[probit[x]==.5,{x,5}]

OpenersExampleSection3(Spacer1)Options  (8)

OpenersExampleSubsection1(Spacer1)ConfidenceLevel  (1)

The default gives 95% confidence intervals:

data={{0,1},{1,0},{3,1},{5,0}};

probit=ProbitModelFit[data,x,x]

probit["ParameterConfidenceIntervals"]

Use 99% intervals instead:

probit=ProbitModelFit[data,x,x,ConfidenceLevel->.99]

probit["ParameterConfidenceIntervals"]

Set the level to 90% within (RefLink[FittedModel, paclet:ref/FittedModel]):

probit["ParameterConfidenceIntervals",ConfidenceLevel->.9]

OpenersExampleSubsection2(Spacer1)CovarianceEstimatorFunction  (1)

Fit a probit model:

data={{0,1},{1,0},{3,1},{5,0}};

probit=ProbitModelFit[data,x,x]

Compute the covariance matrix using the expected information matrix:

probit["CovarianceMatrix"]

Use the observed information matrix instead:

probit["CovarianceMatrix",CovarianceEstimatorFunction->"ObservedInformation"]

OpenersExampleSubsection3(Spacer1)DispersionEstimatorFunction  (1)

Fit a probit model:

data={{1,0},{1,1},{1,1},{2,0},{2,0},{2,1},{2,1},{2,1},{2,1}};

probit=ProbitModelFit[data,x,x]

Compute the covariance matrix:

probit["CovarianceMatrix"]

Compute the covariance matrix estimating the dispersion by Pearson's (χ^2):

probit["CovarianceMatrix",DispersionEstimatorFunction->"PearsonChiSquare"]

OpenersExampleSubsection4(Spacer1)IncludeConstantBasis  (1)

Fit a probit model:

data={{0,1},{1,0},{3,1},{5,0}};

ProbitModelFit[data,x,x]//Normal

Fit the model with zero constant term:

ProbitModelFit[data,x,x,IncludeConstantBasis->False]//Normal

OpenersExampleSubsection5(Spacer1)LinearOffsetFunction  (1)

Fit data to a probit model:

data={{0,1},{1,0},{3,1},{5,0}};

ProbitModelFit[data,x,x]//Normal

Fit data to a model with a known (RefLink[Sqrt, paclet:ref/Sqrt])[x] term:

ProbitModelFit[data,x,x,LinearOffsetFunction->(Sqrt[#]&)]//Normal

OpenersExampleSubsection6(Spacer1)NominalVariables  (1)

data={{a,0,0},{b,2,1},{a,2,0},{b,0,1},{a,2,1},{b,0,0}};

Fit the data, treating the first variable as a nominal variable:

nom=ProbitModelFit[data,{x,y},{x,y},NominalVariables->x]

Normal[nom]

Treat both variables as nominal:

ProbitModelFit[data,{x,y},{x,y},NominalVariables->All]//Normal

OpenersExampleSubsection7(Spacer1)Weights  (1)

Fit a model using equal weights:

data={{0,1},{1,0},{3,1},{5,0}};

ProbitModelFit[data,x,x]//Normal

Give explicit weights for the data points:

ProbitModelFit[data,x,x,Weights->{1,(1/2),(1/3),(1/4)}]//Normal

OpenersExampleSubsection8(Spacer1)WorkingPrecision  (1)

Use (RefLink[WorkingPrecision, paclet:ref/WorkingPrecision]) to get higher precision in parameter estimates:

data=Table[{x,(10-x)/10},{x,10}]

probit=ProbitModelFit[data,x,x,WorkingPrecision->25]

Obtain the fitted function:

probit["BestFit"]

Reduce the precision in property computations after the fitting:

probit["BestFit",WorkingPrecision->MachinePrecision]

OpenersExampleSection4(Spacer1)Properties & Relations  (4)

(RefLink[ProbitModelFit, paclet:ref/ProbitModelFit]) is equivalent to a "Binomial" model from (RefLink[GeneralizedLinearModelFit, paclet:ref/GeneralizedLinearModelFit]) with "ProbitLink":

data=Table[{i,RandomReal[{i-1,i}]/10},{i,10}];

GeneralizedLinearModelFit[data,x,x,ExponentialFamily->"Binomial",LinkFunction->"ProbitLink"]//Normal

ProbitModelFit[data,x,x]//Normal

(RefLink[LogitModelFit, paclet:ref/LogitModelFit]) is a "Binomial" model from (RefLink[GeneralizedLinearModelFit, paclet:ref/GeneralizedLinearModelFit]) with default "LogitLink":

GeneralizedLinearModelFit[data,x,x,ExponentialFamily->"Binomial"]//Normal

LogitModelFit[data,x,x]//Normal

(RefLink[ProbitModelFit, paclet:ref/ProbitModelFit]) assumes binomially distributed responses:

data=Table[{i,RandomReal[{i-1,i}]/10},{i,10}];

pm=ProbitModelFit[data,x,x]

(RefLink[NonlinearModelFit, paclet:ref/NonlinearModelFit]) assumes normally distributed responses:

nm=NonlinearModelFit[data,1/2(1+Erf[(a+b x)/Sqrt[2]]),Transpose[{{a,b},pm["BestFitParameters"]}],x]

The fits are not identical:

{Normal[pm],Normal[nm]}

Plot[{pm[x],nm[x]},{x,1,5},PlotRange->All]

(RefLink[ProbitModelFit, paclet:ref/ProbitModelFit]) will use the time stamps of a (RefLink[TimeSeries, paclet:ref/TimeSeries]) as variables:

ts1=TimeSeries[];

ts1["Times"]

ProbitModelFit[ts1,x,x]

Rescale the time stamps and fit again:

ts2=TimeSeriesRescale[ts1,{.1,2}]

ts2["Times"]

ProbitModelFit[ts2,x,x]

Find fit for the values:

ProbitModelFit[ts1["Values"],x,x]

(RefLink[ProbitModelFit, paclet:ref/ProbitModelFit]) acts pathwise on a multipath (RefLink[TemporalData, paclet:ref/TemporalData]):

ProbitModelFit[TemporalData[],x,x]

OpenersExampleSection5(Spacer1)Possible Issues  (1)

Responses outside the interval from 0 to 1 are not valid for probit models:

ProbitModelFit[Range[5],x,x]

ProbitModelFit[Table[{i,2i},{i,10}],x,x]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[GeneralizedLinearModelFit, paclet:ref/GeneralizedLinearModelFit])  ▪  (RefLink[LogitModelFit, paclet:ref/LogitModelFit])  ▪  (RefLink[ExponentialFamily, paclet:ref/ExponentialFamily])  ▪  (RefLink[LinkFunction, paclet:ref/LinkFunction])  ▪  (RefLink[TimeSeriesModelFit, paclet:ref/TimeSeriesModelFit])}})}})

({{DocumentationFooterIconsRelatedTutorial.png, ({{Tutorials}, {▪(RefLinkPlain[Statistical Model Analysis, paclet:tutorial/StatisticalModelAnalysis])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Statistical Model Analysis, paclet:guide/StatisticalModelAnalysis])}})}})