Econometrics Assignment: STATA Tasks 1, 2, and 3 Analysis
VerifiedAdded on  2021/11/12
|8
|828
|162
Homework Assignment
AI Summary
This econometrics assignment solution provides a detailed analysis using STATA, addressing three key tasks. Task 1 involves linear regression, hypothesis testing for linearity, point estimation, variance calculations, and confidence interval estimation. Task 2 focuses on multiple linear regression with three explanatory variables, variance-covariance matrix estimation, and hypothesis testing for the sum of coefficients. Task 3 includes data manipulation, Chow test implementation, and analysis of time-series data using dummy variables. The solution includes detailed STATA code and interpretations, covering various econometric concepts and techniques to analyze economic data and test hypotheses.

ECONOMETRICS - STATA ASSIGNMENT
1
1
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser

TASK 1
*Original Data Opened
use "C:\Users\trishit\Desktop\867165\myZip_867165\ec2017cwdata.dta", clear
*Duplicate removed for merging data sets
duplicates report
duplicates drop
*Randomly 560 samples selected
sample 560,count
*File saved as data1.dat
save "C:\Users\trishit\Desktop\867165\myZip_867165\160074470_data1.dta"
*Task 1
*Linear Regression
regress logy loge
summarize loge
*Test hypothesis for linearity of loge and constant
test (loge _cons)
test (loge)
test (_cons)
*Generate 1 more sample other than 560 observations
merge 1:1 logy loge logk using "C:\Users\trishit\Desktop\867165\myZip_867165\
ec2017cwdata_160074470.dta"
keep if _merge==2
sample 1,count
2
*Original Data Opened
use "C:\Users\trishit\Desktop\867165\myZip_867165\ec2017cwdata.dta", clear
*Duplicate removed for merging data sets
duplicates report
duplicates drop
*Randomly 560 samples selected
sample 560,count
*File saved as data1.dat
save "C:\Users\trishit\Desktop\867165\myZip_867165\160074470_data1.dta"
*Task 1
*Linear Regression
regress logy loge
summarize loge
*Test hypothesis for linearity of loge and constant
test (loge _cons)
test (loge)
test (_cons)
*Generate 1 more sample other than 560 observations
merge 1:1 logy loge logk using "C:\Users\trishit\Desktop\867165\myZip_867165\
ec2017cwdata_160074470.dta"
keep if _merge==2
sample 1,count
2

label variable logy "Y0"
label variable loge "X0"
list
*store the generated sample
gen Y0 = logy
gen X0 = loge
*Append in data1 file for further analyses
append using "C:\Users\trishit\Desktop\867165\myZip_867165\160074470_data1.dta"
* Finding point estimation
gen point_estimate = _b[loge] *X0+ _b[_cons]
display point_estimate
*Finding point estimation for forecast error
predict y_resD, residuals
regress y_resD loge
gen point_estimate_fore = _b[loge] *X0+ _b[_cons]
display point_estimate_fore
*Estimate the variance of the predictor
egen loge_m = mean(loge)
gen dev_2 = (X0-loge_m)^2
gen dev_3 = (loge-loge_m)^2
3
label variable loge "X0"
list
*store the generated sample
gen Y0 = logy
gen X0 = loge
*Append in data1 file for further analyses
append using "C:\Users\trishit\Desktop\867165\myZip_867165\160074470_data1.dta"
* Finding point estimation
gen point_estimate = _b[loge] *X0+ _b[_cons]
display point_estimate
*Finding point estimation for forecast error
predict y_resD, residuals
regress y_resD loge
gen point_estimate_fore = _b[loge] *X0+ _b[_cons]
display point_estimate_fore
*Estimate the variance of the predictor
egen loge_m = mean(loge)
gen dev_2 = (X0-loge_m)^2
gen dev_3 = (loge-loge_m)^2
3
⊘ This is a preview!⊘
Do you want full access?
Subscribe today to unlock all pages.

Trusted by 1+ million students worldwide

