zmodel.matrix | R Documentation |
A function that somewhat replicates model.matrix(), but accepts complex valued data. It will probably be slower and less efficient, but mostly functional. It cannot handle algebraic expressions in formula.
zmodel.matrix(trms, data, contrasts.arg = NULL)
trms |
A "terms" object as generated by |
data |
A data frame containing the data referenced by the symbolic formula / model in |
contrasts.arg |
a list, default is NULL. Not currently supported. See |
A model matrix, AKA a design matrix for a regression, containing the relevant information from data
.
stats::model.matrix, lm
set.seed(4242)
slop <- complex(real = 4.23, imaginary = 2.323)
interc <- complex(real = 1.4, imaginary = 1.804)
tframe <- expand.grid(-3:3,-3:3)
Xt <- complex(real = tframe[[1]], imaginary = tframe[[2]])
tframe <- data.frame(Xt=Xt, Yt= Xt * slop + interc + complex(real=rnorm(length(Xt)),
imaginary=rnorm(length(Xt))))
testterms <- terms(Yt ~ Xt)
zmodel.matrix(testterms, tframe)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.