Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
13 views

Iqdata Solved Example

it is solved example of data set for regression analysis and predicting new value estimated from data colled , it is done on R crane software. Commands are also in the document.

Uploaded by

Nabeela Ijaz
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views

Iqdata Solved Example

it is solved example of data set for regression analysis and predicting new value estimated from data colled , it is done on R crane software. Commands are also in the document.

Uploaded by

Nabeela Ijaz
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

> iqdata

V1 V2 V3 V4

1 piq brain height weight

2 124 81.69 64.5 118

3 150 103.84 73.3 143

4 128 96.54 68.8 172

5 134 95.15 65.0 147

6 110 92.88 69.0 146

7 131 99.13 64.5 138

8 98 85.43 66.0 175

9 84 90.49 66.3 134

10 147 95.55 68.8 172

11 124 83.39 64.5 118

12 128 107.95 70.0 151

13 124 92.41 69.0 155

14 147 85.65 70.5 155

15 90 87.89 66.0 146

16 96 86.54 68.0 135

17 120 85.22 68.5 127

18 102 94.51 73.5 178

19 84 80.80 66.3 136

20 86 88.91 70.0 180

21 84 90.59 76.5 186

22 134 79.06 62.0 122

23 128 95.50 68.0 132

24 102 83.18 63.0 114

25 131 93.55 72.0 171

26 84 79.86 68.0 140

27 110 106.25 77.0 187


28 72 79.35 63.0 106

29 124 86.67 66.5 159

30 132 85.78 62.5 127

31 137 94.96 67.0 191

32 110 99.79 75.5 192

33 86 88.00 69.0 181

34 81 83.43 66.5 143

35 128 94.81 66.5 153

36 124 94.94 70.5 144

37 94 89.40 64.5 139

38 74 93.00 74.0 148

39 89 93.59 75.5 179

> iqdata=read.table("D:/Nabeela/mphil 2 semester/stat/data sets/piq_data.txt",header=T)

> iqdata

piq brain height weight

1 124 81.69 64.5 118

2 150 103.84 73.3 143

3 128 96.54 68.8 172

4 134 95.15 65.0 147

5 110 92.88 69.0 146

6 131 99.13 64.5 138

7 98 85.43 66.0 175

8 84 90.49 66.3 134

9 147 95.55 68.8 172

10 124 83.39 64.5 118

11 128 107.95 70.0 151

12 124 92.41 69.0 155

13 147 85.65 70.5 155

14 90 87.89 66.0 146


15 96 86.54 68.0 135

16 120 85.22 68.5 127

17 102 94.51 73.5 178

18 84 80.80 66.3 136

19 86 88.91 70.0 180

20 84 90.59 76.5 186

21 134 79.06 62.0 122

22 128 95.50 68.0 132

23 102 83.18 63.0 114

24 131 93.55 72.0 171

25 84 79.86 68.0 140

26 110 106.25 77.0 187

27 72 79.35 63.0 106

28 124 86.67 66.5 159

29 132 85.78 62.5 127

30 137 94.96 67.0 191

31 110 99.79 75.5 192

32 86 88.00 69.0 181

33 81 83.43 66.5 143

34 128 94.81 66.5 153

35 124 94.94 70.5 144

36 94 89.40 64.5 139

37 74 93.00 74.0 148

38 89 93.59 75.5 179

> attach(piq)

Error: object 'piq' not found

> attach(iq)

Error: object 'iq' not found

> piq
Error: object 'piq' not found

> attach(iqdata)

> piq

[1] 124 150 128 134 110 131 98 84 147 124 128 124 147 90 96 120 102 84 86 84 134 128 102 131
84

[26] 110 72 124 132 137 110 86 81 128 124 94 74 89

> length(piq)

[1] 38

> length(brain)

[1] 38

> length(height)

[1] 38

> length(weight)

[1] 38

> windows()

> par(mfrow=c(2,3))

> hist(piq)

> plot(brain,piq)

> plot(weight,piq)

> plot(height,piq)

> cor(iqdata)

piq brain height weight

piq 1.000000000 0.3778155 -0.09315559 0.002512154

brain 0.377815463 1.0000000 0.58836684 0.513486971

height -0.093155590 0.5883668 1.00000000 0.699614004

weight 0.002512154 0.5134870 0.69961400 1.000000000

> fit=lm(piq~brain+height+weight)

> fit
Call:

lm(formula = piq ~ brain + height + weight)

Coefficients:

(Intercept) brain height weight

1.114e+02 2.060e+00 -2.732e+00 5.599e-04

> summary(fit)

Call:

lm(formula = piq ~ brain + height + weight)

Residuals:

Min 1Q Median 3Q Max

-32.74 -12.09 -3.84 14.17 51.69

Coefficients:

Estimate Std. Error t value Pr(>|t|)

(Intercept) 1.114e+02 6.297e+01 1.768 0.085979 .

brain 2.060e+00 5.634e-01 3.657 0.000856 ***

height -2.732e+00 1.229e+00 -2.222 0.033034 *

weight 5.599e-04 1.971e-01 0.003 0.997750

---

Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 19.79 on 34 degrees of freedom

Multiple R-squared: 0.2949, Adjusted R-squared: 0.2327

F-statistic: 4.741 on 3 and 34 DF, p-value: 0.007215


> brain=90;height=70;weight=150

> student=data.frame(brain,height,weight)

> student

brain height weight

1 90 70 150

> pred=predict(fit,newdata=student)

> pred

105.6356

>

You might also like