Package 'scitb'

Title: Provides Some Useful Functions for Making Statistical Tables
Description: You can use the functions provided by the package to make various statistical tables, such as baseline data tables. Creates 'Table 1', i.e., a description of the baseline patient characteristics, which is essential in every medical research. Supports both continuous and categorical variables, as well as p-values and standardized mean differences. This method was described by Mary L McHugh (2013) <doi:10.11613/bm.2013.018>.
Authors: Qiang Liu [aut, cre]
Maintainer: Qiang Liu <[email protected]>
License: GPL-3
Version: 0.2.1
Built: 2024-11-26 06:48:09 UTC
Source: CRAN

Help Index


confnterval

Description

P-values were inferred from confidence intervals.

Usage

confnterval(est = NULL, ratio = NULL, ul = NULL, ll = NULL)

Arguments

est

Enter the effect value.

ratio

Effect ratio values. Includes OR,HR,RR.

ul

The upper limit of the credible interval.

ll

Lower limit of the credible interval.

Details

Limitations of the method:The formula for P is unreliable for very small P values and if your P value is smaller than 0.0001, just report it as P<0.0001.The methods described can be applied in a wide range of settings, including the results from meta-analysis and regression analyses. The main context where they are not correct is small samples where the outcome is continuous and the analysis has been done by a t test or analysis of variance, or the outcome is dichotomous and an exact method has been used for the confidence interval. However, even here the methods will be approximately correct in larger studies with, say, 60 patients or more.

Value

A list of results.

References

Altman DG, Bland JM. How to obtain the P value from a confidence interval. BMJ. 2011;343:d2304. doi: 10.1136/bmj.d2304. PMID: 22803193.

Examples

confnterval(est=0.05917381,ul=0.06756194,ll=0.05091284)

Maddala.Cox.Snell

Description

Maddala Cox Snell in the computational model.

Usage

Maddala.Cox.Snell(fit)

Arguments

fit

Your model. Support logistic regression and Cox regression.

Value

Maddala Cox Snell.

#'@details The outcome variables in the model must be represented using 0 and 1. Among them, 1 represents the occurrence of the event.

References

Riley RD, Ensor J, Snell KIE, Harrell FE, Martin GP, Reitsma JB, et al. Calculating the sample size required for developing a clinical prediction model. BMJ (Clinical research ed). 2020


plotsmd

Description

You can use it to draw a baseline table of data.

Usage

plotsmd(vars,unmatchdata,matchdata,refline=NULL,title=NULL,xlab='SMD',ylab='variable')

Arguments

vars

List the variables you need to compare.

unmatchdata

Data before conducting propensity matching.

matchdata

The data after propensity score matching.

refline

Set a reference line with a default value of 0.1.

title

The title of the image.

xlab

The name of the X-axis.

ylab

The name of the Y-axis.

Details

The differences between variables can be represented using SMD. This program can draw SMD graphs of variable differences.

Value

A picture.


A data on indicators for premature newborns.

Description

A data on indicators for premature newborns.

Usage

data(prematurity)

Format

An object of class data.frame with 189 rows and 11 columns.

Examples

data(prematurity)

sci1freq

Description

You can use it to draw a baseline table of data.Creates 'Table 1', i.e., description of baseline patient characteristics, which is essential in every medical research. Supports both continuous and categorical variables, as well as p-values and standardized mean differences.

Arguments

mvars

The full range of variables you don't want to compare.

x

Enter the variables to be layered. If you fill in consecutive variables, by default they will be split into 3 layers.

data

Enter your data.

dec

The precision of the data, which defaults to 2 decimal places.

nonnormal

When the data belongs to a non-normal distribution, this parameter is needed to indicate which is variable is non-normally distributed.

statistic

Statistical effect values. Usually, it is the default F, and selecting T will return a statistical effect value.

fisher

Fisher's exact test. The default is FALSE.

correct

Chi square test for continuity correction.The default is FALSE.

Overall

Generate summary data.The default is FALSE.

smd

The default is FALSE. If it is true, return the SMD value.

Details

Table 1 represents the relationship between the baseline values of the data. This function can be easily done.

Value

A data frame.


sci1mean

Description

