I would like to make cross sectional regression over 60 months following the Fama MacBeth procedure. However, I can't figure out how to run it correctly, when I enter "xtfmb x y" with x and y as my variables I get a series of "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xx". Do you know why ?

On the other hand do you know how to simply ask STATA to run a cross sectional regression on a particular date ? I mean, if i want to run a cross sectionnal regression for the month number 12 for example using my entire data set, is it possible ?

Thanks in advance,

Geolien, ]]>

Code:

* Example generated by -dataex-. To install: ssc install dataex clear input int(bank_index year) byte event_t 690 1928 . 690 1929 . 690 1930 . 690 1931 . 690 1932 . 690 1933 . 690 1934 . 690 1935 . 691 1928 . 691 1929 . 691 1930 . 691 1931 . 691 1932 . 691 1933 . 691 1934 . 691 1935 . 692 1928 . 692 1929 . 692 1930 . 692 1931 . 692 1932 . 692 1933 . 692 1934 . 692 1935 . 693 1928 . 693 1929 . 693 1930 . 693 1931 . 693 1932 . 693 1933 . 693 1934 . 693 1935 . 694 1928 . 694 1929 . 694 1930 . 694 1931 . 694 1932 . 694 1933 . 694 1934 . 694 1935 . 695 1928 . 695 1929 . 695 1930 . 695 1931 . 695 1932 . 695 1933 . 695 1934 . 695 1935 . 696 1928 . 696 1929 . 696 1930 . 696 1931 . 696 1932 . 696 1933 . 696 1934 . 696 1935 . 697 1928 . 697 1929 . 697 1930 . 697 1931 . 697 1932 . 697 1933 . 697 1934 . 697 1935 . 698 1928 . 698 1929 . 698 1930 . 698 1931 . 698 1932 . 698 1933 . 698 1934 . 698 1935 . 699 1928 . 699 1929 . 699 1930 . 699 1931 . 699 1932 . 699 1933 . 699 1934 . 699 1935 . 700 1928 . 700 1929 . 700 1930 . 700 1931 . 700 1932 . 700 1933 . 700 1934 . 700 1935 . 701 1928 -6 701 1929 -5 701 1930 -4 701 1931 -3 701 1932 -2 701 1933 -1 701 1934 0 701 1935 . 702 1928 . 702 1929 . 702 1930 . 702 1931 . end]]>

My research is to check if the military expenditure has any impact with the GDP from 1980 to 2013 by using VAR or VEC.

First I checked the stationarity of the varibles, GDP (PIB in Portuguese, in the pictures) and MilitaryExpenditure ( GastoMilitarDefaIPCA2013, in portuese and in the pictures, sorry for the long name), i used Dickey-Fuller for the test, both variables were non-stationary, them i did first difference on both variables and they become stationary, both stationary of first order. Some criterias AK and BIA also suggested that i make first difference in the cointegration test. After that i did the Johansen Test of cointegration, and the result was that GDP(PIB) and MilitaryExpenditure(GastoMilitarDefaIPCA2013) has long run relationship, being cointegrated of Rank (1), with the "Star". Them after running VEC i checked the Error Correction Term, them checking the p-valor it didnt show the casuality in the long run. Now is one of my doubt in the short run, i couldnt find out if there is relationship or not.

Them moving on to check if the model is well specified, i did the Lagrange Multiplier test for autocorrelation and it didnt show autocorrelation, another doubt, at last i did the Jarque-Bera test for error distribution, and my target model, that is MilitaryExpenditure effectiong the GDP, is normaly distributed. Again there is screenshots to see if my interpretation is correct i also didnt know if i did all correctly or if i jumped major steps.

I'm sorry if im asking to much, i'm really lost here on the interpretation. I don't even know if this is the right place.

Thank you in advantage.

WARNING - BIG PICUTRE AHEAD - (https://i.imgur.com/pLtv137.png)

]]>

xtprobit exporter lntotalassets estimate estimate_size linv_sales i.sectoren i.year if avgestimate<0,pa vce(robust)

Note that it is estimated only for risk-taking firms " avgestiamte<0"

The Dataset looks like this:

"Spinning, Weaving, Finishing of Textiles" "(Colony) Sarhad Textile Mills Ltd." 2003 0 6.42859

