<< Chapter < Page Chapter >> Page >

. xtreg depvar [varlist], fe

The command for estimating the random-effects model is:

. xtreg depvar [varlist], re

If the part of the command with the comma and either re or fe is omitted, Stata will assume that you want to estimate the random-effects model.

Understanding stata output

To understand the Stata output we need to return to the algebra of the model. Assume that we are fitting a model of the following form:

y i t = α + j = 1 k β j x j i t + ν i + ε i t , i = 1 , , N , and t = 1 , , T . MathType@MTEF@5@5@+=feaagyart1ev2aaatCvAUfeBSjuyZL2yd9gzLbvyNv2CaerbuLwBLnhiov2DGi1BTfMBaeXatLxBI9gBaerbd9wDYLwzYbItLDharqqtubsr4rNCHbGeaGqiVu0Je9sqqrpepC0xbbL8F4rqqrFfpeea0xe9Lq=Jc9vqaqpepm0xbba9pwe9Q8fs0=yqaqpepae9pg0FirpepeKkFr0xfr=xfr=xb9adbaqaaeGaciGaaiaabeqaamaabaabaaGcbaGaamyEamaaBaaaleaacaWGPbGaamiDaaqabaGccqGH9aqpcqaHXoqycqGHRaWkdaaeWbqaaiabek7aInaaBaaaleaacaWGQbaabeaakiaadIhadaWgaaWcbaGaamOAaiaadMgacaWG0baabeaaaeaacaWGQbGaeyypa0JaaGymaaqaaiaadUgaa0GaeyyeIuoakiabgUcaRiabe27aUnaaBaaaleaacaWGPbaabeaakiabgUcaRiabew7aLnaaBaaaleaacaWGPbGaamiDaaqabaGccaGGSaGaaeiiaiaadMgacqGH9aqpcaaIXaGaaiilaiablAciljaacYcacaWGobGaaiilaiaabccacaqGHbGaaeOBaiaabsgacaqGGaGaamiDaiabg2da9iaaigdacaGGSaGaeSOjGSKaaiilaiaadsfacaGGUaaaaa@646F@

We can sum (13) over t (holding the individual unit constant) and divide by T to get:

y ¯ i = α + j = 1 k β j x ¯ j i + ν i + ε ¯ i , MathType@MTEF@5@5@+=feaagyart1ev2aaatCvAUfeBSjuyZL2yd9gzLbvyNv2CaerbuLwBLnhiov2DGi1BTfMBaeXatLxBI9gBaerbd9wDYLwzYbItLDharqqtubsr4rNCHbGeaGqiVu0Je9sqqrpepC0xbbL8F4rqqrFfpeea0xe9Lq=Jc9vqaqpepm0xbba9pwe9Q8fs0=yqaqpepae9pg0FirpepeKkFr0xfr=xfr=xb9adbaqaaeGaciGaaiaabeqaamaabaabaaGcbaGabmyEayaaraWaaSbaaSqaaiaadMgaaeqaaOGaeyypa0JaeqySdeMaey4kaSYaaabCaeaacqaHYoGydaWgaaWcbaGaamOAaaqabaGcceWG4bGbaebadaWgaaWcbaGaamOAaiaadMgaaeqaaaqaaiaadQgacqGH9aqpcaaIXaaabaGaam4AaaqdcqGHris5aOGaey4kaSIaeqyVd42aaSbaaSqaaiaadMgaaeqaaOGaey4kaSIafqyTduMbaebadaWgaaWcbaGaamyAaaqabaGccaGGSaaaaa@4FAC@

