--- title: Combined Regression output: rmarkdown::html_vignette vignette: > %\VignetteIndexEntry{vignette} %\VignetteEncoding{UTF-8} %\VignetteEngine{knitr::rmarkdown} editor_options: chunk_output_type: console --- ```{r setup, include=FALSE} knitr::opts_chunk$set(echo = TRUE) ``` ## Introduction It is considered bad statistical practice to dichotomise continuous outcomes, but some applications require predicted probabilities rather than predicted values. To obtain predicted values, we recommend to model the original continuous outcome with *linear regression*. To obtain predicted probabilities, we recommend not to model the artificial binary outcome with *logistic regression*, but to model the original continuous outcome and the artificial binary outcome with *combined regression*. ## Installation Install the current release from [CRAN](https://CRAN.R-project.org/package=cornet): ```{r,eval=FALSE} install.packages("cornet") ``` Or install the development version from [GitHub](https://github.com/rauschenberger/cornet): ```{r,eval=FALSE} #install.packages("devtools") devtools::install_github("rauschenberger/cornet") ``` Then load and attach the package: ```{r} library(cornet) ``` ## Example We simulate data for $n$ samples and $p$ features, in a high-dimensional setting ($p \gg n$). The matrix $\boldsymbol{X}$ with $n$ rows and $p$ columns represents the features, and the vector $\boldsymbol{y}$ of length $n$ represents the continuous outcome. ```{r,eval=FALSE} set.seed(1) n <- 100; p <- 500 X <- matrix(rnorm(n*p),nrow=n,ncol=p) beta <- rbinom(n=p,size=1,prob=0.05) y <- rnorm(n=n,mean=X%*%beta) ``` We use the function `cornet` for modelling the original continuous outcome and the artificial binary outcome. The argument `cutoff` splits the samples into two groups, those with an outcome less than or equal to the cutoff, and those with an outcome greater than the cutoff. ```{r,eval=FALSE} model <- cornet(y=y,cutoff=0,X=X) model ``` The function `coef` returns the estimated coefficients. The first column is for the linear model (beta), and the second column is for the logistic model (gamma). The first row includes the estimated intercepts, and the other rows include the estimated slopes. ```{r,eval=FALSE} coef <- coef(model) ``` The function `predict` returns fitted values for training data, or predicted values for testing data. The argument `newx` specifies the feature matrix. The output is a matrix with one column for each model. ```{r,eval=FALSE} predict <- predict(model,newx=X) ``` The function `cv.cornet` measures the predictive performance of combined regression by nested cross-validation, in comparison with logistic regression. ```{r,eval=FALSE} cv.cornet(y=y,cutoff=0,X=X) ``` Here we observe that combined regression outperforms logistic regression (lower logistic deviance), and that logistic regression is only slightly better than the intercept-only model. # References Armin Rauschenberger [![AR](https://info.orcid.org/wp-content/uploads/2019/11/orcid_16x16.png)](https://orcid.org/0000-0001-6498-4801) and Enrico Glaab [![EG](https://info.orcid.org/wp-content/uploads/2019/11/orcid_16x16.png)](https://orcid.org/0000-0003-3977-7469) (2024). "Predicting dichotomised outcomes from high-dimensional data in biomedicine". *Journal of Applied Statistics* 51(9):1756-1771. [doi: 10.1080/02664763.2023.2233057](https://doi.org/10.1080/02664763.2023.2233057)