Description Usage Arguments Value
View source: R/vwp_compute_pwp_workflow.R
Multinomial logistic regression models require categorical variables to be recoded as a set of dummy variables. This function creates the necessary design matrix and coefficient matrix out of the corresponding data frames, then computes the input win probabilities based on those matrices.
1 | vwp_model_matrix(plays, formula, coef_df, PWP_matrix)
|
plays |
a dv_plays object or data frame containing play-by-play data. |
formula |
a formula object where the left-hand side contains the output variable (should be attack_next) and the right-hand side contains the predictor variables. |
coef_df |
a 9-column data frame where the first column is the name of the (dummy) variable and the remaining columns contain the corresponding coefficients for the multinomial logistic regression model. Currently, columns 2-9 should be labeled OI, ON, OO, OW, TI, TN, TO, TW (respectively) for best compatibility. |
PWP_matrix |
an 8 x 1 matrix containing the modeled point-win probability values for each of the 8 outcomes in the same order as they are listed in columns 2-9 of coef_df. The idea is to take a weighted average of the point-win probability values for each type of next attack, with the weights being the probability of each outcome. This argument is passed directly to 'vwp_input_pwp()'. |
A numeric vector estimating the overall point-win probability of a set of touches.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.