createGlmModel | R Documentation |
Create a generalized linear model that can be used in the PatientLevelPrediction package.
createGlmModel(
coefficients,
intercept = 0,
mapping = "logistic",
targetId = NULL,
outcomeId = NULL,
populationSettings = createStudyPopulationSettings(),
restrictPlpDataSettings = createRestrictPlpDataSettings(),
covariateSettings = FeatureExtraction::createDefaultCovariateSettings(),
featureEngineering = NULL,
tidyCovariates = NULL,
requireDenseMatrix = FALSE
)
coefficients |
A dataframe containing two columns, coefficients and
covariateId, both of type numeric. The covariateId column must contain
valid covariateIds that match those used in the |
intercept |
A numeric value representing the intercept of the model. |
mapping |
A string representing the mapping from the linear predictors to outcome probabilities. For generalized linear models this is the inverse of the link function. Supported values is only "logistic" for logistic regression model at the moment. |
targetId |
Add the development targetId here |
outcomeId |
Add the development outcomeId here |
populationSettings |
Add development population settings (this includes the time-at-risk settings). |
restrictPlpDataSettings |
Add development restriction settings |
covariateSettings |
Add the covariate settings here to specify how the model covariates are created from the OMOP CDM |
featureEngineering |
Add any feature engineering here (e.g., if you need to modify the covariates before applying the model) This is a list of lists containing a string named funct specifying the engineering function to call and settings that are inputs to that function. funct must take as input trainData (a plpData object) and settings (a list). |
tidyCovariates |
Add any tidyCovariates mappings here (e.g., if you need to normalize the covariates) |
requireDenseMatrix |
Specify whether the model needs a dense matrix (TRUE or FALSE) |
A model object containing the model (Coefficients and intercept) and the prediction function.
coefficients <- data.frame(
covariateId = c(1002),
coefficient = c(0.05))
model <- createGlmModel(coefficients, intercept = -2.5)
data("simulationProfile")
plpData <- simulatePlpData(simulationProfile, n=50)
prediction <- predictPlp(model, plpData, plpData$cohorts)
# see the predicted risk values
prediction$value
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.