> lpga.mod1 <- lm(prz ~ green + putts + sandshot + sandsave + drive) > summary(lpga.mod1) Call: lm(formula = prz ~ green + putts + sandshot + sandsave + drive) Residuals: Min 1Q Median 3Q Max -5016.9 -2185.4 -668.9 938.3 25090.4 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 14077.52 13366.47 1.053 0.2939 green 836.24 111.85 7.477 5.77e-12 *** putts -2449.94 318.07 -7.702 1.64e-12 *** sandshot 3362.93 2198.78 1.529 0.1282 sandsave 90.68 38.09 2.381 0.0185 * drive 12.09 39.26 0.308 0.7586 --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 Residual standard error: 3738 on 151 degrees of freedom Multiple R-squared: 0.5511, Adjusted R-squared: 0.5362 F-statistic: 37.07 on 5 and 151 DF, p-value: < 2.2e-16 > plot(lpga.mod1) > > #### Run Box-Cox transformation (Goal: obtain lambda that maximizes log-like) > > library(MASS) > > bc.mod1 <- boxcox(lpga.mod1,plot=T) # Runs series of power transforms and plots > print(cbind(bc.mod1$x,bc.mod1$y)) # Print out results (lambda,log-like) [,1] [,2] [1,] -2.00000000 -1086.4331 [2,] -1.95959596 -1064.8710 [3,] -1.91919192 -1043.3590 [4,] -1.87878788 -1021.8984 [5,] -1.83838384 -1000.4906 [6,] -1.79797980 -979.1371 [7,] -1.75757576 -957.8391 [8,] -1.71717172 -936.5983 [9,] -1.67676768 -915.4161 [10,] -1.63636364 -894.2939 [11,] -1.59595960 -873.2334 [12,] -1.55555556 -852.2361 [13,] -1.51515152 -831.3035 [14,] -1.47474747 -810.4372 [15,] -1.43434343 -789.6387 [16,] -1.39393939 -768.9097 [17,] -1.35353535 -748.2517 [18,] -1.31313131 -727.6662 [19,] -1.27272727 -707.1547 [20,] -1.23232323 -686.7188 [21,] -1.19191919 -666.3599 [22,] -1.15151515 -646.0797 [23,] -1.11111111 -625.8798 [24,] -1.07070707 -605.7620 [25,] -1.03030303 -585.7284 [26,] -0.98989899 -565.7817 [27,] -0.94949495 -545.9251 [28,] -0.90909091 -526.1636 [29,] -0.86868687 -506.5028 [30,] -0.82828283 -486.9525 [31,] -0.78787879 -467.5246 [32,] -0.74747475 -448.2368 [33,] -0.70707071 -429.1163 [34,] -0.66666667 -410.1948 [35,] -0.62626263 -391.5268 [36,] -0.58585859 -373.1770 [37,] -0.54545455 -355.2366 [38,] -0.50505051 -337.8359 [39,] -0.46464646 -321.1200 [40,] -0.42424242 -305.2992 [41,] -0.38383838 -290.6085 [42,] -0.34343434 -277.3027 [43,] -0.30303030 -265.6622 [44,] -0.26262626 -255.9476 [45,] -0.22222222 -248.3084 [46,] -0.18181818 -242.8556 [47,] -0.14141414 -239.5688 [48,] -0.10101010 -238.2790 [49,] -0.06060606 -238.7918 [50,] -0.02020202 -240.8411 [51,] 0.02020202 -244.1427 [52,] 0.06060606 -248.4488 [53,] 0.10101010 -253.5485 [54,] 0.14141414 -259.2498 [55,] 0.18181818 -265.4261 [56,] 0.22222222 -271.9677 [57,] 0.26262626 -278.7964 [58,] 0.30303030 -285.8618 [59,] 0.34343434 -293.1212 [60,] 0.38383838 -300.5523 [61,] 0.42424242 -308.1376 [62,] 0.46464646 -315.8670 [63,] 0.50505051 -323.7365 [64,] 0.54545455 -331.7433 [65,] 0.58585859 -339.8882 [66,] 0.62626263 -348.1730 [67,] 0.66666667 -356.6000 [68,] 0.70707071 -365.1722 [69,] 0.74747475 -373.8928 [70,] 0.78787879 -382.7644 [71,] 0.82828283 -391.7899 [72,] 0.86868687 -400.9715 [73,] 0.90909091 -410.3110 [74,] 0.94949495 -419.8099 [75,] 0.98989899 -429.4689 [76,] 1.03030303 -439.2885 [77,] 1.07070707 -449.2687 [78,] 1.11111111 -459.4087 [79,] 1.15151515 -469.7078 [80,] 1.19191919 -480.1643 [81,] 1.23232323 -490.7766 [82,] 1.27272727 -501.5425 [83,] 1.31313131 -512.4594 [84,] 1.35353535 -523.5248 [85,] 1.39393939 -534.7355 [86,] 1.43434343 -546.0884 [87,] 1.47474747 -557.5802 [88,] 1.51515152 -569.2073 [89,] 1.55555556 -580.9663 [90,] 1.59595960 -592.8533 [91,] 1.63636364 -604.8646 [92,] 1.67676768 -616.9966 [93,] 1.71717172 -629.2455 [94,] 1.75757576 -641.6074 [95,] 1.79797980 -654.0787 [96,] 1.83838384 -666.6557 [97,] 1.87878788 -679.3348 [98,] 1.91919192 -692.1125 [99,] 1.95959596 -704.9853 [100,] 2.00000000 -717.9496 > print(bc.mod1$x[which.max(bc.mod1$y)]) # Print out "best" lambda [1] -0.1010101 > ci.bc <- max(bc.mod1$y)-0.5*qchisq(0.95,1) # Obtain cut-off for 95% CI (in log-like) > print(bc.mod1$x[bc.mod1$y>= ci.bc]) # Print Values of lambda in 95% CI [1] -0.14141414 -0.10101010 -0.06060606 >