{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

notes07_ex1 - > plot(sales.dat$Advert,sales.dat$Sales >...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
±²³² ´µ¶ ·¸¹º»¸¼½¾¹ ¿ÀÁÂÀÃý¸»Ä Å ± Æ ± Ç ± È ² ± Ç ± µ ² ± µ ÇÉ Ç ± ³ Ê È ² ± ³ Ê È Ç ² ± Ë ± ÆÈË µË É Ë ´ Ë ÌÍÀÂÀ ² ± Îà ¾ÂÀ ½»ÏÀ À»ÏÀ»! "¸Â¼¾¹ # ¶Ë ³ µ $ % ±² &!½ÃÌÀ¹¹ '»¸Ì»!;!!ÍÀþ¹ÀÃÂÀà ¸»ÃÀ!¸ ¾Ï(ÀÂ!½Ã½»Á)Ã)¾¹¹º*¸¹¹¸Ìà ¾+)Â(ÀÂÀ*¹À+!½»Á!ÍÀϽ¼½»½Ãͽ»ÁÂÀ!)»Ã!¸¾Ï(ÀÂ!½Ã½»ÁÀ, À»Ï½!)ÂÀ% ³Ã¾+¸¼ ¾»º½»+ÂÀ¾ÃÀý!þÏ(ÀÂ!½Ã½»ÁÀ, À»Ï½!)ÂÀË Ã¾¹Àý»+ÂÀ¾ÃÀË -)!!ÍÀ¾!À¸* ½»+ÂÀ¾ÃÀϸ Ã+¸»!½»)¾¹¹º¾*!À ¾+ÀÂ!¾½» ¸½»!% &* ÌÀ +¸»Ã½ÏÀ +¸¼ ¾»ºÃ¾¹Àà ¸*½!þþ*)»+!½¸»¸* ¾Ï(ÀÂ!½Ã½»ÁÀ, À»Ï½!)ÂÀË ÌÀ*½»Ï!;!!ÍÀÂÀà ¸»ÃÀ*)»+!½¸»+¾»-À(ÀºÌÀ¹¹ ¾ ¸,½¼¾!ÀÏ-º¾ ÃÀ+¸»Ï.¸ÂÏÀ #/)¾Ï¾!½+$ ¼¸ÏÀ¹% 0¸Â ¾ ¾Â!½+)¹¾Â +¸¼ ¾»ºË !ÍÀϾ!¾¸» ¼¸»!͹ºÃ¾¹Àà µ ¾»Ï¼¸»!͹º¾Ï(ÀÂ!½Ã½»ÁÀ, À»Ï½!)ÂÀ ² Ë -¸!ͽ»Í)»ÏÂÀÏ !͸)þ»Ïϸ¹¹¾ÂÃË ¾ÂÀÁ½(À»½»!ÍÀ!¾-¹À¸»!ÍÀ½ÁÍ!% Å ± Æ ± Ç ± È ² ± Ç ± µ ² ± µ Ç ± ´ ƵÈ% ±¾¹ÀÃË µ ³Ï(ÀÂ!Ë ² 1%¶ È%¶ 2%¶ È%3 2%1 È%2 4%¶ È%4 4%1 µ%¶ 3%¶ µ%¶ ȶ%¶ µ%5 ȶ%3 µ%3 ȵ%¶ 5%1 È5%¶ 5%5 È1%1 ´%3 È1%¶ 1%¶ È2%¶ 4%¶ È4%¶ 3%È È3%¶ 3%¶ È3%¶ ȶ%¶ È3%1 3%¶ µÈ%¶ ȵ%4 µ¶%¶ ȵ%¶ µµ%¶ È1%¶ µ5%¶ È´%´ > plot(sales.dat$Advert,sales.dat$Sales)
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
> sales.dat Sales Advert 1 5.0 1.0 2 6.0 1.8 3 6.5 1.6 4 7.0 1.7 5 7.5 2.0 6 8.0 2.0 7 10.0 2.3 8 10.8 2.8 9 12.0 3.5 10 13.0 3.3 11 15.5 4.8 12 15.0 5.0 13 16.0 7.0 14 17.0 8.1 15 18.0 8.0 16 18.0 10.0 17 18.5 8.0 18 21.0 12.7 19 20.0 12.0 20 22.0 15.0 21 23.0 14.4 > sales.fit = lm(Sales ~ Advert + I(Advert^2), data = sales.dat) > summary(sales.fit) Call: lm(formula = Sales ~ Advert + I(Advert^2), data = sales.dat) Residuals: Min 1Q Median 3Q Max -1.9175 -0.8333 -0.1948 0.9292 2.1385 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 3.51505 0.73847 4.760 0.000157 *** Advert 2.51478 0.25796 9.749 1.32e-08 *** I(Advert^2) -0.08745 0.01658 -5.275 5.14e-05 *** --- Signif. codes: 0 `***' 0.001 `**' 0.01 `*' 0.05 `.' 0.1 ` ' 1 Residual standard error: 1.228 on 18 degrees of freedom Multiple R-Squared: 0.9587, Adjusted R-squared: 0.9541 F-statistic: 209 on 2 and 18 DF, p-value: 3.486e-13
Background image of page 2
> X = cbind(rep(1,21),sales.dat$Advert,sales.dat$Advert^2) > X [,1] [,2] [,3] [1,] 1 1.0 1.00 [2,] 1 1.8 3.24 [3,] 1 1.6 2.56 [4,] 1 1.7 2.89 [5,] 1 2.0 4.00 [6,] 1 2.0 4.00 [7,] 1 2.3 5.29 [8,] 1 2.8 7.84 [9,] 1 3.5 12.25 [10,] 1 3.3 10.89 [11,] 1 4.8 23.04 [12,] 1 5.0 25.00 [13,] 1 7.0 49.00 [14,] 1 8.1 65.61 [15,] 1 8.0 64.00 [16,] 1 10.0 100.00 [17,] 1 8.0 64.00 [18,] 1 12.7 161.29 [19,] 1 12.0 144.00 [20,] 1 15.0 225.00 [21,] 1 14.4 207.36 X T X = !
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}