Description Usage Arguments Value Examples

View source: R/Disequilibrium.R

Predict method for class 'DE'

1 2 |

`object` |
An object of class |

`newdata` |
An optional data frame with column names matching the dependent variables specified in
the |

`...` |
Unused |

A data frame is returned. The columns are:

- Y_1
Linear prediction of the outcome variable in equation 1.

- Y_2
Linear prediction of the outcome variable in equation 2.

- Min(Y_1,Y_2)
The minimum of

`Y_1`

and`Y_2`

.- Prob(Y_2>Y_1)
The probability that the outcome variable in equation 2 is greater than the outcome variable in equation 1. This is the probability that

`Y_1`

is the observed quantity. This probability does not account for estimation uncertainty. Also note that all predictions are unconditional on the observed quantity.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | ```
set.seed(1775)
library(MASS)
beta01 = c(1,1)
beta02 = c(-1,-1)
N = 10000
SigmaEps = diag(2)
SigmaX = diag(2)
MuX = c(0,0)
par0 = c(beta01, beta02, SigmaX[1, 1], SigmaX[1, 2], SigmaX[2, 2])
Xgen = mvrnorm(N,MuX,SigmaX)
X1 = cbind(1,Xgen[,1])
X2 = cbind(1,Xgen[,2])
X = list(X1 = X1,X2 = X2)
eps = mvrnorm(N,c(0,0),SigmaEps)
eps1 = eps[,1]
eps2 = eps[,2]
Y1 = X1 %*% beta01 + eps1
Y2 = X2 %*% beta02 + eps2
Y = pmin(Y1,Y2)
df = data.frame(Y = Y, X1 = Xgen[,1], X2 = Xgen[,2])
results = DE(formula = Y ~ X1 | X2, data = df)
head(predict(results))
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.