R/regYhat.R

regYhat <-
function(x,y,xr=x,regfun=tsreg,xout=FALSE,outfun=outpro,pr=FALSE,...){
#
#  For convenience, return estimate of Y based on data in xr using
#  regression line based on regfun
#
xy=elimna(cbind(x,y))
x<-as.matrix(x)
p=ncol(x)
p1=p+1
vals=NA
x<-xy[,1:p]
y<-xy[,p1]
if(xout){
m<-cbind(x,y)
flag<-outfun(x,plotit=FALSE,...)$keep
m<-m[flag,]
x<-m[,1:p]
y<-m[,p1]
}
est=regfun(x,y,...)$coef
xr=as.matrix(xr)
yhat=est[1]+xr%*%est[2:p1]
yhat
}
musto101/wilcox_R documentation built on May 23, 2019, 10:52 a.m.