You are on page 1of 5

Multiple regression

Shailesh

3/9/2021
library(readxl)
DAT<-read_excel("C:/Users/admin/Desktop/Dolas TOF CT.xlsx")
DAT->data
attach(data)
TOF

## [1] 10 41 628 681 720 801 886 892 915 950 1091 1100 1135 1194
1250
## [16] 1276 1338 1556 1633 1668 1687 1854 1876 1895 2000 2106 2109 2117 2174
2346
## [31] 2434 2440 2470 2547 2570 2607 2628 2646 2904 2961

COST

## [1] 26 26 25 585 26 60 34 27 40 73 33 43 43 571 84 53 42


67 59
## [20] 71 77 70 87 88 95 699 85 113 292 138 155 140 189 171 201 197
204 197
## [39] 208 376

lm(COST~TOF)->lmyx
lmyx

##
## Call:
## lm(formula = COST ~ TOF)
##
## Coefficients:
## (Intercept) TOF
## 39.2641 0.0635

anova(lmyx)

## Analysis of Variance Table


##
## Response: COST
## Df Sum Sq Mean Sq F value Pr(>F)
## TOF 1 96444 96444 4.1415 0.04886 *
## Residuals 38 884925 23288
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

lm(COST~TOF+I(TOF*TOF))
##
## Call:
## lm(formula = COST ~ TOF + I(TOF * TOF))
##
## Coefficients:
## (Intercept) TOF I(TOF * TOF)
## 81.8279206 -0.0077882 0.0000226

lm(COST~I(log(TOF)))

##
## Call:
## lm(formula = COST ~ I(log(TOF)))
##
## Coefficients:
## (Intercept) I(log(TOF))
## -117.82 36.65

library(readxl)
DAT<-read_excel("C:/Users/admin/Downloads/izni data.xlsx")
DAT->data
attach(data)
year

## [1] 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996
1997
## [16] 1998 1999 2000 2001 2002 2003 2004 2005 2006

## [1] 1442800 1417200 1466100 1454500 1489400 1559200 1652300 2024600


2175900
## [10] 2606400 3025300 3493100 3725800 4037600 4200500 4398200 4649700
4712500
## [19] 5205000 6115500 7158700 8109500 9051000 9623000

x1

## [1] 689 855 1028 1268 1446 1705 1892 2113 2372 2640 3090
3603
## [13] 3987 4530 4872 5110 5400 5524 5653 6958 8680 9864 11805
12314

x2

## [1] 612 720 874 1087 1197 1417 1524 1761 1903 2123 2574
2826
## [13] 2878 3002 3172 3260 3375 3497 3704 5523 7805 8263 9522
11092

x3
## [1] 311 351 426 472 652 486 458 473 506 705 689 964 1073 1003
1044
## [16] 854 686 758 891 1043 1181 1319 1946 2347

x4

## [1] 2375900 2305000 2765900 3306400 3981400 4551000 5269100


6020400
## [9] 7406200 8676500 9879800 11108700 11832700 13091800 14063100
15760600
## [17] 16760300 16519000 18083400 19267300 19580500 25365000 30032000
32987000

x5

## [1] 0.4180 0.4233 0.4293 0.4621 0.4580 0.4780 0.4930 0.5215 0.5546 0.5983
## [11] 0.6087 0.6339 0.6312 0.6479 0.6745 0.6889 0.7012 0.7188 0.7188 0.7295
## [21] 0.7283 0.7228 0.7201 0.7231

x6

## [1] 0.0145 0.0153 0.0160 0.0155 0.0149 0.0143 0.0131 0.0137 0.0126 0.0118
## [11] 0.0111 0.0111 0.0120 0.0120 0.0107 0.0101 0.0095 0.0088 0.0091 0.0083
## [21] 0.0083 0.0089 0.0084 0.0085

x7

## [1] 0.0907 0.0954 0.0949 0.1025 0.0935 0.0908 0.0931 0.1013 0.1088 0.1154
## [11] 0.1207 0.1296 0.1357 0.1476 0.1459 0.1488 0.1540 0.1582 0.1646 0.1722
## [21] 0.1774 0.1771 0.1698 0.1720

x8

## [1] 1421900 1442800 1417200 1466100 1454500 1489400 1559200 1652300


2024600
## [10] 2175900 2606400 3025300 3493100 3725800 4037600 4200500 4398200
4649700
## [19] 4712500 5205000 6115500 7158700 8109500 9051000

lm(y~x1+x2+x3+x4+x5+x6+x7+x8)->lmxy
lmxy

##
## Call:
## lm(formula = y ~ x1 + x2 + x3 + x4 + x5 + x6 + x7 + x8)
##
## Coefficients:
## (Intercept) x1 x2 x3 x4
x5
## 2.020e+06 1.777e+02 2.183e+02 1.937e+02 7.683e-02
-5.450e+06
## x6 x7 x8
## -9.835e+07 2.719e+07 2.591e-02

anova(lmxy)

## Analysis of Variance Table


##
## Response: y
## Df Sum Sq Mean Sq F value Pr(>F)
## x1 1 1.4433e+14 1.4433e+14 11587.7644 < 2.2e-16 ***
## x2 1 3.4243e+10 3.4243e+10 2.7493 0.11806
## x3 1 2.6283e+10 2.6283e+10 2.1102 0.16692
## x4 1 9.0095e+10 9.0095e+10 7.2335 0.01681 *
## x5 1 6.2750e+10 6.2750e+10 5.0381 0.04031 *
## x6 1 2.5347e+09 2.5347e+09 0.2035 0.65836
## x7 1 5.9819e+11 5.9819e+11 48.0274 4.811e-06 ***
## x8 1 2.0014e+08 2.0014e+08 0.0161 0.90081
## Residuals 15 1.8683e+11 1.2455e+10
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

library(ggplot2)
library(readxl)
DAT<-read_excel("C:/Users/admin/Downloads/%carbon.xlsx")
DAT->data
attach(data)
Hardness

## [1] 6.2 7.1 8.3 11.4 12.3 13.2 16.7 17.3 18.9

precentageC

## [1] 0.1 0.2 0.3 0.1 0.2 0.3 0.1 0.2 0.3

precentageMn

## [1] 0.05 0.05 0.05 0.10 0.10 0.10 0.15 0.15 0.15

lm(Hardness~precentageC+precentageMn)->Coeff
Coeff

##
## Call:
## lm(formula = Hardness ~ precentageC + precentageMn)
##
## Coefficients:
## (Intercept) precentageC precentageMn
## -0.08889 10.16667 104.33333

qplot(precentageC,Hardness)
plot(precentageMn,Hardness)

You might also like