* HINT:
* The program assumes that all files are stored in
* C:\monographregression\computercode
* change directory if code is located elsewhere
clear
cd C:\monographregression\computercode
use "data\stata\rent98_00.dta"
* Delete observations with area larger than 160
drop if area > 160
* Center invarea around zero
sum invarea
gen areainvc = invarea-_result(3)
* Create orthogonal polynomials of yearc
orthpoly yearc , generate(yearco yearco2 yearco3) degree(3)
* Model beta_0 + beta_1*areainvc + beta_2*yearc + beta_3*yearc^2 + beta_4*yearc^3 +
* + beta_5*nkitchen + beta_6*pkitchen + beta_7*year01 + epsilon
gen co = 1
regress rentsqm_euro co areainvc yearco yearco2 yearco3 nkitchen pkitchen year01, noconst
* Covariance matrix and regressio coefficients
matrix cov = e(V)
matrix beta = e(b)
* Calculate the test statistic F
matrix C = (cov[6,6] , cov[6,7] \ /*
*/ cov[7,6] , cov[7,7])
matrix beta1 = ( beta[1,6] \ beta[1,7] )
* calculate test statistic by hand
matrix F = 1/2*beta1'*inv(C)*beta1
matrix list F
* Test nkitchen = 0, pkitchen = 0 using stata command `test'
test nkitchen pkitchen