egen sum_dev = sum(dev_3)
gen dev = 1/560 + dev_2/sum_dev
egen sd = sd(logy)
display sd
gen var_predict = dev*sd*sd
display var_predict
* variance of the error of prediction
egen loge_y_resD = mean(loge)
gen y_resD_2 = (X0-loge_y_resD)^2
gen y_resD_3 = (loge-loge_y_resD)^2
egen sum_y_resD = sum(y_resD_3)
gen resD = 1+ 1/560 + y_resD_2/sum_y_resD
egen sd_y_resD = sd (y_resD)
gen var_resD = resD*sd_y_resD*sd_y_resD
display var_resD
* 95% confidence interval of estimator
regress logy loge if loge != X0
*predicted values
predict y_pre, xb
egen sd_pre = sd (y_pre)
gen se_pre = sd_pre/sqrt(560)
gen LL = point_estimate - 1.96*se_pre
4
gen dev = 1/560 + dev_2/sum_dev
egen sd = sd(logy)
display sd
gen var_predict = dev*sd*sd
display var_predict
* variance of the error of prediction
egen loge_y_resD = mean(loge)
gen y_resD_2 = (X0-loge_y_resD)^2
gen y_resD_3 = (loge-loge_y_resD)^2
egen sum_y_resD = sum(y_resD_3)
gen resD = 1+ 1/560 + y_resD_2/sum_y_resD
egen sd_y_resD = sd (y_resD)
gen var_resD = resD*sd_y_resD*sd_y_resD
display var_resD
* 95% confidence interval of estimator
regress logy loge if loge != X0
*predicted values
predict y_pre, xb
egen sd_pre = sd (y_pre)
gen se_pre = sd_pre/sqrt(560)
gen LL = point_estimate - 1.96*se_pre
4
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser

display LL
gen UL = point_estimate + 1.96*se_pre
display UL
TASK 2
*Task 2
use "C:\Users\trishit\Desktop\867165\myZip_867165\160074470_data1.dta", clear
*linear regression log(profits) expressed as logy on the three explanatory
*variables loge, logk and logm
regress logy loge logk logm
* estimated variance-covariance matrix
estat vce
matrix b = e(V)
*Vectorise the matrix
matrix list b
matrix C = vec(b)
matrix list C
*to find 955 confidence interval for linear combination of beta1(cons) and beta4
lincom _b[_cons] + _b[logm]
5
gen UL = point_estimate + 1.96*se_pre
display UL
TASK 2
*Task 2
use "C:\Users\trishit\Desktop\867165\myZip_867165\160074470_data1.dta", clear
*linear regression log(profits) expressed as logy on the three explanatory
*variables loge, logk and logm
regress logy loge logk logm
* estimated variance-covariance matrix
estat vce
matrix b = e(V)
*Vectorise the matrix
matrix list b
matrix C = vec(b)
matrix list C
*to find 955 confidence interval for linear combination of beta1(cons) and beta4
lincom _b[_cons] + _b[logm]
5

*the production function is Y = A e^beta1 * m^beta2 +k^beta3
*If production function is homogeneous of degree 0 in e, k and m
*Then Y(te,tm,tk) = (te)^beta1 * (tm)^beta2 * (tk)^beta3
*Hence for homogeneous of degree 0, beta1 + beta2 + beta 3 = 0
*We test the hypothesis that beta1 + beta2 + beta 3 = 0 at 5% level of significance
lincom _b[loge] + _b[logk] + _b[logm]
TASK 3
*Task 3
*Generating 200 Observations other than first 560 samples
use "C:\Users\trishit\Desktop\867165\myZip_867165\160074470_data1.dta", clear
merge 1:1 logy loge logk using "C:\Users\trishit\Desktop\867165\myZip_867165\
ec2017cwdata_160074470.dta"
keep if _merge==2
sample 200,count
save "C:\Users\trishit\Desktop\867165\myZip_867165\160074470_data2.dta"
append using "C:\Users\trishit\Desktop\867165\myZip_867165\160074470_data1.dta"
*saving the appended data in new file
save "C:\Users\trishit\Desktop\867165\myZip_867165\160074470_data3.dta"
clear
*exercise on the CLRM - Chow Test
use "C:\Users\trishit\Desktop\867165\myZip_867165\160074470_data3.dta", clear
*restricted regression with total data
reg logy loge logm logk
6
*If production function is homogeneous of degree 0 in e, k and m
*Then Y(te,tm,tk) = (te)^beta1 * (tm)^beta2 * (tk)^beta3
*Hence for homogeneous of degree 0, beta1 + beta2 + beta 3 = 0
*We test the hypothesis that beta1 + beta2 + beta 3 = 0 at 5% level of significance
lincom _b[loge] + _b[logk] + _b[logm]
TASK 3
*Task 3
*Generating 200 Observations other than first 560 samples
use "C:\Users\trishit\Desktop\867165\myZip_867165\160074470_data1.dta", clear
merge 1:1 logy loge logk using "C:\Users\trishit\Desktop\867165\myZip_867165\
ec2017cwdata_160074470.dta"
keep if _merge==2
sample 200,count
save "C:\Users\trishit\Desktop\867165\myZip_867165\160074470_data2.dta"
append using "C:\Users\trishit\Desktop\867165\myZip_867165\160074470_data1.dta"
*saving the appended data in new file
save "C:\Users\trishit\Desktop\867165\myZip_867165\160074470_data3.dta"
clear
*exercise on the CLRM - Chow Test
use "C:\Users\trishit\Desktop\867165\myZip_867165\160074470_data3.dta", clear
*restricted regression with total data
reg logy loge logm logk
6
⊘ This is a preview!⊘
Do you want full access?
Subscribe today to unlock all pages.