where y ¯ i = t = 1 T y i t T , MathType@MTEF@5@5@+=feaagyart1ev2aaatCvAUfeBSjuyZL2yd9gzLbvyNv2CaerbuLwBLnhiov2DGi1BTfMBaeXatLxBI9gBaerbd9wDYLwzYbItLDharqqtubsr4rNCHbGeaGqiVu0Je9sqqrpepC0xbbL8F4rqqrFfpeea0xe9Lq=Jc9vqaqpepm0xbba9pwe9Q8fs0=yqaqpepae9pg0FirpepeKkFr0xfr=xfr=xb9adbaqaaeGaciGaaiaabeqaamaabaabaaGcbaGabmyEayaaraWaaSbaaSqaaiaadMgaaeqaaOGaeyypa0ZaaSaaaeaadaaeWbqaaiaadMhadaWgaaWcbaGaamyAaiaadshaaeqaaaqaaiaadshacqGH9aqpcaaIXaaabaGaamivaaqdcqGHris5aaGcbaGaamivaaaacaGGSaaaaa@43B1@ x ¯ j i = t = 1 T x i t T , MathType@MTEF@5@5@+=feaagyart1ev2aaatCvAUfeBSjuyZL2yd9gzLbvyNv2CaerbuLwBLnhiov2DGi1BTfMBaeXatLxBI9gBaerbd9wDYLwzYbItLDharqqtubsr4rNCHbGeaGqiVu0Je9sqqrpepC0xbbL8F4rqqrFfpeea0xe9Lq=Jc9vqaqpepm0xbba9pwe9Q8fs0=yqaqpepae9pg0FirpepeKkFr0xfr=xfr=xb9adbaqaaeGaciGaaiaabeqaamaabaabaaGcbaGabmiEayaaraWaaSbaaSqaaiaadQgacaWGPbaabeaakiabg2da9maalaaabaWaaabCaeaacaWG4bWaaSbaaSqaaiaadMgacaWG0baabeaaaeaacaWG0bGaeyypa0JaaGymaaqaaiaadsfaa0GaeyyeIuoaaOqaaiaadsfaaaGaaiilaaaa@449E@ and ε ¯ i = t = 1 T ε i t T . MathType@MTEF@5@5@+=feaagyart1ev2aaatCvAUfeBSjuyZL2yd9gzLbvyNv2CaerbuLwBLnhiov2DGi1BTfMBaeXatLxBI9gBaerbd9wDYLwzYbItLDharqqtubsr4rNCHbGeaGqiVu0Je9sqqrpepC0xbbL8F4rqqrFfpeea0xe9Lq=Jc9vqaqpepm0xbba9pwe9Q8fs0=yqaqpepae9pg0FirpepeKkFr0xfr=xfr=xb9adbaqaaeGaciGaaiaabeqaamaabaabaaGcbaGafqyTduMbaebadaWgaaWcbaGaamyAaaqabaGccqGH9aqpdaWcaaqaamaaqahabaGaeqyTdu2aaSbaaSqaaiaadMgacaWG0baabeaaaeaacaWG0bGaeyypa0JaaGymaaqaaiaadsfaa0GaeyyeIuoaaOqaaiaadsfaaaGaaiOlaaaa@4505@ Thus, (14) uses the mean values for each cross-sectional unit. We can subtract (14) from (13) to get:

( y i t y ¯ i ) = j = 1 k β j ( x j i t x ¯ j i ) + ( ε i t ε ¯ i ) . MathType@MTEF@5@5@+=feaagyart1ev2aaatCvAUfeBSjuyZL2yd9gzLbvyNv2CaerbuLwBLnhiov2DGi1BTfMBaeXatLxBI9gBaerbd9wDYLwzYbItLDharqqtubsr4rNCHbGeaGqiVu0Je9sqqrpepC0xbbL8F4rqqrFfpeea0xe9Lq=Jc9vqaqpepm0xbba9pwe9Q8fs0=yqaqpepae9pg0FirpepeKkFr0xfr=xfr=xb9adbaqaaeGaciGaaiaabeqaamaabaabaaGcbaWaaeWaaeaacaWG5bWaaSbaaSqaaiaadMgacaWG0baabeaakiabgkHiTiqadMhagaqeamaaBaaaleaacaWGPbaabeaaaOGaayjkaiaawMcaaiabg2da9maaqahabaGaeqOSdi2aaSbaaSqaaiaadQgaaeqaaOWaaeWaaeaacaWG4bWaaSbaaSqaaiaadQgacaWGPbGaamiDaaqabaGccqGHsislceWG4bGbaebadaWgaaWcbaGaamOAaiaadMgaaeqaaaGccaGLOaGaayzkaaaaleaacaWGQbGaeyypa0JaaGymaaqaaiaadUgaa0GaeyyeIuoakiabgUcaRmaabmaabaGaeqyTdu2aaSbaaSqaaiaadMgacaWG0baabeaakiabgkHiTiqbew7aLzaaraWaaSbaaSqaaiaadMgaaeqaaaGccaGLOaGaayzkaaGaaiOlaaaa@5BCE@

