R中的无截距函数回归

R中的无截距函数回归,r,statistics,regression,intercept,R,Statistics,Regression,Intercept,我正在R(包装fda)中进行功能回归,应该消除截距项。但是美国食品和药物管理局在R中的包装似乎没有这样的配方 以下是我想做的: fit.fd如果可能,向我们提供可复制的数据。至少通过使用summary函数向我们展示这两个回归的输出是什么。你确定你的回归线(最佳拟合)一定会/应该通过原点(删除截距)?我在示例中添加了一些测试数据,谢谢你的帮助! list3d <- rep(0, 10*5*2) list3d <- array(list3d, c(10,5, 2)) # The data

我正在R(包装
fda
)中进行功能回归,应该消除截距项。但是美国食品和药物管理局在R中的包装似乎没有这样的配方

以下是我想做的:


fit.fd如果可能,向我们提供可复制的数据。至少通过使用
summary
函数向我们展示这两个回归的输出是什么。你确定你的回归线(最佳拟合)一定会/应该通过原点(删除截距)?我在示例中添加了一些测试数据,谢谢你的帮助!
list3d <- rep(0, 10*5*2)
list3d <- array(list3d, c(10,5, 2))
# The data is 5 functions each evaluated at 10 points
# Indep variable
list3d[, , 2] <- matrix(rnorm(50, 0, 1), 10, 5)
# Response variable
list3d[, , 1] <- matrix(rnorm(50, 0, 0.1) , 10, 5)+list3d[, , 2] ^ 2 
dimnames(list3d)[[1]] <- seq(0,9)
time.range <- c(0, 9)
time.basis <- create.fourier.basis(time.range, nbasis = 3)
lfd <- vec2Lfd(c(0, (2*pi/20)^2, 0), rangeval = time.range)
time.lfd<- smooth.basisPar(seq(0,9),  list3d , time.basis, Lfdobj = lfd, lambda = 0.01)$fd
Acc.fd <- time.lfd[, 1]
Velo.fd <- time.lfd[, 2]
# Expecting to see without intercept here
fit.fd <- fRegress(Acc.fd ~ Velo.fd - 1)
# plot of coef func
plot(plotpoints, eval.fd(plotpoints, fit.fd$betaestlis$Velo.fd$fd))
# Plot of intercept func, I wish to limit it to zero
plot(plotpoints, eval.fd(plotpoints, fit.fd$betaestlis$const$fd))

# Compare with regular functional regression with no restriction
fit.fd <- fRegress(Acc.fd ~ Velo.fd)
plot(plotpoints, eval.fd(plotpoints, fit.fd$betaestlis$Velo.fd$fd))