createPs creates propensity scores using a regularized logistic regression.

createPs(cohortMethodData, population, excludeCovariateIds = c(),
includeCovariateIds = c(), maxCohortSizeForFitting = 250000,
errorOnHighCorrelation = TRUE, stopOnError = TRUE,
prior = createPrior("laplace", exclude = c(0), useCrossValidation =
TRUE), control = createControl(noiseLevel = "silent", cvType = "auto",
seed = 1, tolerance = 2e-07, cvRepetitions = 10, startingVariance =
0.01))

## Arguments

cohortMethodData An object of type cohortMethodData as generated using getDbCohortMethodData. A data frame describing the population. This should at least have a 'rowId' column corresponding to the rowId column in the cohortMethodData covariates object and a 'treatment' column. If population is not specified, the full population in the cohortMethodData will be used. Exclude these covariates from the propensity model. Include only these covariates in the propensity model. If the target or comparator cohort are larger than this number, they will be downsampled before fitting the propensity model. The model will be used to compute propensity scores for all subjects. The purpose of the sampling is to gain speed. Setting this number to 0 means no downsampling will be applied. If true, the function will test each covariate for correlation with the treatment assignment. If any covariate has an unusually high correlation (either positive or negative), this will throw and error. If an error occurrs, should the function stop? Else, the two cohorts will be assumed to be perfectly separable. The prior used to fit the model. See createPrior for details. The control object used to control the cross-validation used to determine the hyperparameters of the prior (if applicable). See createControl for details.

## Details

createPs creates propensity scores using a regularized logistic regression.

## Examples

data(cohortMethodDataSimulationProfile)
cohortMethodData <- simulateCohortMethodData(cohortMethodDataSimulationProfile, n = 1000)#> Generating covariates
#> Generating treatment variable
#> Generating cohorts
#> Generating outcomes after index date
#> Generating outcomes before index dateps <- createPs(cohortMethodData)#> Removing redundant covariates
#> Removing redundant covariates took 0.001 secs
#> Removing infrequent covariates
#> Removing infrequent covariates took 0.0382 secs
#> Normalizing covariates
#> Normalizing covariates took 0.106 secs#> Warning: All coefficients (except maybe the intercept) are zero. Either the covariates are completely uninformative or completely predictive of the treatment. Did you remember to exclude the treatment variables from the covariates?#> Creating propensity scores took 3.04 secs