May 2019
Beginner to intermediate
266 pages
5h 57m
English
This model helps to create a linear regression model using the outputs of a Principal Component Analysis (PCA) to estimate the coefficients of the model. PCR is useful when the data has highly correlated predictors:
> pcrFit<-pcr(Employed ~ ., data = longley, valdiation = "cv")> summary(pcrFit)Data: X dimension: 16 6 Y dimension: 16 1Fit method: svdpcNumber of components considered: 6TRAINING: % variance explained 1 comps 2 comps 3 comps 4 comps 5 comps 6 compsX 64.96 94.90 99.99 100.00 100.00 100.00Employed 78.42 89.73 98.51 98.56 98.83 99.55> #Make predictions> pcrPredictions<-predict(pcrFit, longley, ncomp = 6)> #Include accuracy parameter> pcrMSE<-mean((longley$Employed - pcrPredictions)^2)> print(pcrMSE) ...
Read now
Unlock full access