reg_x | R Documentation |
Build general linear model, generalized linear model, cox regression model with only one dependent variables.
reg_x( data = NULL, x = NULL, y = NULL, cov = NULL, factors = NULL, model = NULL, time = NULL, cov_show = FALSE, detail_show = FALSE, confint_glm = "default", save_to_file = NULL )
data |
A data.frame to build the regression model. |
x |
Integer column indices or names of the variables to be included in univariate analysis. If |
y |
Integer column indice or name of dependent variable, only one integer or character |
cov |
Integer column indices or name of covariate variables |
factors |
Integer column indices or names of variables to be treated as factor |
model |
regression model, see |
time |
Integer column indices or name of survival time, used in cox regression, see |
cov_show |
A logical, whether to create covariates result, default FALSE |
detail_show |
A logical, whether to create each regression result, default FALSE. If TRUE with many regressions, the return result could be very large. |
confint_glm |
A character, 'default' or 'profile'. The default method for 'glm' class to compute confidence intervals assumes asymptotic normality |
save_to_file |
A character, containing file name or path |
If detail_show is TRUE, the return result is a list including two components, the first part is a detailed analysis result, the second part is a concentrated result in a data.frame. Otherwise, only return concentrated result in a data.frame.
reg_glm<-reg(data = diabetes, x = c(1:4, 6), y = 5, factors = c(1, 3, 4), model = 'glm') ## subset result like a list reg_glm$detail reg_glm$dataframe reg_glm[2] reg_glm$detail[2:4] ## other methods fit<-reg(data = diabetes, x = c(1, 3:6), y = "age", factors = c(1, 3, 4), model = 'lm') fit<-reg(data = diabetes, x = c( "sex","education","BMI"), y = "diabetes", time ="age", factors = c("sex","smoking","education"), model = 'coxph')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.