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 n \times p, where n is the number of samples observed, and p is the number of predictors/covariables. It could be a matrix or a list of matrices.

family

a description of the error distribution used to specify the model. This should be a character string, either “gaussian”, “binomial”, or “survival”. Can be abbreviated. By default the gaussian family is used.

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)


[Package BFI version 2.0.1 Index]