n.par | R Documentation |
n.par
returns the number of regression parameters, covariates and observations present in X based on the selected family.
n.par(X, family = c("gaussian", "binomial", "survival"))
X |
design matrix of dimension |
family |
a description of the error distribution used to specify the model. This should be a character string, either “ |
orig.names
and covar.names
are the same if the all covariates in X
are continuous. However, if there are at least one categorical variable in X
with more than two categories, they are different.
n.par
returns a list containing the following components:
n.reg.par |
the number of regression parameters; |
n.covar |
the number of covariates; |
n.sample |
the number of samples/observations; |
orig.names |
the original variable names excluding dummy variable names; |
covar.names |
the variables names, including any dummy variable names (if applicable). |
Hassan Pazira
Maintainer: Hassan Pazira hassan.pazira@radboudumc.nl
#--------------------
# family = "gaussian"
#--------------------
X0 <- data.frame(x1 = rnorm(50), # standard normal variable
x2 = sample(0:2, 50, replace=TRUE), # categorical variable
x3 = sample(0:1, 50, replace=TRUE)) # dichotomous variable
n.par(X0) # without dummy variables
X0$x2 <- as.factor(X0$x2)
X0$x3 <- as.factor(X0$x3)
n.par(X0) # with dummy variables
X1 <- data.frame(Intercept = rep(1,30),
x1 = rnorm(30), # continuous variable
x2 = sample(0:2, 30, replace=TRUE)) # categorical variable
n.par(X1) # without dummy variables
X1$x2 <- as.factor(X1$x2)
n.par(X1) # without dummy variables
# a list of two data sets:
X01 <- list(X0, X1)
n.par(X01)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.