This class implements the *Nonnegative Matrix
Factorization with Offset* model, required by the NMF
with Offset algorithm.

```
S4 (NMFOffset)
`initialize`(.Object, ..., offset)
```

- offset
- optional numeric vector used to initialise slot ‘offset’.
- .Object
- An object: see the Details section.
- ...
- data to include in the new object. Named arguments correspond to slots in the class definition. Unnamed arguments must be objects from classes that this class extends.

The NMF with Offset algorithm is defined by Badea
(2008) as a modification of the euclidean based NMF
algorithm from `Lee2001`

(see section Details and
references below). It aims at obtaining 'cleaner' factor
matrices, by the introduction of an offset matrix,
explicitly modelling a feature specific baseline --
constant across samples.

- fitted
`signature(object = "NMFOffset")`

: Computes the target matrix estimate for an NMFOffset object.The estimate is computed as:

W H + offset

- offset
`signature(object = "NMFOffset")`

: The function`offset`

returns the offset vector from an NMF model that has an offset, e.g. an`NMFOffset`

model. - rnmf
`signature(x = "NMFOffset", target = "numeric")`

: Generates a random NMF model with offset, from class`NMFOffset`

.The offset values are drawn from a uniform distribution between 0 and the maximum entry of the basis and coefficient matrices, which are drawn by the next suitable

`rnmf`

method, which is the workhorse method`rnmf,NMF,numeric`

. - show
`signature(object = "NMFOffset")`

: Show method for objects of class`NMFOffset`

Object of class `NMFOffset`

can be created using the
standard way with operator `new`

However, as for all NMF model classes -- that extend
class `NMF-class`

, objects of class
`NMFOffset`

should be created using factory method
`nmfModel`

:

`new('NMFOffset')`

`nmfModel(model='NMFOffset')`

```
nmfModel(model='NMFOffset', W=w, offset=rep(1,
nrow(w)))
```

See `nmfModel`

for more details on how to use
the factory method.

The initialize method for `NMFOffset`

objects tries
to correct the initial value passed for slot
`offset`

, so that it is consistent with the
dimensions of the `NMF`

model: it will pad the
offset vector with NA values to get the length equal to
the number of rows in the basis matrix.

Badea L (2008). "Extracting gene expression profiles
common to colon and pancreatic adenocarcinoma using
simultaneous nonnegative matrix factorization." _Pacific
Symposium on Biocomputing. Pacific Symposium on
Biocomputing_, *290*, pp. 267-78. ISSN 1793-5091,

```
# create a completely empty NMF object
new('NMFOffset')
```

```
## <Object of class:NMFOffset>
## features: 0
## basis/rank: 0
## samples: 0
## offset: none
```

```
# create a NMF object based on random (compatible) matrices
n <- 50; r <- 3; p <- 20
w <- rmatrix(n, r)
h <- rmatrix(r, p)
nmfModel(model='NMFOffset', W=w, H=h, offset=rep(0.5, nrow(w)))
```

```
## <Object of class:NMFOffset>
## features: 50
## basis/rank: 3
## samples: 20
## offset: none
```

```
# apply Nonsmooth NMF algorithm to a random target matrix
V <- rmatrix(n, p)
## Not run: nmf(V, r, 'offset')
# random NMF model with offset
rnmf(3, 10, 5, model='NMFOffset')
```

```
## <Object of class:NMFOffset>
## features: 10
## basis/rank: 3
## samples: 5
## offset: [ 0.08855 0.8144 0.5603 0.9843 0.6711 ... ]
```

```
```