Equations (13), (14), and (15) are the basis of Stats’s estimates of the parameters of the model. In particular, the command xtreg, fe uses OLS to estimate (15); this is known as the fixed-effects estimator (or the within estimator). The command xtreg, be uses OLS to estimate (14) and is known as the between estimator. The command xtreg, re —the random-effects estimator—is a weighted average of the between and within estimators, where the weight is a function of the variances of and ( and respectively). See Cameron and Trivedi (2005: 705] for a detailed discussion of the random-effects estimator.

In general, you will not make use of the between estimator. However, these three equations do lie at the basis of the goodness-of-fit measures that Stata reports. In particular, Stata output reports three “R-squareds” R-squared is in quotes in this line because these R-squareds do not have all the properties of OLS R-squareds. —the overall-R 2 the between-R 2 and the within-R 2 These three R-squareds are derived using one of the three equations. In particular, the overall- R 2 uses (13); the between- R 2 uses (14); and the within- R 2 uses (15).

A panel data analysis using Stata

In this example we follow the example offered in the Stata manual and use a large data set from the National Longitudinal Survey of wage data on 28,534 women who were between 14 and 26 years of age in 1968. The women were surveyed in each of the 21 years between 1968 and 1988 except for the six years 1974, 1976, 1979, 1981, 1984, and 1986. The study is focused on the determinants of wage levels, as measured by the natural logarithm of real wages.

The commands that Stata uses to load in the panel data example.
Loading in the data set into Stata with a description of the data.

Figure 1 shows the commands used to put the data into Stata . The first command ( set memory 5m ) increases the size of the memory that the program uses; I did this because of the large sample size. The use command accesses that data from the Stata web site. The describe command calls up a description of the variables. Figure 2 presents a summary of the data using the command summerize .

Summary of the panel data set variables.
Summary of the data.

