aggr_data: Aggregate data

Description Usage Arguments Value Author(s) Examples

View source: R/aggr_data.R

Description

Given a matrix of configurations (covariates and responses) unit-by-unit, this function finds the corresponding matrix of distinct configurations and the corresponding vector of frequencies (it does not work properly with missing data).

Usage

1
aggr_data(data, disp=FALSE, fort=FALSE)

Arguments

data

matrix of covariate and unit-by-unit response configurations

disp

to display partial results

fort

to use fortran routines when possible

Value

data_dis

matrix of distinct configurations

freq

vector of corresponding frequencies

label

the index of each provided response configuration among the distinct ones

Author(s)

Francesco Bartolucci - University of Perugia (IT)

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
# draw a matrix of random responses and find distinct responses
X = matrix(sample(5,100,replace=TRUE),50,2)
out = aggr_data(X)

# find the distinct responses and the corresponding vector of frequencies
# for naep data
data(naep)
X = as.matrix(naep)
out = aggr_data(X)
length(out$freq)

Example output

Loading required package: MASS
Loading required package: limSolve
[1] 704

MultiLCIRT documentation built on May 2, 2019, 2:38 p.m.