bcoef | R Documentation |

Function `bcoef`

returns the "b-coefficients" (= regression coefficients for the `X`

-matrix), including the intercept) from PCR and PLSR models.

The function is implemented only for algorithms providing orthogonal scores.

```
bcoef(fm, ncomp = NULL)
```

`fm` |
Output of functions |

`ncomp` |
The b-coefficients are calculated for the model with |

A matrix with the b-coefficients.

```
n <- 8
p <- 6
set.seed(1)
X <- matrix(rnorm(n * p, mean = 10), ncol = p, byrow = TRUE)
y1 <- 100 * rnorm(n)
y2 <- 100 * rnorm(n)
Y <- cbind(y1, y2)
set.seed(NULL)
fm <- plsr(X, Y, X, ncomp = 3)
#fm <- pls(X, Y, ncomp = 3)
#fm <- pls.kernel(X, Y, ncomp = 3)
bcoef(fm, ncomp = 2)
fm <- pcr(X, Y, X, ncomp = 3)
bcoef(fm, ncomp = 2)
```

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.