knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)

minP.lm

R-CMD-check

The goal of minP.lm is to test the null hypothesis of treatment equal to zero with minP test under the setting of the linear models.

Installation

You can install the released version of minP.lm from CRAN with:

library(devtools)
install_github("zdz0610/minP.lm", force = TRUE)
library(minP.lm)

Example

This is a basic example which shows you how to solve a common problem:

library(minP.lm)
## basic example code
n_sim=10000#number of simulations

parallel_state=TRUE#whether to use the parallel function (Default is False)

random_seed=123 #specify a random seed to reproduce the results (Default seed is 123)

beta_0=0.5  #coefficient of the treatment

beta_1=2    #coefficient of the covariate 1

beta_2=6    #cofficient of the covariate 2

mu=0    #the overall mean response

sigma=1 #standard error of the error term

na=40   #number of patients in the control

nb=40   #number of patients in the treatment

permuted=FALSE  #whether use the permutation algorithm (Default is FALSE)
#simulated data generation

data1<-simulation_zhang(n_sim=n_sim,parallel_state=parallel_state,
                        random_seed=random_seed,beta_0=beta_0,beta_1=beta_1,
                        beta_2=beta_2,mu=mu,sigma=sigma,na=na,nb=nb,
                        permuted=permuted)
#summarize the data by power, Pearson correlation coefficient, and the 
#Proprotion of minP choosing model 1
# 0.0242 is found by the summarize_type1() under the null beta_0=0
summarize_power(data1,crit_val=0.0242,signi_level=0.05,permuted=F)
summarize_corr(data1)
summarize_proportion(data1)


zdz0610/minP.lm documentation built on Dec. 23, 2021, 9:15 p.m.