mse: Calculate mean squared difference

Description Usage Arguments Details Value Examples

View source: R/OmicsPLS.R

Description

Calculate mean squared difference

Usage

1
mse(x, y = 0, na.rm = FALSE)

Arguments

x

Numeric vector or matrix.

y

Numeric vector or matrix. Defaults to 0.

na.rm

Remove NA's?

Details

Is equal to ssq(x-y)/length(c(x)). If x and y are of unequal length, the invoked minus-operator will try to make the best out of it by recycling elements of the shorter object (usually you don't want that). In particular if x is an N x p matrix and y an N x 1 vector, y is subtracted from each column of x, and if y=0 (default) you get the mean of vec(x^2)

Value

The mean of the squared differences elementwise.

Examples

1
2
3
mse(2)
mse(1:10,2:11) == 1
mse(matrix(rnorm(500),100,5),matrix(rnorm(500),100,5))

Example output

Attaching package: 'OmicsPLS'

The following object is masked from 'package:stats':

    loadings

[1] 4
[1] TRUE
[1] 2.001874

OmicsPLS documentation built on May 19, 2021, 5:08 p.m.