View source: R/create.mxMatrix.R
| create.mxMatrix | R Documentation |
It converts a vector into MxMatrix-class via mxMatrix.
create.mxMatrix(
x,
type = c("Full", "Symm", "Diag", "Stand"),
ncol = NA,
nrow = NA,
as.mxMatrix = TRUE,
byrow = FALSE,
...
)
x |
A character or numeric vector |
type |
Matrix type similar to those listed in
|
ncol |
The number of columns. It is necessary when |
nrow |
The number of rows. It is necessary when |
as.mxMatrix |
Logical. If it is |
byrow |
Logical. If |
... |
Further arguments to be passed to
|
If there are non-numeric values in x, they are treated as the labels
of the free parameters. If an "*" is present, the numeric value on the
left-hand side will be treated as the starting value for a free parameter or
a fixed value for a fixed parameter. If it is a matrix of numeric values,
there are no free parameters in the output matrix. nrow and
ncol will be calculated from the length of x unless
type="Full" is specified.
A MxMatrix-class object with the same
dimensions as x
Mike W.-L. Cheung <mikewlcheung@nus.edu.sg>
mxMatrix,
create.mxMatrix,
create.Fmatrix
## a and b are free parameters with starting values and labels
(a1 <- c(1:4, "5*a", 6, "7*b", 8, 9))
(mat1 <- create.mxMatrix(a1, ncol=3, nrow=3, name="mat1"))
## Arrange the elements by row
(mat2 <- create.mxMatrix(a1, ncol=3, nrow=3, as.mxMatrix=FALSE, byrow=TRUE))
(a3 <- c(1:3, "4*f4", "5*f5", "6*f6"))
(mat3 <- create.mxMatrix(a3, type="Symm", name="mat3"))
## Create character matrix
(mat4 <- create.mxMatrix(a3, type="Symm", as.mxMatrix=FALSE))
## Arrange the elements by row
(mat5 <- create.mxMatrix(a3, type="Symm", as.mxMatrix=FALSE, byrow=TRUE))
(mat6 <- create.mxMatrix(a3, type="Diag", lbound=6:1, name="mat6"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.