You can use it to draw a baseline table of data.Creates 'Table 1', i.e., description of baseline patient characteristics, which is essential in every medical research. Supports both continuous and categorical variables, as well as p-values and standardized mean differences.

Arguments

mvars

The full range of variables you don't want to compare.

x

Enter the variables to be layered. If you fill in consecutive variables, by default they will be split into 3 layers.

data

Enter your data.

dec

The precision of the data, which defaults to 2 decimal places.

nonnormal

When the data belongs to a non-normal distribution, this parameter is needed to indicate which is variable is non-normally distributed.

type

The type of encoding generally does not require input.

statistic

Statistical effect values. Usually, it is the default F, and selecting T will return a statistical effect value.

atotest

Check if the data is normally distributed. The default is T.

NormalTest

A method for detecting whether data is normally distributed.The default values are Kolmogorov Smirnov test and Kolmogorov Smirnov test.Other options are: "ad", "cvm", "pearson".

Overall

Generate summary data.The default is FALSE.

smd

The default is FALSE. If it is true, return the SMD value.

Details

Table 1 represents the relationship between the baseline values of the data. This function can be easily done.

Value

A data frame.


scitb1

Description

You can use it to draw a baseline table of data.

Usage

scitb1(vars,fvars=NULL,strata,data,dec,num,nonnormal=NULL,type=NULL,
statistic=F,atotest=T,NormalTest=NULL,fisher=FALSE,correct=FALSE,Overall=FALSE,smd=FALSE)

Arguments

vars

The full range of variables you don't want to compare.

fvars

Define the categorical variables in your data.

strata

Enter the variables to be layered. If you fill in consecutive variables, by default they will be split into 3 layers.

data

Enter your data.

dec

The precision of the data, which defaults to 2 decimal places.

num

When continuous variables are layered, use it to control the number of layers, which defaults to 3.

nonnormal

When the data belongs to a non-normal distribution, this parameter is needed to indicate which is variable is non-normally distributed.

type

The type of encoding generally does not require input.Contains three types: "A", "B", and "C".

statistic

Statistical effect values. Usually, it is the default F, and selecting T will return a statistical effect value.

atotest

Check if the data is normally distributed. The default is T.

NormalTest

A method for detecting whether data is normally distributed.The default values are Kolmogorov Smirnov test and Kolmogorov Smirnov test.Other options are: "ad", "cvm", "pearson".

fisher

Fisher's exact test. The default is FALSE.

correct

Chi square test for continuity correction.The default is FALSE.

Overall

Generate summary data.The default is FALSE.

smd

The default is FALSE. If it is true, return the SMD value.

Details

Table 1 represents the relationship between the baseline values of the data. This function can be easily done.Creates 'Table 1', i.e., description of baseline patient characteristics, which is essential in every medical research. Supports both continuous and categorical variables, as well as p-values and standardized mean differences.

Value

A data frame.

Examples

## Import data
bc<-prematurity
## Hierarchical variables converted to factors.
bc$race<-as.factor(bc$race)
###Define all variables, categorical and stratified.
allVars <-c("age", "lwt",  "smoke", "ptl", "ht", "ui", "ftv", "bwt")
fvars<-c("smoke","ht","ui")
strata<-"race"
out<-scitb1(vars=allVars,fvars=fvars,strata=strata,data=bc)
out<-scitb1(vars=allVars,fvars=fvars,strata=strata,data=bc,statistic=TRUE)
out<-scitb1(vars=allVars,fvars=fvars,strata=strata,data=bc,statistic=TRUE,Overall=TRUE)
out<-scitb1(vars=allVars,fvars=fvars,strata=strata,data=bc,statistic=TRUE,Overall=TRUE,smd=TRUE)
print(out)

###Stratified variables are continuous variables.
allVars <-c("race", "lwt",  "smoke", "ptl", "ht", "ui", "ftv", "bwt")
fvars<-c("smoke","ht","ui","race")
strata<-"age"
out<-scitb1(vars=allVars,fvars=fvars,strata=strata,data=bc)
out<-scitb1(vars=allVars,fvars=fvars,strata=strata,data=bc,statistic=TRUE)
out<-scitb1(vars=allVars,fvars=fvars,strata=strata,data=bc,statistic=TRUE,Overall=TRUE,smd=TRUE)
print(out)