Can anyone help explain to me why the two codes below have different result? I thought I can use log(time)~. to replace log(time)~dist+climb+timef.I am using CVlm from DAAG package. I think nihills is preloaded with the package. Thanks in advance. > CVlm(df=nihills, form.lm=formula(log(time)~.),plotit="Observed",m=2)Analysis > of Variance Table Response: log(time) Df Sum Sq Mean Sq F value Pr(>F) dist 1 6.34 6.34 384.31 4.6e-14 ***climb 1 0.12 0.12 7.24 0.0145 * timef 1 0.19 0.19 11.29 0.0033 ** Residuals 19 0.31 0.02 ---Signif. codes: 0 *** 0.001 ** 0.01 * 0.05 . 0.1 1
fold 1 Observations in test set: 11 Slieve Gullion McVeigh Classic Tollymore Mountain Moughanmore Hen & Cock Annalong Horseshoe Rocky Meelbeg Meelmore Slieve Donard Seven Sevens Slieve GallionPredicted -0.680 -0.538 -0.610 -0.786 -0.849 7.87e-01 -0.682 -6.20e-01 -2.98e-01 1.41e+00 -5.87e-01cvpred -0.762 -0.614 -0.727 -0.769 -0.799 6.67e-01 -0.648 -7.89e-01 -5.30e-02 1.36e+00 -4.52e-01log(time) -0.762 -0.614 -0.727 -0.769 -0.799 6.67e-01 -0.648 -7.89e-01 -5.30e-02 1.36e+00 -4.52e-01CV residual 0.000 0.000 0.000 0.000 0.000 1.11e-16 0.000 1.11e-16 -4.86e-17 4.44e-16 -5.55e-17 Sum of squares = 0 Mean square = 0 n = 11 fold 2 Observations in test set: 12 Binevenagh Glenariff Mountain Donard & Commedagh Slieve Martin Monument Race Loughshannagh Horseshoe Donard Forest Flagstaff to Carling Slieve Bearnagh Lurig Challenge Scrabo Hill Race BARF Turkey TrotPredicted -1.78e-01 -4.89e-01 2.78e-02 -0.577 -7.27e-01 -0.623 -0.571 3.03e-01 -0.401 -7.20e-01 -0.889 -4.88e-01cvpred -1.53e-01 -3.52e-01 3.79e-02 -0.597 -7.51e-01 -0.435 -0.657 3.76e-01 -0.374 -8.33e-01 -1.125 -3.38e-01log(time) -1.53e-01 -3.52e-01 3.79e-02 -0.597 -7.51e-01 -0.435 -0.657 3.76e-01 -0.374 -8.33e-01 -1.125 -3.38e-01CV residual -2.78e-17 -5.55e-17 -6.94e-18 0.000 1.11e-16 0.000 0.000 -1.11e-16 0.000 1.11e-16 0.000 -5.55e-17 Sum of squares = 0 Mean square = 0 n = 12 Overall (Sum over all 12 folds) ms 1.18e-32 Warning messages:1: In predict.lm(subs.lm, newdata = df[rows.out, ]) : prediction from a rank-deficient fit may be misleading2: In predict.lm(subs.lm, newdata = df[rows.out, ]) : prediction from a rank-deficient fit may be misleading3: In CVlm(df = nihills, form.lm = formula(log(time) ~ .), plotit = "Observed", : As there is >1 explanatory variable, cross-validation predicted values for a fold are not a linear function of corresponding overall predicted values. Lines that are shown for the different folds are approximate > CVlm(df=nihills, > form.lm=formula(log(time)~dist+climb+timef),plotit="Observed",m=2)Analysis of > Variance Table Response: log(time) Df Sum Sq Mean Sq F value Pr(>F) dist 1 6.34 6.34 384.31 4.6e-14 ***climb 1 0.12 0.12 7.24 0.0145 * timef 1 0.19 0.19 11.29 0.0033 ** Residuals 19 0.31 0.02 ---Signif. codes: 0 *** 0.001 ** 0.01 * 0.05 . 0.1 1 fold 1 Observations in test set: 11 Slieve Gullion McVeigh Classic Tollymore Mountain Moughanmore Hen & Cock Annalong Horseshoe Rocky Meelbeg Meelmore Slieve Donard Seven Sevens Slieve GallionPredicted -0.6801 -0.53759 -0.610 -0.7857 -0.84929 0.787 -0.6824 -0.620 -0.298 1.41 -0.587cvpred -0.7068 -0.60517 -0.680 -0.7501 -0.80507 1.053 -0.6856 -0.642 -0.185 2.81 -0.588log(time) -0.7621 -0.61413 -0.727 -0.7687 -0.79913 0.667 -0.6481 -0.789 -0.053 1.36 -0.452CV residual -0.0554 -0.00896 -0.047 -0.0186 0.00595 -0.386 0.0376 -0.147 0.132 -1.45 0.136 Sum of squares = 2.31 Mean square = 0.21 n = 11 fold 2 Observations in test set: 12 Binevenagh Glenariff Mountain Donard & Commedagh Slieve Martin Monument Race Loughshannagh Horseshoe Donard Forest Flagstaff to Carling Slieve Bearnagh Lurig Challenge Scrabo Hill Race BARF Turkey TrotPredicted -0.178 -0.489 0.0278 -0.5771 -0.72713 -0.623 -0.571 0.303 -0.4008 -0.720 -0.889 -0.488cvpred -0.308 -0.583 0.0268 -0.5822 -0.75753 -0.614 -0.600 0.125 -0.3245 -0.751 -0.891 -0.558log(time) -0.153 -0.352 0.0379 -0.5968 -0.75148 -0.435 -0.657 0.376 -0.3743 -0.833 -1.125 -0.338CV residual 0.156 0.231 0.0111 -0.0147 0.00604 0.178 -0.057 0.251 -0.0498 -0.082 -0.234 0.219 Sum of squares = 0.29 Mean square = 0.02 n = 12 Overall (Sum over all 12 folds) ms 0.113 Warning message:In CVlm(df = nihills, form.lm = formula(log(time) ~ dist + climb + : As there is >1 explanatory variable, cross-validation predicted values for a fold are not a linear function of corresponding overall predicted values. Lines that are shown for the different folds are approximate > head(nihills) dist climb time timefBinevenagh 7.5 1740 0.858 1.064Slieve Gullion 4.2 1110 0.467 0.623Glenariff Mountain 5.9 1210 0.703 0.887Donard & Commedagh 6.8 3300 1.039 1.214McVeigh Classic 5.0 1200 0.541 0.637Tollymore Mountain 4.8 950 0.483 0.589 [[alternative HTML version deleted]]
______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.