n.par {BFI} | R Documentation |
The Number of Predictors, Coefficients, and Observations
Description
n.par
returns the number of regression parameters, covariates and observations present in X based on the selected family.
Usage
n.par(X, family = c("gaussian", "binomial", "survival"))
Arguments
X |
design matrix of dimension |
family |
a description of the error distribution used to specify the model. This should be a character string, either “ |
Details
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.
Value
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 names of the variables (without including the names of dummy variables); |
covar.names |
the names of the variables (together with the names of any dummy variables, if applicable). |
Author(s)
Hassan Pazira
Maintainer: Hassan Pazira hassan.pazira@radboudumc.nl
Examples
#--------------------
# 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)