ReduceBy0: Reduce input to 'Mipf' based on zeros in z and possible zeros...

Description Usage Arguments Value Author(s) Examples

View source: R/Reduce.R

Description

Reduce input to Mipf based on zeros in z and possible zeros in yStart

Usage

1
ReduceBy0(x, z, yStart = NULL)

Arguments

x

a matrix

z

a single column matrix

yStart

a starting estimate of y

Value

A list of three elements:

x

Reduced x

z

Corresponding reduced z

yKnown

Logical vector specifying elements of y that can be found directly as 0

Author(s)

Øyvind Langsrud

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
# Generate data with zeros
z2 <- EasyData("z2")
z2$ant[z2$hovedint == "trygd"] <- 0
z2$ant[1:3] <- 0

x <- FormulaSums(z2, ~~region + kostragr * hovedint - 1)
z <- t(x) %*% z2$ant

# Run ReduceBy0
a <- ReduceBy0(x, z)

# The rows known to be 0 and omitted from a$x
z2[a$yKnown, ]

# Dimension of x reduced
dim(x)
dim(a$x)

# Additional elements know to be 0
b <- ReduceBy0(x, z, c(0, 0, rep(1, 42)))
z2[b$yKnown, ]

olangsrud/experimentalRpackage documentation built on Sept. 20, 2021, 10:32 p.m.