rdbwselect y x, bwselect(IK) kernel(uniform)

rd y x, kernel(rectangle)

Neither do I get the same bandwidth if I use the default (triangular) kernel. Why is that?

Thank you for your help.]]>

I have a panel data formed like below:

firm(i) country(j) choice year(t)

1 USA 1 2000

1 CAN 0 2000

1 JPN 1 2000

1 USA 0 2001

1 CAN 1 2001

1 JPN 1 2001

1 KOR 0 2001

Choice equal to 1 if firm i choice country j at year t. The multiple positive outcomes within groups encountered.

There are several independent variables in the model : Xit is the firm-characteristics and Yjt is the country attributes.

Base on these information, I think clogit is my best choice.

But according to the instruction in http://www.stata.com/manuals13/rclogit.pdf, it only allow two dimensions: individual and time (i and t in my case). That is obvious not fit for my data.

Is there anything I can do to fix the problem? Or is there any better model to fit my data?

Thanks.

Best,

Tom

]]>

Is it possible to use the code below or to convert it to Anova? Please tell me how.

I've checked several online topics about this but none of them are clear enough unfortunately.

:

bys Agequintiles monthyear: egen mean_Agequintiles = mean(Areturn) sort date *Making the alpha gen fourfac_alpha_Agequintiles = . levelsof UniqueID1, local(fundnum) foreach id of local fundnum { quietly regress mean_Agequintiles risk_premium if UniqueID1 == `id' replace fourfac_alpha_Agequintiles = _b[_cons] if e(sample) } robvar fourfac_alpha_Agequintiles, by(Agequintiles) *If the F test is significant, then assume unequal variances ttest fourfac_alpha_Agequintiles, by(Agequintiles) unequal

At the moment, I'm doing my basic graph as:

:

graph twoway (line var_mm var_yy date),

Thanks]]>

I came across one way to enter every value manually but there's probably a much better program.]]>

When I use import excel to import the file I get a date variable that is stored as a double and formatted %td. If I list the data, everything looks fine. A visual comparison of the data and the excel spreadsheet show that everything matches and it appears that I have a daily date. When I tabulate the date variable, though, it becomes clear that something is wrong, as shown below. (Note that the date variable addmission was misspelled on arrival)

:

import excel "patients V4 7-1 to 7-8.xls", sheet("Sheet1") cellrange(A4:Z115) firstrow clear case(lower) . desc addmission storage display value variable name type format label variable label ---------------------------------------------------------------- addmission double %td Addmission . sort addmission . list addmission in 1/5 +-----------+ | addmiss~n | |-----------| 1. | 01jul2014 | 2. | 01jul2014 | 3. | 01jul2014 | 4. | 01jul2014 | 5. | 01jul2014 | +-----------+ . . tab addmission in 1/5 Addmission | Freq. Percent Cum. ------------+----------------------------------- 01jul2014 | 1 20.00 20.00 01jul2014 | 1 20.00 40.00 01jul2014 | 1 20.00 60.00 01jul2014 | 1 20.00 80.00 01jul2014 | 1 20.00 100.00 ------------+----------------------------------- Total | 5 100.00 . . /*some investigating reveals that the underlying variable that Stata has imported is not an integer as I would expect */ . . format addmission %25.0g . . list addmission in 1/5 +--------------------+ | addmission | |--------------------| 1. | 19905.013888888891 | 2. | 19905.050694444442 | 3. | 19905.055555555555 | 4. | 19905.386111111111 | 5. | 19905.435416666667 | +--------------------+ .

I'm only interested in the date portion of the date so it's easy enough to solve this problem with

gen admitdate=int(addmission)

This seems like odd behavior to me, though. By default I would expect Stata to ignore the Excel formatting and import the variable as date and time (integer formatted as %tc). If it didn't do that, I would expect Stata to respect the excel formatting and just import the date portion (integer formatted as %td). The fact that the variables is imported as some sort of weird mix of daily date and fractional time doesn't seem to be desirable to me.

I'm reluctant to declare this a bug, but I thought it worth noting publicly since it struck me as unexpected behavior.

]]>

I am currently new to Stata and I am trying to make a differences-in-differences analysis using electoral panel data within two years (1997 and 2000) where the treatment takes place in 2000 over a set of municipalities. I used the following code:

:

xtreg id year xtreg yvar treatment year=2000 treatment*year [a set of controls], fe

Thanks in advance,

Iván Higuera

]]>

I have panel data and want to count all the groups that satisfy a certain condition, i.e. a dummy variable ==1. All my groups have a varying number of observations (some have only 3, some have 6, and so on). The dummy variable is time-invariant / does not change over time and remains the same value per group. I would like to know how many individual groups have dummy var == 1 and how many var == 0. Please help me out here, thank you!]]>

I had some occasions to use eivreg in Stata, but I always found the absence of standardized coefficient somewhat regrettable, especially when I usually report both the standardized and unstandardized coefficients. If it's not reported in eivreg, how would you compute the standardized coefficient ? Generally, it's done by coeff(X)/SD(Y)*SD(X). However, eivreg is supposed to correct for measurement error, and there is no reason why the SD of the corrected independent variable(s) should remain the same. If anything, the SD should be lower. If you have any ideas...]]>

I am stuck with a problem I am facing with a string variable for a while. After doing some manipulation, my variable looks something like this:

PUERTO WILCHES |

BARRANQUILLA |

vereda de Riogrande de APARTADO |

PUERTO WILCHES |

BARRANQUILLA |

APARTADO |

Best regards,

Carlos

]]>

I am stuck with a problem I am facing with a string variable for a while. After doing some manipulation, my variable looks something like this:

PUERTO WILCHES |

BARRANQUILLA |

vereda de Riogrande de APARTADO |

PUERTO WILCHES |

BARRANQUILLA |

APARTADO |

Best regards,

Carlos

]]>

I'm having a problem with running a loop xbar control chart. What i'm trying to do is produce a control chart for every week of my observations. And i want to output the number of violations for each week and the number of observations to give me a score of [1-(violations/observations)*100]

The code i'm using is the following:

foreach i of local levels {

summarize AM if week==`i'

local x=`r(mean)'

display `x'

local s=`r(sd)'

display `s'

local u=`x'+(3*`s')

display `u'

local t=`x'-(3*`s')

display `t'

local z=`x'-(100*`s')

replace AM=0 if AM==. & week==`i'

xchart days AM if week==`i', lower(`t') upper(`u')

gen total`i'=`r(N)'

gen violations`i'=`r(out_x)'

gen AMscore`i'=(1-(violations`i'/total`i'))*100

}

I'm running into three problems:

1. For some reason the local values aren't being saved properly and the control charts are being produced with limits based on the last week of observations

2. For some reason the values being plotted in the control chart don't match the actual values in my database

3. The output from the control chart, ie. the number of observations, is saving as total observations, not number of observations per week.

If anyone has any advice i'd really appreciate. I've spent the whole day today trying to figure this out;

I'm sure its some simple mistake i'm making.

thanks everyone

imran

]]>

Thanks in advance ]]>

How can I test that the median of cumulative abnormal returns for a sample of firms is statistically different from zero in stata? I have already shown significance for the mean but now I need to show that also for the median.

Thank you in advance,

Natalia

]]>