# NOT RUN {
rm(list = ls())
# The dimension of predictor
p <- c(10, 10, 10)
# The envelope dimensions u.
u <- c(1, 1, 1)
# The dimension of response
r <- 5
# The sample size
n <- 200
# Simulate the data with \code{\link{TPR_sim}}.
dat <- TPR_sim(p = p, r = r, u = u, n = n)
Xn <- dat$Xn
Yn <- dat$Yn
B <- dat$coefficients
res_std = TPR.fit(Xn, Yn, method="standard")
res_FG = TPR.fit(Xn, Yn, u, method="FG")
res_pls = TPR.fit(Xn, Yn, u, method="PLS")
rTensor::fnorm(B-stats::coef(res_std))
rTensor::fnorm(B-stats::coef(res_FG))
rTensor::fnorm(B-stats::coef(res_pls))
## Use dataset square, but it is time-consuming
# }
# NOT RUN {
data("square")
Xn <- square$Xn
Yn <- square$Yn
res_std <- TPR.fit(Xn, Yn, method="standard")
# }
Run the code above in your browser using DataLab