R/estimation.1d.R

Defines functions estimation.1d

#####################################################
### --- Estimation on new x -- ######################
#####################################################
estimation.1d <- function(xpred, knotSelec, ord, x_min, x_max, res.lm){
  
  ##### --- prediction 
  nameSplines = attr(terms(res.lm), "term.labels")
  newTabXBig = bsplineS(xpred, norder = (ord+1), breaks=c(x_min, knotSelec, x_max), returnMatrix = T)
  colnames(newTabXBig) <- nameSplines
  predict_f <- as.data.frame(predict(res.lm, newdata = as.data.frame(newTabXBig), interval = 'prediction'))
  fhat <- predict_f$fit
  
  return(fhat)
}

Try the glober package in your browser

Any scripts or data that you put into this service are public.

glober documentation built on June 7, 2023, 5:44 p.m.