Greg: Regression Helper Functions

Methods for manipulating regression models and for describing these in a style adapted for medical journals. Contains functions for generating an HTML table with crude and adjusted estimates, plotting hazard ratio, plotting model estimates and confidence intervals using forest plots, extending this to comparing multiple models in a single forest plots. In addition to the descriptives methods, there are addons for the robust covariance matrix provided by the sandwich package, a function for adding non-linearities to a model, and a wrapper around the Epi package's Lexis functions for time-spliting a dataset when modeling non-proportional hazards in Cox regressions.

Install the latest version of this package by entering the following in R:
AuthorMax Gordon [aut, cre], Reinhard Seifert [aut] (Author of original plotHR)
Date of publication2016-03-28 23:24:58
MaintainerMax Gordon <>
LicenseGPL (>= 3)

View on CRAN

Man pages

addNonlinearity: Add a nonlinear function to the model

bread.ols: Getting the bread for the vcovHC

caDescribeOpts: A function for gathering all the description options

confint.ols: A confint function for the ols

confint_robust: The confint function adapted for vcovHC

estfun.ols: Fix for the Extract Empirical Estimating Functions

forestplotCombineRegrObj: Compares different scores in different regression objects.

forestplotRegrObj: Forest plot for multiple models

GetCoefAndCI: Get the confidence intervals

getCrudeAndAdjustedModelData: This function helps with printing regression models

getModelData4Forestplot: Get model data

Greg-package: Regression Helper Functions

hatvalues.ols: Get the hat matrix for the OLS

isFitFn: Functions for checking regression type

model.matrix.ols: A fix for the model.matrix

plotHR: Plot a spline in a Cox regression model

prCaAddRefAndStat: Add reference according to the model

prCaAddReference: Adds a reference to value matrix

prCaAddUserReferences: Adds references

prCaGetImputationCols: Function for retrieving the imputation arguments

prCaGetRowname: Gets the labelled rowname if it exists

prCaGetVnStats: Gets the variable stats

prCaPrepareCrudeAndAdjusted: Prettify the text

prCaReorder: Reorder according to the requested variables

prCaReorderReferenceDescribe: Adds the ordering, references, and descriptions

prCaSelectAndOrderVars: Re-order variables

prCaSetRownames: Sets the rownames of the reordered_groups

prClearPCAclass: Removes the printCrudeAndAdjusted class from arguments

prConvertShowMissing: A functuon for converting a useNA variable

prEnvModelCall: Runs an 'fastDoCall' within the environment of the model

prExtractOutcomeFromModel: Get model outcome

prFindRownameMatches: Looks for unique rowname match without grep

prGetFpDataFromFit: Gets the confidence interval, p-values, coefficients from a...

prGetFpDataFromGlmFit: Gets the boundaries for a GLM fit that is poisson or...

prGetFpDataFromSurvivalFit: Gets the boundaries for a survival fit

prGetModelData: Get model data.frame

prGetModelVariables: Get the models variables

prGetStatistics: Get statistics according to the type

printCrudeAndAdjustedModel: Output crude and adjusted model data

prMapVariable2Name: A function that tries to resolve what variable corresponds to...

prNlChooseDf: Chooses the degrees of freedom for the non-linearity

prPhConfIntPlot: Plots the confidence intervals

prPhDensityPlot: Plot a density on the datapoints

prPhEstimate: Gets the non-linear function's estimate

prPhNewData: A function for retrieving new_data argument for predict

prPhRugPlot: Plot a rug on the datapoints

prPrintCAstring: Prep for printing

robcov_alt: Robust covariance matrix based upon the sandwich-package

SimpleRmsAnova: A simpler latex output of the latex.anova.rms

timeSplitter: A function for splitting a time according to time periods