There are several transformations of the variables that we will need. In particular, we want to include the squares of several of the variables in our regression—age ( age ), work experience ( ttl_exp ), and job tenure ( tenure ). The reason we want to use the square of these variables is that we have reason to believe that wages have a non-linear relationship with these variables. For instance, consider the number of years a worker has been on the job, Tenure . Theory suggests that wages increase over a worker’s work-life at a decreasing rate. Thus, if the equation we are estimating is y = ln w = β 0 + β 1 T e n u r e + β 2 T e n u r e 2 + , MathType@MTEF@5@5@+=feaagyart1ev2aaatCvAUfeBSjuyZL2yd9gzLbvyNv2CaerbuLwBLnhiov2DGi1BTfMBaeXatLxBI9gBaerbd9wDYLwzYbItLDharqqtubsr4rNCHbGeaGqiVu0Je9sqqrpepC0xbbL8F4rqqrFfpeea0xe9Lq=Jc9vqaqpepm0xbba9pwe9Q8fs0=yqaqpepae9pg0FirpepeKkFr0xfr=xfr=xb9adbaqaaeGaciGaaiaabeqaamaabaabaaGcbaGaamyEaiabg2da9iGacYgacaGGUbGaam4Daiabg2da9iabek7aInaaBaaaleaacaaIWaaabeaakiabgUcaRiabek7aInaaBaaaleaacaaIXaaabeaakiaadsfacaWGLbGaamOBaiaadwhacaWGYbGaamyzaiabgUcaRiabek7aInaaBaaaleaacaaIYaaabeaakiaadsfacaWGLbGaamOBaiaadwhacaWGYbGaamyzamaaCaaaleqabaGaaGOmaaaakiabgUcaRiabl+UimjaacYcaaaa@54EC@ what we expect is that: y T e n u r e = β 1 + 2 β 2 T e n u r e > 0 MathType@MTEF@5@5@+=feaagyart1ev2aaatCvAUfeBSjuyZL2yd9gzLbvyNv2CaerbuLwBLnhiov2DGi1BTfMBaeXatLxBI9gBaerbd9wDYLwzYbItLDharqqtubsr4rNCHbGeaGqiVu0Je9sqqrpepC0xbbL8F4rqqrFfpeea0xe9Lq=Jc9vqaqpepm0xbba9pwe9Q8fs0=yqaqpepae9pg0FirpepeKkFr0xfr=xfr=xb9adbaqaaeGaciGaaiaabeqaamaabaabaaGcbaWaaSaaaeaacqGHciITcaWG5baabaGaeyOaIyRaamivaiaadwgacaWGUbGaamyDaiaadkhacaWGLbaaaiabg2da9iabek7aInaaBaaaleaacaaIXaaabeaakiabgUcaRiaaikdacqaHYoGydaWgaaWcbaGaaGOmaaqabaGccaWGubGaamyzaiaad6gacaWG1bGaamOCaiaadwgacqGH+aGpcaaIWaaaaa@4E7A@ and 2 y T e n u r e 2 = 2 β 2 < 0. MathType@MTEF@5@5@+=feaagyart1ev2aaatCvAUfeBSjuyZL2yd9gzLbvyNv2CaerbuLwBLnhiov2DGi1BTfMBaeXatLxBI9gBaerbd9wDYLwzYbItLDharqqtubsr4rNCHbGeaGqiVu0Je9sqqrpepC0xbbL8F4rqqrFfpeea0xe9Lq=Jc9vqaqpepm0xbba9pwe9Q8fs0=yqaqpepae9pg0FirpepeKkFr0xfr=xfr=xb9adbaqaaeGaciGaaiaabeqaamaabaabaaGcbaWaaSaaaeaacqGHciITdaahaaWcbeqaaiaaikdaaaGccaWG5baabaGaeyOaIyRaamivaiaadwgacaWGUbGaamyDaiaadkhacaWGLbWaaWbaaSqabeaacaaIYaaaaaaakiabg2da9iaaikdacqaHYoGydaWgaaWcbaGaaGOmaaqabaGccqGH8aapcaaIWaGaaiOlaaaa@4809@ The only way that this last equation can be true is if β 2 < 0. MathType@MTEF@5@5@+=feaagyart1ev2aaatCvAUfeBSjuyZL2yd9gzLbvyNv2CaerbuLwBLnhiov2DGi1BTfMBaeXatLxBI9gBaerbd9wDYLwzYbItLDharqqtubsr4rNCHbGeaGqiVu0Je9sqqrpepC0xbbL8F4rqqrFfpeea0xe9Lq=Jc9vqaqpepm0xbba9pwe9Q8fs0=yqaqpepae9pg0FirpepeKkFr0xfr=xfr=xb9adbaqaaeGaciGaaiaabeqaamaabaabaaGcbaGaeqOSdi2aaSbaaSqaaiaaikdaaeqaaOGaeyipaWJaaGimaiaac6caaaa@3AF6@ Moreover, if this is true, the first-derivative implies that β 1 > 2 β 2 T e n u r e > 0. MathType@MTEF@5@5@+=feaagyart1ev2aaatCvAUfeBSjuyZL2yd9gzLbvyNv2CaerbuLwBLnhiov2DGi1BTfMBaeXatLxBI9gBaerbd9wDYLwzYbItLDharqqtubsr4rNCHbGeaGqiVu0Je9sqqrpepC0xbbL8F4rqqrFfpeea0xe9Lq=Jc9vqaqpepm0xbba9pwe9Q8fs0=yqaqpepae9pg0FirpepeKkFr0xfr=xfr=xb9adbaqaaeGaciGaaiaabeqaamaabaabaaGcbaGaeqOSdi2aaSbaaSqaaiaaigdaaeqaaOGaeyOpa4JaeyOeI0IaaGOmaiabek7aInaaBaaaleaacaaIYaaabeaakiaadsfacaWGLbGaamOBaiaadwhacaWGYbGaamyzaiabg6da+iaaicdacaGGUaaaaa@45CE@ Also, notice that we can determine the number of years in a job when wages reach a peak; y reaches a maximum at the age where y T e n u r e = β 1 + 2 β 2 T e n u r e = 0 MathType@MTEF@5@5@+=feaagyart1ev2aaatCvAUfeBSjuyZL2yd9gzLbvyNv2CaerbuLwBLnhiov2DGi1BTfMBaeXatLxBI9gBaerbd9wDYLwzYbItLDharqqtubsr4rNCHbGeaGqiVu0Je9sqqrpepC0xbbL8F4rqqrFfpeea0xe9Lq=Jc9vqaqpepm0xbba9pwe9Q8fs0=yqaqpepae9pg0FirpepeKkFr0xfr=xfr=xb9adbaqaaeGaciGaaiaabeqaamaabaabaaGcbaWaaSaaaeaacqGHciITcaWG5baabaGaeyOaIyRaamivaiaadwgacaWGUbGaamyDaiaadkhacaWGLbaaaiabg2da9iabek7aInaaBaaaleaacaaIXaaabeaakiabgUcaRiaaikdacqaHYoGydaWgaaWcbaGaaGOmaaqabaGccaWGubGaamyzaiaad6gacaWG1bGaamOCaiaadwgacqGH9aqpcaaIWaaaaa@4E78@ . or when T e n u r e = β 1 2 β 2 . MathType@MTEF@5@5@+=feaagyart1ev2aaatCvAUfeBSjuyZL2yd9gzLbvyNv2CaerbuLwBLnhiov2DGi1BTfMBaeXatLxBI9gBaerbd9wDYLwzYbItLDharqqtubsr4rNCHbGeaGqiVu0Je9sqqrpepC0xbbL8F4rqqrFfpeea0xe9Lq=Jc9vqaqpepm0xbba9pwe9Q8fs0=yqaqpepae9pg0FirpepeKkFr0xfr=xfr=xb9adbaqaaeGaciGaaiaabeqaamaabaabaaGcbaGaamivaiaadwgacaWGUbGaamyDaiaadkhacaWGLbGaeyypa0JaeyOeI0YaaSaaaeaacqaHYoGydaWgaaWcbaGaaGymaaqabaaakeaacaaIYaGaeqOSdi2aaSbaaSqaaiaaikdaaeqaaaaakiaac6caaaa@441A@ The fact that 2 y T e n u r e 2 = 2 β 2 < 0 MathType@MTEF@5@5@+=feaagyart1ev2aaatCvAUfeBSjuyZL2yd9gzLbvyNv2CaerbuLwBLnhiov2DGi1BTfMBaeXatLxBI9gBaerbd9wDYLwzYbItLDharqqtubsr4rNCHbGeaGqiVu0Je9sqqrpepC0xbbL8F4rqqrFfpeea0xe9Lq=Jc9vqaqpepm0xbba9pwe9Q8fs0=yqaqpepae9pg0FirpepeKkFr0xfr=xfr=xb9adbaqaaeGaciGaaiaabeqaamaabaabaaGcbaWaaSaaaeaacqGHciITdaahaaWcbeqaaiaaikdaaaGccaWG5baabaGaeyOaIyRaamivaiaadwgacaWGUbGaamyDaiaadkhacaWGLbWaaWbaaSqabeaacaaIYaaaaaaakiabg2da9iaaikdacqaHYoGydaWgaaWcbaGaaGOmaaqabaGccqGH8aapcaaIWaaaaa@4757@ guarantees that this point is indeed a maximum.

