### Calculate sample size with pmsampsize Source: https://cran.r-project.org/web/packages/pmsampsize/refman/pmsampsize.html The pmsampsize function computes the required sample size based on model type, expected performance metrics, and the number of candidate predictors. ```R pmsampsize( type, nagrsquared = NA, csrsquared = NA, rsquared = NA, parameters, shrinkage = 0.9, prevalence = NA, cstatistic = NA, seed = 123456, rate = NA, timepoint = NA, meanfup = NA, intercept = NA, sd = NA, mmoe = 1.1 ) ``` -------------------------------- ### pmsampsize Function Source: https://cran.r-project.org/web/packages/pmsampsize/refman/pmsampsize.html Computes the minimum sample size required for the development of a new multivariable prediction model using the criteria proposed by Riley et al. (2018). ```APIDOC ## pmsampsize - Sample Size for Development of a Prediction Model ### Description `pmsampsize` computes the minimum sample size required for the development of a new multivariable prediction model using the criteria proposed by Riley _et al_. 2018. ### Usage ```R pmsampsize( type, nagrsquared = NA, csrsquared = NA, rsquared = NA, parameters, shrinkage = 0.9, prevalence = NA, cstatistic = NA, seed = 123456, rate = NA, timepoint = NA, meanfup = NA, intercept = NA, sd = NA, mmoe = 1.1 ) ``` ### Parameters * **type** (character) - The type of outcome variable (e.g., "binary", "survival", "continuous"). * **nagrsquared** (numeric) - The R-squared value for the model with the number of predictor variables. * **csrsquared** (numeric) - The R-squared value for the model with the number of predictor variables and the intercept. * **rsquared** (numeric) - The R-squared value for the model. * **parameters** (numeric) - The number of parameters in the prediction model. * **shrinkage** (numeric) - The shrinkage factor applied to the model coefficients. Defaults to 0.9. * **prevalence** (numeric) - The prevalence of the outcome in the population (for binary outcomes). * **cstatistic** (numeric) - The C-statistic of the model (for binary or survival outcomes). * **seed** (numeric) - Seed for random number generation. Defaults to 123456. * **rate** (numeric) - The event rate (for survival outcomes). * **timepoint** (numeric) - The time point of interest (for survival outcomes). * **meanfup** (numeric) - The mean follow-up time (for survival outcomes). * **intercept** (numeric) - The intercept value. * **sd** (numeric) - The standard deviation of the outcome variable (for continuous outcomes). * **mmoe** (numeric) - The minimum mean observed event. Defaults to 1.1. ### Details The function calculates the minimum sample size required for the development of a new multivariable prediction model. It uses criteria proposed by Riley et al. (2018) to minimize overfitting and ensure precise estimation of key parameters. The function supports models with continuous, binary, or survival outcomes. ``` -------------------------------- ### POST /calculate-sample-size Source: https://cran.r-project.org/web/packages/pmsampsize/refman/pmsampsize.html Calculates the required sample size for a prediction model based on the specified outcome type and model performance parameters. ```APIDOC ## POST /calculate-sample-size ### Description Calculates the sample size for a prediction model development study based on the outcome type and expected performance metrics. ### Method POST ### Endpoint /calculate-sample-size ### Parameters #### Request Body - **type** (string) - Required - Specifies the type of analysis: "c" (continuous), "b" (binary), or "s" (survival). - **parameters** (integer) - Required - Number of candidate predictor parameters. - **shrinkage** (float) - Optional - Level of shrinkage desired (default 0.9). - **rsquared** (float) - Optional - Expected R-squared for continuous outcomes. - **nagrsquared** (float) - Optional - Expected Nagelkerke's R-squared for binary or survival outcomes. - **csrsquared** (float) - Optional - Expected Cox-Snell R-squared for binary or survival outcomes. - **prevalence** (float) - Optional - Overall outcome proportion for binary outcomes. - **cstatistic** (float) - Optional - C-statistic for binary outcomes. - **seed** (integer) - Optional - Random-number seed for binary outcome simulations. - **rate** (float) - Optional - Overall event rate for survival outcomes. - **timepoint** (float) - Optional - Timepoint of interest for survival outcomes. - **meanfup** (float) - Optional - Average follow-up time for survival outcomes. ``` -------------------------------- ### Calculate Sample Size for Binary Outcomes (Cox-Snell R-squared) Source: https://cran.r-project.org/web/packages/pmsampsize/refman/pmsampsize.html Use this function to calculate the minimum sample size for a binary outcome prediction model when the Cox-Snell R-squared is known. Requires specifying the number of parameters, outcome prevalence, and the R-squared value. ```R pmsampsize(type = "b", csrsquared = 0.288, parameters = 24, prevalence = 0.174) ``` -------------------------------- ### Calculate Sample Size for Binary Outcomes (C-statistic) Source: https://cran.r-project.org/web/packages/pmsampsize/refman/pmsampsize.html This function calculates the minimum sample size for a binary outcome prediction model using the C-statistic (AUROC) of an existing model to approximate the Cox-Snell R-squared. Requires specifying the number of parameters, outcome prevalence, and the C-statistic. ```R pmsampsize(type = "b", cstatistic = 0.89, parameters = 24, prevalence = 0.174) ``` -------------------------------- ### Calculate sample size for survival outcomes Source: https://cran.r-project.org/web/packages/pmsampsize/refman/pmsampsize.html Estimates sample size for a survival model with 30 predictors, an adjusted R-squared of 0.051, and a 2-year timepoint. ```R pmsampsize(type = "s", csrsquared = 0.051, parameters = 30, rate = 0.065, timepoint = 2, meanfup = 2.07) ``` -------------------------------- ### Calculate sample size for continuous outcomes Source: https://cran.r-project.org/web/packages/pmsampsize/refman/pmsampsize.html Estimates sample size for a linear prediction model with 25 predictors, an adjusted R-squared of 0.2, and specified population mean and SD. ```R pmsampsize(type = "c", rsquared = 0.2, parameters = 25, intercept = 1.9, sd = 0.6) ``` -------------------------------- ### Continuous Outcome Prediction Model Sample Size Source: https://cran.r-project.org/web/packages/pmsampsize/refman/pmsampsize.html Calculates the minimum sample size for developing a multivariable prediction model for a continuous outcome. ```APIDOC ## Continuous Outcome Prediction Model Sample Size ### Description Calculates the minimum sample size required for developing a multivariable prediction model for a continuous outcome. ### Method `pmsampsize` ### Parameters #### Function Arguments - **type** (character) - Specifies the type of outcome. Use "c" for continuous outcomes. - **rsquared** (numeric) - The R-squared adjusted value of an existing prediction model in the same field. - **parameters** (integer) - The number of candidate predictors. - **intercept** (numeric) - The mean of the outcome in the population. - **sd** (numeric) - The standard deviation of the outcome in the population. ### Request Example ```R pmsampsize(type = "c", rsquared = 0.2, parameters = 25, intercept = 1.9, sd = 0.6) ``` ### Response #### Success Response (200) Returns the calculated minimum sample size required. ``` -------------------------------- ### Survival Outcome Prediction Model Sample Size Source: https://cran.r-project.org/web/packages/pmsampsize/refman/pmsampsize.html Calculates the minimum sample size for developing a multivariable prediction model with a survival outcome. ```APIDOC ## Survival Outcome Prediction Model Sample Size ### Description Calculates the minimum sample size required for developing a multivariable prediction model with a survival outcome. ### Method `pmsampsize` ### Parameters #### Function Arguments - **type** (character) - Specifies the type of outcome. Use "s" for survival outcomes. - **csrsquared** (numeric) - The R-squared adjusted value of an existing prediction model in the same field. - **parameters** (integer) - The number of candidate predictors. - **rate** (numeric) - The overall event rate in the population. - **timepoint** (numeric) - The timepoint of interest for prediction. - **meanfup** (numeric) - The mean follow-up time in years. ### Request Example ```R pmsampsize(type = "s", csrsquared = 0.051, parameters = 30, rate = 0.065, timepoint = 2, meanfup = 2.07) ``` ### Response #### Success Response (200) Returns the calculated minimum sample size required. ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.