# Statistics and Data Analysis Computer Coding Task

User Generated

QlynaDaa

Business Finance

### Unformatted Attachment Preview

User generated content is uploaded by users for the purposes of learning and should be used following Studypool's honor code & terms of service.

## Explanation & Answer

View attached explanation and answer. Let me know if you have any questions.Done with 1st part. Working on manual questions now

1.
Code:
use "C:\Users\guest\Downloads\ cap-mob.dta"
scatter INV SAV
Output:

30
25
20
10

15

INV

10

20

30
SAV

2.
Code:
regress inv sav
Output:
Source

SS

df

MS

Model
Residual

365.342815
302.516475

1 365.342815
32 9.45363983

Total

667.85929

33 20.2381603

inv

Coef.

sav
_cons

.4462285
9.920274

Number of obs
F(1, 32)
Prob > F
R-squared
Adj R-squared
Root MSE

=
=
=
=
=
=

Std. Err.

t

P>|t|

[95% Conf. Interval]

.0717805
1.699155

6.22
5.84

0.000
0.000

.3000164
6.459209

Model: inv= 9.920274 + 0.4462285*sav
3.
Code:

34
38.65
0.0000
0.5470
0.5329
3.0747

.5924407
13.38134

40

50

gen yhat = 9.920274 + 0.4462285*sav
Output:

4.
Code:
gen residuals = inv-yhat
Output:

5.
SSR
Code:
egen ybar = mean(inv)
gen SSr =(yhat-ybar)^2
summarize SSr
display r(sum)
Output:

365.34274
SSE
Code:
gen SSe =(yhat-inv)^2
summarize SSe
display r(sum)
Output:
302.51645

SST
Code:
gen SSt =(inv- ybar)^2
summarize SSt
display r(sum)
Output:
667.85928

R-Squared value
Code: display 365.34272/667.85928
Output: .54703548

Conclusions: The values are the same as those obtained from the regression output.
6.

Code:
scatter residuals sav
Output:

6
4
-4

-2

0

2

residuals

10

20

30
SAV

40

50

Conclusion:
The plot appears to show randomity with no clear pattern indicating that Var (ei|X) is constant.
7.

Code:
regress inv sav, noconstant
Output:
Source

SS

Model
Residual

13591.0319
624.757261

Total

14215.7892

inv
sav

df

Number of obs
F(1, 33)
1 13591.0319 Prob > F
33 18.9320382 R-squared
Adj R-squared
34 418.111446 Root MSE

Coef. Std. Err.
.8446181 .0315234

Conclusion:

MS

t

P>|t|

26.79 0.000

=
=
=
=
=
=

34
717.89
0.0000
0.9561
0.9547
4.3511

[95% Conf. Interval]
.7804833

.9087529

The model is a better fit as the r squared value is much higher than for the model with a constant. The
model is justifiable as it is significant and has a much better r-squared value.

8.
Code:
gen sav2 = sav^2
regress inv sav sav2
Output:
Source

SS

df

MS

Model
Residual

378.449998
289.409291

2
31

189.224999
9.33578358

Total

667.85929

33

20.2381603

inv

Coef.

sav
sav2
_cons

.7912527
-.0064657
5.779253

Std. Err.
.2997956
.0054568
3.881377

t
2.64
-1.18
1.49

Number of obs
F(2, 31)
Prob > F
R-squared
Adj R-squared
Root MSE

P>|t|
0.013
0.245
0.147

=
=
=
=
=
=

34
20.27
0.0000
0.5667
0.5387
3.0555

[95% Conf. Interval]
.1798156
-.0175949
-2.136869

1.40269
.0046635
13.69537

Conclusion:
The non linear model is slightly better as the r squared value is higher than that of the linear...

Review
Review

Anonymous
Great content here. Definitely a returning customer.

Studypool
4.7
Trustpilot
4.5
Sitejabber
4.4