Questions & Answers

where we get a research paper on Nano chemistry....?
Maira Reply
nanopartical of organic/inorganic / physical chemistry , pdf / thesis / review
Ali
what are the products of Nano chemistry?
Maira Reply
There are lots of products of nano chemistry... Like nano coatings.....carbon fiber.. And lots of others..
learn
Even nanotechnology is pretty much all about chemistry... Its the chemistry on quantum or atomic level
learn
Google
da
no nanotechnology is also a part of physics and maths it requires angle formulas and some pressure regarding concepts
Bhagvanji
hey
Giriraj
Preparation and Applications of Nanomaterial for Drug Delivery
Hafiz Reply
revolt
da
Application of nanotechnology in medicine
what is variations in raman spectra for nanomaterials
Jyoti Reply
ya I also want to know the raman spectra
Bhagvanji
I only see partial conversation and what's the question here!
Crow Reply
what about nanotechnology for water purification
RAW Reply
please someone correct me if I'm wrong but I think one can use nanoparticles, specially silver nanoparticles for water treatment.
Damian
yes that's correct
Professor
I think
Professor
Nasa has use it in the 60's, copper as water purification in the moon travel.
Alexandre
nanocopper obvius
Alexandre
what is the stm
Brian Reply
is there industrial application of fullrenes. What is the method to prepare fullrene on large scale.?
Rafiq
industrial application...? mmm I think on the medical side as drug carrier, but you should go deeper on your research, I may be wrong
Damian
How we are making nano material?
LITNING Reply
what is a peer
LITNING Reply
What is meant by 'nano scale'?
LITNING Reply
What is STMs full form?
LITNING
scanning tunneling microscope
Sahil
how nano science is used for hydrophobicity
Santosh
Do u think that Graphene and Fullrene fiber can be used to make Air Plane body structure the lightest and strongest. Rafiq
Rafiq
what is differents between GO and RGO?
Mahi
what is simplest way to understand the applications of nano robots used to detect the cancer affected cell of human body.? How this robot is carried to required site of body cell.? what will be the carrier material and how can be detected that correct delivery of drug is done Rafiq
Rafiq
if virus is killing to make ARTIFICIAL DNA OF GRAPHENE FOR KILLED THE VIRUS .THIS IS OUR ASSUMPTION
Anam
analytical skills graphene is prepared to kill any type viruses .
Anam
Any one who tell me about Preparation and application of Nanomaterial for drug Delivery
Hafiz
what is Nano technology ?
Bob Reply
write examples of Nano molecule?
Bob
The nanotechnology is as new science, to scale nanometric
brayan
nanotechnology is the study, desing, synthesis, manipulation and application of materials and functional systems through control of matter at nanoscale
Damian
Is there any normative that regulates the use of silver nanoparticles?
Damian Reply
what king of growth are you checking .?
Renato
What fields keep nano created devices from performing or assimulating ? Magnetic fields ? Are do they assimilate ?
Stoney Reply
why we need to study biomolecules, molecular biology in nanotechnology?
Adin Reply
?
Kyle
yes I'm doing my masters in nanotechnology, we are being studying all these domains as well..
Adin
why?
Adin
what school?
Kyle
biomolecules are e building blocks of every organics and inorganic materials.
Joe
Got questions? Join the online conversation and get instant answers!
Jobilize.com Reply

Get the best Algebra and trigonometry course in your pocket!





Source:  OpenStax, Econometrics for honors students. OpenStax CNX. Jul 20, 2010 Download for free at http://cnx.org/content/col11208/1.2
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Econometrics for honors students' conversation and receive update notifications?

Ask