Hello,
I am using train function and PCA regression using caret. When predicting where the predicting dataset does not have a response (valid_data) I am getting an error. How is this done? I don't have any beta coefficients to use?
```{r,echo=FALSE}
suppressMessages(library(caret))
set.seed(12345)
model <- train(
Y~., data=train_data[-1] ,
method="pcr",
scale=TRUE,
)
predictions <- predict(model,valid_data)
> report <- data.frame(Rsquare=caret::R2(predictions,valid_data$Y),RMSE=caret::RMSE(predictions, valid_data$Y))
Warning: the standard deviation is zero
> Rsquared <- model$results$Rsquared
Thank you.