Skip to contents

Compute Probability of Each True Outcome, for Every Subject

Usage

pi_compute(beta, X, n, n_cat)

Arguments

beta

A numeric column matrix of regression parameters for the Y (true outcome) ~ X (predictor matrix of interest).

X

A numeric design matrix.

n

An integer value specifying the number of observations in the sample. This value should be equal to the number of rows of the design matrix, X.

n_cat

The number of categorical values that the true outcome, Y, can take.

Value

pi_compute returns a matrix of probabilities, \(P(Y_i = j | X_i) = \frac{\exp(X_i \beta)}{1 + \exp(X_i \beta)}\) for each of the \(i = 1, \dots,\) n subjects. Rows of the matrix correspond to each subject. Columns of the matrix correspond to the true outcome categories \(j = 1, \dots,\) n_cat.