"Spinning, Weaving, Finishing of Textiles" "(Colony) Sarhad Textile Mills Ltd." 2004 0 6.423734

"Spinning, Weaving, Finishing of Textiles" "(Colony) Sarhad Textile Mills Ltd." 2005 0 6.422103

"Spinning, Weaving, Finishing of Textiles" "(Colony) Sarhad Textile Mills Ltd." 2006 0 6.401873

"Spinning, Weaving, Finishing of Textiles" "(Colony) Sarhad Textile Mills Ltd." 2007 0 6.382574

"Spinning, Weaving, Finishing of Textiles" "(Colony) Thal Textile Mills Ltd." 1999 1 5.797273

"Spinning, Weaving, Finishing of Textiles" "(Colony) Thal Textile Mills Ltd." 2000 1 5.738184

"Spinning, Weaving, Finishing of Textiles" "(Colony) Thal Textile Mills Ltd." 2001 1 5.727824

"Spinning, Weaving, Finishing of Textiles" "(Colony) Thal Textile Mills Ltd." 2002 1 5.701447

"Spinning, Weaving, Finishing of Textiles" "(Colony) Thal Textile Mills Ltd." 2003 1 5.69944

"Spinning, Weaving, Finishing of Textiles" "(Colony) Thal Textile Mills Ltd." 2004 1 6.194814

"Spinning, Weaving, Finishing of Textiles" "(Colony) Thal Textile Mills Ltd." 2005 1 6.265092

"Spinning, Weaving, Finishing of Textiles" "(Colony) Thal Textile Mills Ltd." 2006 1 6.237729

"Spinning, Weaving, Finishing of Textiles" "(Colony) Thal Textile Mills Ltd." 2007 1 6.256276

"Spinning, Weaving, Finishing of Textiles" "(Colony) Thal Textile Mills Ltd." 2008 1 6.156852

"Spinning, Weaving, Finishing of Textiles" "(Colony) Thal Textile Mills Ltd." 2009 1 6.123591

The problem is that coefficients are very small

exporter Coef. | Std. Err. z | P>z | [95% Conf. | Interval] |

lntotalassets .0093449 | .0043098 | 2.17 | 0.030 .0008979 | .0177919 |

estimate .002572 | .0010758 | 2.39 | 0.017 .0004635 | .0046805 |

estimate_size -.0001785 | .0000749 | -2.38 | 0.017 -.0003252 | -.0000318 |

linv_sales .0030466 | .0014534 | 2.10 | 0.036 .000198 | .0058952 |

dy/dx Std. | Err. z | P>z | [95% Conf. Interval] | |

lntotalassets | .0029151 | .0014068 | 2.07 0.038 .0001578 | .0056723 |

estimate | .0008023 | .0003333 | 2.41 0.016 .000149 | .0014557 |

estimate_size | -.0000557 | .0000238 | -2.34 0.019 -.0001024 | -9.01e-06 |

linv_sales | .0009504 | .0004518 | 2.10 0.035 .0000649 | .0018358 |

Are these coefficients and margins very small?

Can I interpret the margins i.e. .0029151 as " 400% or 4 times higher firm size increase the probability of exporting by 2.9%"

Note: the distribution of total assets is such that the max value is about 15 times higher than average value in the dataset..

The attached figure shows the impact of lntotalassets at various estimate(risk-aversion is estimated using following code:

margins, dydx(lntotalassets) at(estimate=(-800(20)600)) vsquish noatlegend

marginsplot, ylin(0)

The is only small impact of lntotalassets on probability of exporting. Since the firm size in the dataset vary too much, can we say this is still significantly larger impact if we are considering a firm which is 4 time larger than average firm?]]>

foreach i of local lidlist {

some code here

* if list ufips has more than one value

* append the id to cities

}

]

]]>

I am using Stata/MP 15 on Windows 10.

I have a question about my code.

I had the following error while running my code:

*: 3900 unable to allocate real <tmp>[536819,536819]

<istmt>: - function returned error

Perhaps I think it is due to 'matsize'.

Please let me know if you know how to solve this problem.

Code:

