Learn R Programming

mfp2 (version 1.0.0)

assign_df: Helper to assign degrees of freedom

Description

Determine the number of unique values in a variable. To be used in mfp2().

Usage

assign_df(x, df_default = 4)

Value

Vector of length ncol(x) with degrees of freedom for each variable in x.

Arguments

x

input matrix.

df_default

default df to be used. Default is 4.

Details

Variables with fewer than or equal to three unique values, for example, will be assigned df = 1. df = 2 will be assigned to variables with 4-5 unique values, and df = 4 will be assigned to variables with unique values greater than or equal to 6.

Examples

Run this code
x <- matrix(1:100, nrow = 10)
assign_df(x)

Run the code above in your browser using DataLab