addNonlinearity Man page
addNonlinearity.negbin Man page
bread.ols Man page
caDescribeOpts Man page
cbind.printCrudeAndAdjusted Man page
confint.ols Man page
confint_robust Man page
estfun.ols Man page
forestplotCombineRegrObj Man page
forestplotRegrObj Man page
fpBoxSize Man page
getCrudeAndAdjustedModelData Man page
[.getCrudeAndAdjustedModelData Man page
getModelData4Forestplot Man page
Greg-package Man page
hatvalues.ols Man page
htmlTable.printCrudeAndAdjusted Man page
isFitCoxPH Man page
isFitLogit Man page
knit_print.printCrudeAndAdjusted Man page
latex.printCrudeAndAdjusted Man page
model.matrix.ols Man page
plotHR Man page
prCaAddRefAndStat Man page
prCaAddReference Man page
prCaAddUserReferences Man page
prCaDefaultGetCoefAndCI Man page
prCaGetImputationCols Man page
prCaGetRowname Man page
prCaGetVnStats Man page
prCaPrepareCrudeAndAdjusted Man page
prCaReorder Man page
prCaReorderReferenceDescribe Man page
prCaRmsGetCoefAndCI Man page
prCaSelectAndOrderVars Man page
prCaSetRownames Man page
prClearPCAclass Man page
prConvertShowMissing Man page
prEnvModelCall Man page
prExtractOutcomeFromModel Man page
prFindRownameMatches Man page
prGetFpDataFromFit Man page
prGetFpDataFromGlmFit Man page
prGetFpDataFromSurvivalFit Man page
prGetModelData Man page
prGetModelVariables Man page
prGetStatistics Man page
[.printCrudeAndAdjusted Man page
printCrudeAndAdjustedModel Man page
print.printCrudeAndAdjusted Man page
print.simpleRmsAnova Man page
prMapVariable2Name Man page
prNlChooseDf Man page
prPhConfIntPlot Man page
prPhDensityPlot Man page
prPhEstimate Man page
prPhNewData Man page
prPhRugPlot Man page
prPrintCAstring Man page
rbind.printCrudeAndAdjusted Man page
robcov_alt Man page
simpleRmsAnova Man page
timeSplitter Man page


inst/examples/printCrudeAndAdjustedModel_example.R inst/examples/plotHR_example.R inst/examples/forestplotRegrObj_example.R inst/examples/getCphRegrObjData_example.R inst/examples/timeSplitter_example.R inst/examples/simpleRmsAnova_example.R inst/examples/addNonlinearity_example.R inst/examples/printSimpleFit_example.R inst/examples/rms_SandwichAddon_example.R inst/examples/getCrudeAndAdjustedModelData_example.R inst/examples/isFitLogit_example.R inst/examples/forestplotCombineRegrObj_example.R inst/examples/isFitCoxPH_example.R inst/examples/confint_robust_example.R
inst/doc/Print_crude_and_adjusted_models.R inst/doc/timeSplitter.R
tests/test-interval-timeSplitter.R tests/test-nonlin_4_coxph.R tests/testthat.R
tests/testthat/test-plotHR.R tests/testthat/test-addNonlinearity.R tests/testthat/test-private_functions.R tests/testthat/test-getCrudeAndAdjustedModelData.R tests/testthat/test-simpleRmsAnova.R tests/testthat/test-forestplotRegrObj.R tests/testthat/test-confint_robust.R tests/testthat/test-printCrudeAndAdjustedModel.R tests/testthat/test-fit.mult.impute-C&A.R tests/testthat/test-isFit.R tests/testthat/test-timeSplitter.R tests/testthat/test-forestplotCombineRegrObj.R
R/isFitCoxPH.R R/confint_robust.R R/simpleRmsAnova.R R/forestplotRegrObj.R R/rms_SandwichAddon.R R/getModelData4Forestplot.R R/getCrudeAndAdjustedModelData.rms.R R/printCrudeAndAdjustedModel.R R/private_printCaA.R R/forestplotCombineRegrObj.R R/addNonlinearity.R R/private_functions.R R/private_plotHR.R R/plotHR.R R/private_getCaA.R R/isFitLogit.R R/Greg.R R/timeSplitter.R R/getCrudeAndAdjustedModelData.R
man/prGetFpDataFromSurvivalFit.Rd man/timeSplitter.Rd man/prCaAddRefAndStat.Rd man/SimpleRmsAnova.Rd man/prCaPrepareCrudeAndAdjusted.Rd man/bread.ols.Rd man/prPhDensityPlot.Rd man/prEnvModelCall.Rd man/prGetModelData.Rd man/prGetFpDataFromFit.Rd man/prFindRownameMatches.Rd man/prPhEstimate.Rd man/prCaSelectAndOrderVars.Rd man/prCaReorder.Rd man/prPhNewData.Rd man/model.matrix.ols.Rd man/prCaAddReference.Rd man/prClearPCAclass.Rd man/prGetStatistics.Rd man/plotHR.Rd man/forestplotRegrObj.Rd man/prCaAddUserReferences.Rd man/prPrintCAstring.Rd man/prMapVariable2Name.Rd man/isFitFn.Rd man/estfun.ols.Rd man/prCaReorderReferenceDescribe.Rd man/prCaSetRownames.Rd man/Greg-package.Rd man/getCrudeAndAdjustedModelData.Rd man/addNonlinearity.Rd man/caDescribeOpts.Rd man/forestplotCombineRegrObj.Rd man/getModelData4Forestplot.Rd man/confint.ols.Rd man/prExtractOutcomeFromModel.Rd man/prGetFpDataFromGlmFit.Rd man/prCaGetVnStats.Rd man/prNlChooseDf.Rd man/prGetModelVariables.Rd man/printCrudeAndAdjustedModel.Rd man/prCaGetRowname.Rd man/prConvertShowMissing.Rd man/confint_robust.Rd man/robcov_alt.Rd man/prPhRugPlot.Rd man/prPhConfIntPlot.Rd man/hatvalues.ols.Rd man/prCaGetImputationCols.Rd man/GetCoefAndCI.Rd

Questions? Problems? Suggestions? or email at

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.