-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmovies-solutions.do
71 lines (40 loc) · 1.46 KB
/
movies-solutions.do
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
*****MOVIES DO FILE*******
*** LOADING DATA SLIDES ***
*** Exercise (2) ***
import excel movie_metadata.xls, clear firstrow
drop if duration <= 45
keep duration gross movie_title country budget imdb_score
//keep if country == "USA"
save movies, replace
*** VARIABLES SLIDES***
*** Exercise (2) ***
use movies, clear
encode(country), gen(country_code)
codebook country_code
tabulate country_code
drop if missing(country_code)
generate cheap = 0 if budget > 1000000 & !missing(budget)
replace cheap = 1 if budget <= 1000000
rename cheap expensive
recode expensive (0 = 1) (1 = 0)
notes country_code: Cale Basaraba 07/26/2017
notes expensive: Cale Basaraba 07/26/2017
notes
save movies, replace
*** COMMANDS SLIDES ***
*** Exercise (2) ***
use movies, clear
tabstat duration gross budget imdb_score, statistics(mean count p25 p75 range)
pwcorr duration gross budget imdb_score, sig
bysort expensive: tabstat duration gross budget imdb_score, ///
statistics(mean count p25 p75 range)
*** GRAPHS SLIDES***
*** Exercise (1) ***
use movies, clear
graph twoway scatter gross budget, xscale(log) yscale(log) name(gross_budget_log)
graph box imdb_score, over(expensive) name(imdb_expensive)
graph bar, over(country_code, label(angle(vertical))) name(movies_country)
graph combine gross_budget_log imdb_expensive movies_country, cols(1)
graph save movies_col, replace
graph combine gross_budget_log imdb_expensive movies_country, rows(1)
graph save movies_row, replace