View source: R/ormPredictionplot.R

predict_with_ci | R Documentation |

returns a `data.frame`

object similar to the `Predict`

however it adds a column dependent that lists all factor levels with
appropriate confidence intervals calculated for each level. It is similar to
`predict.lrm`

with `type="fitted.ind"`

but also generates
selected confidence intervals.

```
predict_with_ci(
x,
...,
np = 100,
fun = stats::plogis,
conf.int = 0.95,
boot.type = "bca"
)
```

`x` |
an object created by |

`...` |
One or more variables to vary, or single-valued adjustment values.
Specify a variable name without an equal sign to use the default
display range, or any range
you choose (e.g. |

`np` |
the number of equally-spaced points computed for continuous
predictors that vary, i.e., when the specified value is |

`fun` |
an optional transformation of the linear predictor.
Specify |

`conf.int` |
confidence level (highest posterior density interval probability for
Bayesian models). Default is 0.95. Specify |

`boot.type` |
set to |

a `data.frame`

`Predict`

,`orm`

, `predict.lrm`

```
set.seed(123)
#load the libraries
library(rms)
library(ormPlot)
#make the datadist
dd<-rms::datadist(educ_data)
options(datadist="dd")
#create the model
cran_model <- orm(educ_3 ~ Rural + sex + max_SEP_3 + cran_rzs, data = educ_data)
#get the predictions of the orm model with confidence intervals for all levels
predictiondf<-predict_with_ci(cran_model, cran_rzs, Rural, sex, max_SEP_3)
#show the predictions head
head(predictiondf)
#get the predictions of the orm model with confidence intervals for sex only
predictiondf_sex<-predict_with_ci(cran_model, sex)
#show the predictions head
head(predictiondf_sex)
```

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.