use "c:\temp\bmi.dta", clear keep person_id last_date endpoint_hcc first_date bmi /// sex age_cat smk2 alccat_miss ht_code hc_code dm_code cirrhosis //============================================================================== // #1: Set survival data for disease free survival analysis stset last_date , failure(endpoint_hcc ==1) id(person_id) origin(first_date) scale(365.25) //============================================================================== // #2: Cox models participants and generate a graph (albumin) *create spline variables for depression score mkspline spline = bmi, nknots(4) displayknots cubic * select 10th percentile as the reference sum bmi, d gen temp_p1 = r(p1) gen temp_p10 = r(p10) gen temp_p99 = r(p99) sort bmi gen bmi_ref50 = round(_N*0.5,0) local ref50 bmi_ref50 gen temp_ref50 = bmi[`ref50'] foreach var of varlist spline* { gen temp_`var'_ref50 = `var' - `var'[`ref50'] } stcox spline* ib2.sex i.age_cat ib1.smk2 i.alccat_miss ht_code hc_code dm_code cirrhosis matrix temp_beta=e(b) matrix beta=temp_beta[1,1..3] matrix list beta svmat beta, names(temp_beta) matrix temp_var=e(V) matrix var=temp_var[1..3,1..3] matrix list var svmat var, names(temp_var) mata: xt_mat = st_data(., "temp_spline1_ref50 temp_spline2_ref50 temp_spline3_ref50") mata: beta_mat = st_data(1, "temp_beta1 temp_beta2 temp_beta3") mata: var_mat = st_data(1::3, "temp_var1 temp_var2 temp_var3") mata: y = xt_mat * beta_mat' mata: se = sqrt(diagonal(xt_mat * var_mat * xt_mat')) mata: st_addvar("double", ("y","se")) mata: st_store(., "y", y) mata: st_store(., "se", se) gen low = y - 1.96 * se gen high = y + 1.96 * se keep bmi y low high temp_ref50 saveold "spline.dta", version(12) replace

]]>

However, I find it difficult to follow to follow the interpretation of the DRF in Figures 1-2 of their study. For instance, I read in page 496 to that a grant of 10,000 Euro leads to an average employment gain score of,0.43 (SE=0.40) and a grant of 20,000 Euro leads to an average employment gain score of 0.96 (SE=0.44).

Please any help on how these figures are deduced so that I can apply in my study?

Best regards!]]>

However, I find it difficult to follow to follow the interpretation of the DRF in Figures 1-2 of their study. For instance, I read in page 496 to that a grant of 10,000 Euro leads to an average employment gain score of,0.43 (SE=0.40) and a grant of 20,000 Euro leads to an average employment gain score of 0.96 (SE=0.44).

Please any help on how these figures are deduced so that I can apply in my study?

Best regards!]]>

If a simple random sample of size \(n\) is drawn from a population of knwon size \(N\), the probability of selection if \(n/N\) and the sampling weight would be:

\[

wt = \frac{N}{n}

\]

For a brief introduction to random sampling see the

Code:

sysuse auto randomtag, count(10) ge(mark) dataex if mark

Code:

clear input float id str18 make int(price mpg rep78) float headroom int(trunk weight length turn displacement) float gear_ratio byte(foreign mark) 6 "Buick LeSabre" 5788 18 3 4 21 3670 218 43 231 2.73 0 1 8 "Buick Regal" 5189 20 3 2 16 3280 200 42 196 2.93 0 1 12 "Cad. Eldorado" 14500 14 2 3.5 16 3900 204 43 350 2.19 0 1 29 "Merc. Bobcat" 3829 22 4 3 9 2580 169 39 140 2.73 0 1 34 "Merc. Zephyr" 3291 20 3 3.5 17 2830 195 43 140 3.08 0 1 38 "Olds Delta 88" 4890 18 4 4 20 3690 218 42 231 2.73 0 1 51 "Pont. Phoenix" 4424 19 . 3.5 13 3420 203 43 231 3.08 0 1 57 "Datsun 210" 4589 35 5 2 8 2020 165 32 85 3.7 1 1 71 "VW Diesel" 5397 41 5 3 15 2040 155 35 90 3.78 1 1 73 "VW Scirocco" 6850 25 4 2 16 1990 156 36 97 3.78 1 1 end label values foreign origin label def origin 0 "Domestic", modify label def origin 1 "Foreign", modify

Code:

su weight, de ge zweight = (weight-r(mean))/(r(sd)/sqrt(r(N))) count if zweight >= 3 & zweight < . count if zweight <= 3