Learn R Programming

polyMatrix (version 0.3.1)

predict.charpn: Calculate the value of a characteristic polynomial for a polyMatrix argument

Description

The ‘polynom::predict.polynomial()’ method works by real coefficients only but it works for real or complex and matrix argument also. But in the case of matrix argument uses the elementwise product. The ‘polyMatrix::predict’ method evaluate the polynom by the usual matrix product definition.

Usage

# S3 method for charpn
predict(object,pM,...)

Arguments

object

a ‘charpn’ class object

pM

a ‘polyMatrix’ class object

additional arguments

Value

value

A ‘polynomial’ class object

See Also

predict.polynomial, predict.polyMatrix

Examples

Run this code
# NOT RUN {
pm <- polyMgen.d(2,2,rawData=ch2pn(c("1","x^2","x","0")))
pm # 1, z^2\\ z, 0

predict(pm,2) # matrix(c(1,4,2,0),2)

# predict the result of a linear model
x <- 1:5;y <- rnorm(5);predict(lm(y~x)) # the used method: predict.lm()

# clean up
# rm(pm, x, y)
# }

Run the code above in your browser using DataLab