You are on page 1of 3

R version 2.15.

3 (2013-03-01) -- "Security Blanket"


Copyright (C) 2013 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: i386-w64-mingw32/i386 (32-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
Natural language support but running in an English locale
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> mydata=read.csv("E:/tabel.csv")
> mydata
Observation MPG SP HP VOL WT
1
1 65.4 96 49 89 17.5
2
2 56.0 97 55 92 20.0
3
3 55.9 97 55 92 20.0
4
4 49.0 105 70 92 20.0
5
5 46.5 96 53 92 20.0
6
6 46.2 105 70 89 20.0
7
7 45.4 97 55 92 20.0
8
8 59.2 98 62 50 22.5
9
9 53.3 98 62 50 22.5
10
10 43.4 107 80 94 22.5
11
11 41.1 103 73 89 22.5
12
12 40.9 113 92 50 22.5
13
13 40.9 113 92 99 22.5
14
14 40.4 103 73 89 22.5
15
15 39.6 100 66 89 22.5
16
16 39.3 103 73 89 22.5
17
17 38.9 106 78 91 22.5
18
18 38.8 113 92 50 22.5
19
19 38.2 106 78 91 22.5
20
20 42.2 109 90 103 25.0
21
21 40.9 110 92 99 25.0
22
22 40.7 101 74 107 25.0
23
23 40.0 111 95 101 25.0
24
24 39.3 105 81 96 25.0
25
25 38.8 111 95 89 25.0
26
26 38.4 110 92 50 25.0
27
27 38.4 110 92 117 25.0
28
28 38.4 110 92 99 25.0
29
29 46.9 90 52 104 27.5
30
30 36.3 112 103 107 27.5
31
31 36.1 103 84 114 27.5
32
32 36.1 103 84 101 27.5
33
33 35.4 111 102 97 27.5
34
34 35.3 111 102 113 27.5
35
35 35.1 102 81 101 27.5
36
36 35.1 106 90 98 27.5
37
37 35.0 106 90 88 27.5

38
38 33.2 109 102 86 30.0
39
39 32.9 109 102 86 30.0
40
40 32.3 120 130 92 30.0
41
41 32.2 106 95 113 30.0
42
42 32.2 106 95 106 30.0
43
43 32.2 109 102 92 30.0
44
44 32.2 106 95 88 30.0
45
45 31.5 105 93 102 30.0
46
46 31.5 108 100 99 30.0
47
47 31.4 108 100 111 30.0
48
48 31.4 107 98 103 30.0
49
49 31.2 120 130 86 30.0
50
50 33.7 109 115 101 35.0
51
51 32.6 109 115 101 35.0
52
52 31.3 109 115 101 35.0
53
53 31.3 109 115 124 35.0
54
54 30.4 133 180 113 35.0
55
55 28.9 125 160 113 35.0
56
56 28.0 115 130 124 35.0
57
57 28.0 102 96 92 35.0
58
58 28.0 109 115 101 35.0
59
59 28.0 104 100 94 35.0
60
60 28.0 105 100 115 35.0
61
61 27.7 120 145 111 35.0
62
62 25.6 107 120 116 40.0
63
63 25.3 114 140 131 40.0
64
64 23.9 114 140 123 40.0
65
65 23.6 117 150 121 40.0
66
66 23.6 122 165 50 40.0
67
67 23.6 122 165 114 40.0
68
68 23.6 122 165 127 40.0
69
69 23.6 122 165 123 40.0
70
70 23.5 148 245 112 40.0
71
71 23.4 160 280 50 40.0
72
72 23.4 121 162 135 40.0
73
73 23.1 121 162 132 40.0
74
74 22.9 110 140 160 45.0
75
75 22.9 110 140 129 45.0
76
76 19.5 121 175 129 45.0
77
77 18.1 165 322 50 45.0
78
78 17.2 140 238 115 45.0
79
79 17.0 147 263 50 45.0
80
80 16.7 157 295 119 45.0
81
81 13.2 130 236 107 55.0
> local({pkg <- select.list(sort(.packages(all.available = TRUE)),graphics=TRUE)
+ if(nchar(pkg)) library(pkg, character.only=TRUE)})
Loading required package: zoo
Attaching package:

zoo

The following object(s) are masked from

package:base :

as.Date, as.Date.numeric
> local({pkg <- select.list(sort(.packages(all.available = TRUE)),graphics=TRUE)
+ if(nchar(pkg)) library(pkg, character.only=TRUE)})
> fit<-lm(MPG~SP+HP+WT)
Error in eval(expr, envir, enclos) : object 'MPG' not found
> fit<-lm(MPG~SP+HP+WT,data=mydata)
> summary(fit)

Call:
lm(formula = MPG ~ SP + HP + WT, data = mydata)
Residuals:
Min
1Q Median
3Q
Max
-6.1349 -2.9527 -0.0052 1.6701 12.4834
Coefficients:
Estimate Std. Error t value
(Intercept) 189.95968 22.52879 8.432
SP
-1.27170
0.23312 -5.455
HP
0.39043
0.07625 5.121
WT
-1.90327
0.18552 -10.259
--Signif. codes: 0 *** 0.001 ** 0.01

Pr(>|t|)
1.50e-12
5.72e-07
2.19e-06
4.64e-16
*

***
***
***
***

0.05 .

0.1

Residual standard error: 3.508 on 77 degrees of freedom


Multiple R-squared: 0.8829,
Adjusted R-squared: 0.8783
F-statistic: 193.5 on 3 and 77 DF, p-value: < 2.2e-16
> bptest(MPG~SP+HP+WT,studentize=FALSE,data=mydata)
Breusch-Pagan test
data: MPG ~ SP + HP + WT
BP = 51.9216, df = 3, p-value = 3.113e-11
> bptest(MPG~SP+HP+WT,studentize=TRUE,data=mydata)
studentized Breusch-Pagan test
data: MPG ~ SP + HP + WT
BP = 25.4914, df = 3, p-value = 1.219e-05
> bptest(MPG~SP+HP+WT,studentize=TRUE,data=mydata)
studentized Breusch-Pagan test
data: MPG ~ SP + HP + WT
BP = 25.4914, df = 3, p-value = 1.219e-05
> bptest(MPG~SP+HP+WT,varformula = ~HPstudentize=TRUE,data=mydata
Error: unexpected '=' in "bptest(MPG~SP+HP+WT,varformula = ~HPstudentize="
> +I(HP ^2)+SP +I(SP ^2)+WT +I(WT^2)+HP *SP
Error in unique(c("AsIs", oldClass(x))) : object 'HP' not found
> bptest(MPG~SP+HP+WT,varformula =~HP+I(HP^2)+SP+I(SP^2)+WT+I(WT^2)+HP*SP+HP*WT+
SP*WT,studentize=FALSE,data=mydata)
Breusch-Pagan test
data: MPG ~ SP + HP + WT
BP = 76.6991, df = 9, p-value = 7.293e-13
>

You might also like