Trusted by 1+ million students worldwide

gen rssr=_result(4)
gen df_rssr=_result(3)
gen numdf=(3-1)*(_result(3)+1)
gen dendf=_result(1)-3*(_result(3)+1)
*regression with old 560 sample
reg logy loge logm logk if _merge==.
gen rss200=_result(4)
*regression with new 200 sample
reg logy loge logm logk if _merge==2
gen rss560=_result(4)
gen rssu=rss200+rss560
gen df_rssu = dendf
*F-stat and p-value calculation
gen fstat=( (rssr-rssu)/numdf)/((rssu)/dendf)
gen pval=Ftail(numdf,dendf,fstat)
*Displaying results Chow-Test
display rssr
display df_rssr
display rssu
display df_rssu
display fstat
7
gen df_rssr=_result(3)
gen numdf=(3-1)*(_result(3)+1)
gen dendf=_result(1)-3*(_result(3)+1)
*regression with old 560 sample
reg logy loge logm logk if _merge==.
gen rss200=_result(4)
*regression with new 200 sample
reg logy loge logm logk if _merge==2
gen rss560=_result(4)
gen rssu=rss200+rss560
gen df_rssu = dendf
*F-stat and p-value calculation
gen fstat=( (rssr-rssu)/numdf)/((rssu)/dendf)
gen pval=Ftail(numdf,dendf,fstat)
*Displaying results Chow-Test
display rssr
display df_rssr
display rssu
display df_rssu
display fstat
7
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser

display pval
* sample data have a time dimension called month
gen month=0 if _merge==.
replace month=1 if _merge==2
*Task 3.5 Chow-Test from Dummy month
gen g2 = loge*month
reg logy loge month g2
test month g2
gen differential_intercept = _b[month]
gen differential_slope_coefficients = _b[g2]
display differential_intercept
display differential_slope_coefficients
*Task 3.6
test (month)
test (g2)
/*Task 3.7: as both differential_intercept and differential_slope_coefficients
are almost equal to zero, the regression liones are coincidental*/
8
* sample data have a time dimension called month
gen month=0 if _merge==.
replace month=1 if _merge==2
*Task 3.5 Chow-Test from Dummy month
gen g2 = loge*month
reg logy loge month g2
test month g2
gen differential_intercept = _b[month]
gen differential_slope_coefficients = _b[g2]
display differential_intercept
display differential_slope_coefficients
*Task 3.6
test (month)
test (g2)
/*Task 3.7: as both differential_intercept and differential_slope_coefficients
are almost equal to zero, the regression liones are coincidental*/
8
1 out of 8
Your All-in-One AI-Powered Toolkit for Academic Success.
 +13062052269
info@desklib.com
Available 24*7 on WhatsApp / Email
Unlock your academic potential
Copyright © 2020–2026 A2Z Services. All Rights Reserved. Developed and managed by ZUCOL.