Despite searching, I haven't found Stata routines for modelling and graphing models of dose-response data.

In my case, the data is laboratory derived with a continuous outcome (cell viability). Across the concentration gradient of the exposure chemical, the data displays an s-shaped curve with an inflection point (EC50) with upper and lower asymptotes.

Additionally, the data structure is hierarchical, with random effects for batch required.

My aim would be to calculate point estimates and the uncertainty around EC50s (concentration to affect 50% drop in viability) or slope around the inflection point for different drugs and exposure times.

Presumably this is standard stuff, so I'm a bit baffled about not having found any regression methods.

Thankyou,

Janine

]]>

I would like to know how we can perform a dynamic model

Is it correct to go xtabond2 like this:

xtabond2 y L.y x1 x2 x3 i.time, gmm(endogenous var) iv(exogenous var)

or

xtabond2 y L.y x1 x2 x3 i.time, gmm(L.y) iv(x1 x2 x3 i.time)

To be honest, I don't know how Stata runs the above model when L.y is endogenous because as I have read from theory, L.y should be instrumented using L2.y but in xtabond2, "x1 x2 x3 i.time" are all put in iv() rather than L2.y. This brings me to the question that, for 2SLS, which variable should we use to regress L.y on?

ivreg2 y x1 x2 x3 i.time (L.y=L2.y) ???

(If it is better to be more specific, you can use the example of Arellano and Bond (1991) model to give explanation.)

Thank you!]]>

I have data which looks similar to this:

Code:

* Example generated by -dataex-. For more info, type help dataex clear input float(isic3_3d class) 151 1 151 2 151 2 151 1 151 2 151 2 151 1 151 2 151 2 151 1 151 2 151 2 151 1 151 1 151 2 151 2 151 1 151 1 151 2 151 2 151 2 151 1 151 2 151 2 151 2 151 2 151 2 151 2 151 2 151 2 151 2 151 2 151 2 151 2 151 2 151 2 151 2 151 2 151 2 151 2 151 2 151 2 151 2 151 2 151 2 151 2 151 1 151 2 151 2 151 2 151 2 151 2 151 2 151 2 151 2 151 2 151 2 151 2 151 2 151 2 151 2 151 2 151 2 151 2 151 2 151 2 151 2 151 2 151 2 151 2 151 2 151 2 151 2 151 2 151 2 151 2 151 2 151 2 151 2 151 2 151 1 151 2 151 2 151 2 151 2 151 2 151 2 151 2 151 2 151 2 151 2 151 2 151 2 151 2 151 2 151 2 151 2 151 2 151 2 151 2 end label values class x label def x 1 "Intermediate", modify label def x 2 "Consumption", modify

Code:

count if isic3_3d==151 & class==1

Please let me know how I can implement this.

Thanks,

Jad]]>

I have a Stata coding question. Below is a made up dataset with only two variables, state and city.

Code:

* Example generated by -dataex-. For more info, type help dataex clear input str10 state str13 city "california" "san diego" "" "san francisco" "" "santa rosa" "" "los angeles" "texas" "houston" "" "dallas" "" "austin" "new york" "rochester" "" "albany" end

The state variable has missing values. I want to carry forward the values so that it looks like this.

Code:

* Example generated by -dataex-. For more info, type help dataex clear input str10 state str13 city "california" "san diego" "california" "san francisco" "california" "santa rosa" "california" "los angeles" "texas" "houston" "texas" "dallas" "texas" "austin" "new york" "rochester" "new york" "albany" end

I tried using the mipolate package that I found from this entry. I noticed that to use this package, I need a group id variable and a variable to index each group. Unfortunately, my dataset only has two variables. I don't want to manually fill in the state variable. Does anyone have a more efficient solution?

https://www.statalist.org/forums/for...-interpolation]]>

I am using the Stata "mixed" command to run growth curve analysis within the multilevel framework for my dissertation project. I want to conduct full information maximum likelihood (FIML) to deal with missing data and make sure that my analysis has consistent sample size across models that use different independent variables. Does anyone know how to do that? I couldn't find any resource online about how to apply FIML to a growth model with "mixed" command in Stata.

Below is my growth curve model code (without FIML):

mixed cognition i.media##c.wave ///

i.edu i.gender i.race c.basemem ///

c.age i.mar i.live i.work c.inc ///

|| hhidpn: wave, var cov (unstr)

Any help will be appreicated! Thank you very much!

]]>

I have the following data:

Code:

* Example generated by -dataex-. For more info, type help dataex clear input int isic3_4d 121 121 121 121 121 122 122 122 121 121 122 122 122 122 122 122 122 1511 1511 1511 1511 1511 1511 1511 1511 1511 1511 1511 1511 1511 1511 1511 1511 1511 1511 1511 1511 1511 1511 1511 1511 1511 1511 1511 1511 1511 1511 1511 1511 1511 1511 1511 1511 1511 1511 1511 1511 1511 1511 1511 1511 1511 122 1511 1511 1511 1511 1511 1511 1511 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 1512 1512 1512 1512 1512 end

Please let me know how to implement this.

]]>

Code:

* Example generated by -dataex-. For more info, type help dataex clear input int year float(tw_eshare sk_eshare jp_eshare hk_eshare us_eshare ch_eshare) 1999 .353104 .2180597 .132673 .07837033 .013242254 .0037732776 2000 .3613982 .1935984 .14054033 .09470285 .01197752 .0041396185 2001 .3733647 .18836835 .13537122 .09850802 .011657768 .008487331 2002 .3761892 .2064878 .12076926 .11045322 .011942135 .011063125 2003 .3783749 .2163858 .11433821 .09861916 .011756462 .016428739 2004 .3859389 .2263669 .11611678 .08417509 .012050012 .016369808 2005 .3845172 .22625177 .1219711 .07566063 .012466455 .02556598 2006 .37641215 .23493522 .1331212 .070133805 .013106585 .02747921 2007 .3615798 .24617197 .14213298 .06388681 .015180472 .032136057 2008 .3476018 .2535338 .14422223 .06750516 .014348704 .03782948 2009 .3287824 .24717003 .1626905 .06264513 .01920605 .04352529 2010 .3215968 .25062367 .16644105 .06488687 .01863375 .0437016 2011 .3131113 .25433823 .173319 .06182805 .016680311 .04585869 2012 .3052285 .25912577 .17756553 .0608872 .016151281 .04603336 2013 .3044777 .26401043 .1663623 .06046329 .017376207 .04823454 2014 .2974295 .28048614 .1559516 .065785125 .01672531 .05081726 2015 .28691626 .29673535 .14978747 .06400553 .016013706 .05590628 2016 .27359244 .3085391 .143486 .065558076 .015584015 .06190511 2017 .26286304 .3131993 .14147463 .06799361 .015544648 .07033642 end

and the following code:

Code:

twoway (connected tw_eshare year, mcolor(navy) msize(vsmall) msymbol(circle) lcolor(navy) lpattern(solid)) (connected sk_eshare year, mcolor(midgreen) msize(vsmall) msymbol(square) lcolor(midgreen) lpattern(dash)) (connected jp_eshare year, mcolor(purple) msize(vsmall) msymbol(triangle) lcolor(purple) lpattern(longdash)) (connected hk_eshare year, mcolor(maroon) msize(vsmall) msymbol(diamond) lcolor(maroon) lpattern(dash_dot)) (connected us_eshare year, mcolor(orange_red) msize(small) msymbol(lgx) lcolor(orange_red) lpattern(shortdash_dot)) (connected ch_eshare year, mcolor(red) msize(small) msymbol(plus) lcolor(red) lpattern(longdash_shortdash)), legend(off)

Thanks,

Jad]]>

I am estimating the effect of a policy at the state level using a balanced panel of states. The policy implementation falls under the case of staggered diff-in-diff. My issue is I would like to use csdid however I doubt if my sample size is large enough.

Below is a distribution of the year and gvar() .

Code:

tab year ban_date | ban_date year | 0 2008 2009 2010 2011 2016 2018 2019 | Total -----------+----------------------------------------------------------------------------------------+---------- 2006 | 37 1 1 1 1 1 1 1 | 44 2007 | 37 1 1 1 1 1 1 1 | 44 2008 | 37 1 1 1 1 1 1 1 | 44 2009 | 37 1 1 1 1 1 1 1 | 44 2010 | 37 1 1 1 1 1 1 1 | 44 2011 | 37 1 1 1 1 1 1 1 | 44 2012 | 37 1 1 1 1 1 1 1 | 44 2013 | 37 1 1 1 1 1 1 1 | 44 2014 | 37 1 1 1 1 1 1 1 | 44 2015 | 37 1 1 1 1 1 1 1 | 44 2016 | 37 1 1 1 1 1 1 1 | 44 2017 | 37 1 1 1 1 1 1 1 | 44 2018 | 37 1 1 1 1 1 1 1 | 44 2019 | 37 1 1 1 1 1 1 1 | 44 -----------+----------------------------------------------------------------------------------------+---------- Total | 518 14 14 14 14 14 14 14 | 616

As of April, I finished my PHD coursework (in the United States, that means I have only my dissertation and teaching to worry about, as a PHD Candidate). I figured since I now have more time I'd get into independent consulting for data cleaning, advanced causal inference, and research assistance with stats more generally. I suppose my question here is does anyone have experience in this? How far along were you in your education when you started, how did you manage it and make any progress, and what are the main things I may wish to keep in mind for those who are interested in being independent consultants (who still happen to work and be in academia for the long term)? If it helps, I already have a (new!) website (see my bio on my profile) that sort of explains what I do/am interested in. As usual, I'd appreciate any feedback.]]>

In my work, I use the concept of "cultural capital" as a mediator (M). Here I use several variables (e.g. number of books at home, language competence, quantity of reading, etc.) as indicators for "cultural capital".

My model is as follows:

Migration background [dichotomous] (X) ----------------------------> educational choices [continuous] (Y)

-----------> cultural capital (M)->

My question here is how do I proceed with my concept (M) and its large number of indicators in an OLS regression analysis in Stata? Would I have to end up treating every single indicator for my concept (M) as a mediator or is there a way to group all variables together somehow? However, I cannot create a single index with all the variables, as they do not all have the same scaling and it would not make sense to rescale all of them just a few, so I would have less variables but for my taste still too much to do a mediation analyses with Stata.

Thanks for your help already!

Ferris

]]>

How do I best do this?

I found that I need to generate a new variable and for each male participant the value of the new variable takes X (number of female divided by male). And then this should be the weight. But when I am working with it in my command, stata tells me that pweight is not allowed. I plan on using it in a probit regression.

Thank you for taking your time and reading this!

]]>

I am doing a DiD analysis including country and time fixed effects as well as a country-specific time trend (c.year#i.country). Not including the country-specific time trend, the R squared is relatively low at only 0.1. However, when including the time trend, it rises to 0.7. At the same time, both the coefficients for my DiD period dummy and interaction of treatment and period dummy change greatly in magnitude and sign. They are always insignifcant, though.

What exactly does that suggest? My guess would be that there is a high degree of heterogeneity across the countries included in the sample as well as potential issues with the classification of the treatment and control group. Could that be it?

In general, what does the country-specific time trend control for? How is it different to the fixed effects?

Thanks in advance!

Best regards

Clara

]]>

I found the bmaregress function for linear regression.

1) Do you know if this function can be applied after imputing missing data using MICE?

2) My second question is whether the same analysis can be performed for logistic regression.

Thank you for the help.

]]>

I have a dataset with 63,269 records. Values for column SSBSECT_PTRM_START_DATE are not missing for any record. The table command (shown below) produces results showing the correct total, but as you can see, the individual table rows do not sum to the total. When I use the tab command rather than the table command, the correct results are displayed.

Array

]]>

I'm currently analyzing cross-sectional survey data from 28 country-waves, totaling 30,988 observations. My study focuses on the relationship between "satisfaction with democracy" (measured across four categories) and "Asian Values," with a consideration for the moderating effect of "corruption levels," which I assess using either V-dem or CPI.

I utilized multilevel ordered logistic estimate(meologit), I include an interaction between individual-level and country-level continuous variables (Asian values * Corruption level).

I'm seeking guidance on calculating the marginal effects and predicted probabilities of Asian values on satisfaction with democracy across different levels of corruption.

Despite my efforts, I'm encountering challenges in determining the appropriate methods for calculating a continuous-by-continuous interaction in a multilevel model.

Specifically, I aim to predict the probability of receiving scores 3 and 4 on the democratic satisfaction scale.

Below, I've provided my code and results.

I'd greatly appreciate any insights or suggestions on how to proceed with my analysis.

Thank you in advance for your assistance!

Code:

sum demo_satisfy AVS_4D_goertzian_cses_z_1 r_cpi r_v2x_corr Variable | Obs Mean Std. dev. Min Max -------------+--------------------------------------------------------- demo_satisfy | 37,335 2.588376 .7045862 1 4 AVS_4D_goe~1 | 35,595 -4.35e-11 .1879719 -.4720078 .6834241 r_cpi | 37,559 .5182177 .1728828 .2 .76 r_v2x_corr | 38,703 .4324576 .2602557 .088 .789

Code:

meologit demo_satisfy c.AVS_4D_goertzian_cses_z_1 c.r_v2x_corr /// > c.AVS_4D_goertzian_cses_z_1#c.r_v2x_corr /// > $control /// > || n_country: , diff Fitting fixed-effects model: Iteration 0: log likelihood = -33828.686 Iteration 1: log likelihood = -32584.359 Iteration 2: log likelihood = -32572.189 Iteration 3: log likelihood = -32572.177 Iteration 4: log likelihood = -32572.177 Refining starting values: Grid node 0: log likelihood = -32277.857 Fitting full model: Iteration 0: log likelihood = -32277.857 (not concave) Iteration 1: log likelihood = -32268.079 (not concave) Iteration 2: log likelihood = -32261.949 (not concave) Iteration 3: log likelihood = -32256.217 (not concave) Iteration 4: log likelihood = -32254.663 Iteration 5: log likelihood = -32252.719 Iteration 6: log likelihood = -32252.403 Iteration 7: log likelihood = -32252.351 Iteration 8: log likelihood = -32252.351 Mixed-effects ologit regression Number of obs = 32,046 Group variable: n_country Number of groups = 29 Obs per group: min = 632 avg = 1,105.0 max = 1,401 Integration method: mvaghermite Integration pts. = 7 Wald chi2(27) = 1782.44 Log likelihood = -32252.351 Prob > chi2 = 0.0000 ------------------------------------------------------------------------------- demo_satisfy | Coefficient Std. err. z P>|z| [95% conf. interval] --------------+---------------------------------------------------------------- AVS_4D_goer~1 | 1.042765 .1332343 7.83 0.000 .7816307 1.3039 r_v2x_corr | 1.211922 2.228575 0.54 0.587 -3.156005 5.579849 | c. | AVS_4D_goer~1#| c.r_v2x_corr | -.7401299 .241652 -3.06 0.002 -1.213759 -.2665007 | national_ec~1 | .4902225 .01353 36.23 0.000 .4637042 .5167408 inter_polit~1 | .125871 .0138005 9.12 0.000 .0988226 .1529195 female_1 | -.04697 .0222005 -2.12 0.034 -.0904821 -.0034579 education_l~1 | -.0276095 .0059244 -4.66 0.000 -.0392212 -.0159978 income_leve~1 | .0175865 .0095815 1.84 0.066 -.0011929 .036366 age_group_1 | .0074725 .0095896 0.78 0.436 -.0113227 .0262678 urban_1 | -.1941105 .0266462 -7.28 0.000 -.246336 -.141885 log_gdp_per | .0650359 .5343701 0.12 0.903 -.9823104 1.112382 real_gdp_gr~h | .0059382 .0622354 0.10 0.924 -.116041 .1279174 v2x_polyarchy | 1.725386 2.140482 0.81 0.420 -2.469881 5.920652 year_democr~y | -.0062621 .0072102 -0.87 0.385 -.0203938 .0078696 log_district1 | -.3696868 .3125295 -1.18 0.237 -.9822335 .2428598 | year | 2002 | -.0658129 .5084933 -0.13 0.897 -1.062441 .9308157 2003 | .5028068 .5990552 0.84 0.401 -.6713197 1.676933 2005 | -.8269738 .5592569 -1.48 0.139 -1.923097 .2691495 2006 | .4219778 .583083 0.72 0.469 -.7208438 1.564799 2007 | .4208095 .6899593 0.61 0.542 -.931486 1.773105 2010 | .1867433 .6929426 0.27 0.788 -1.171399 1.544886 2011 | .6369974 .5696362 1.12 0.263 -.479469 1.753464 2014 | .3855318 .5933459 0.65 0.516 -.7774048 1.548468 2015 | .7495475 .599657 1.25 0.211 -.4257586 1.924854 2016 | 1.102011 .6494188 1.70 0.090 -.1708261 2.374849 2018 | .5106638 .5976895 0.85 0.393 -.6607861 1.682114 2019 | 1.181593 .5769045 2.05 0.041 .0508812 2.312305 --------------+---------------------------------------------------------------- /cut1 | -.6529692 3.987586 -8.468494 7.162556 /cut2 | 1.773676 3.987562 -6.041802 9.589153 /cut3 | 5.049279 3.987684 -2.766437 12.865 --------------+---------------------------------------------------------------- n_country | var(_cons)| .0857079 .0234122 .0501769 .1463988 ------------------------------------------------------------------------------- LR test vs. ologit model: chibar2(01) = 639.65 Prob >= chibar2 = 0.0000

Code:

margins , dydx(AVS) at(r_v2x_corr=(0.08(0.1)0.79)) expression(predict (outcome(4) mu fixed) + predict(outcome(3) mu fixed)) > vsquish atmean Conditional marginal effects Number of obs = 32,046 Model VCE: OIM Expression: predict (outcome(4) mu fixed) + predict(outcome(3) mu fixed) dy/dx wrt: AVS ------------------------------------------------------------------------------ | Delta-method | dy/dx std. err. z P>|z| [95% conf. interval] -------------+---------------------------------------------------------------- AVS_4D_goe~1 | _at | 1 | .2457272 .0295098 8.33 0.000 .1878892 .3035653 2 | .227108 .0245175 9.26 0.000 .1790545 .2751614 3 | .2069876 .0209084 9.90 0.000 .1660079 .2479673 4 | .1858139 .0166791 11.14 0.000 .1531235 .2185044 5 | .1640518 .014552 11.27 0.000 .1355305 .1925731 6 | .1421609 .0185196 7.68 0.000 .1058632 .1784586 7 | .1205754 .0262524 4.59 0.000 .0691217 .1720291 8 | .0996866 .0340355 2.93 0.003 .0329783 .1663948 ------------------------------------------------------------------------------

Also, I am not sure why there are non-linear results in this marginal effects when I chose to predict 3 score of democratic satisfaction.

Code:

margins , dydx(AVS) at(r_cpi=(0.2(0.2)0.8)) expression(pred > ict(outcome(3) mu fixed)) vsquish atmean ------------------------------------------------------------------------------ | Delta-method | dy/dx std. err. z P>|z| [95% conf. interval] -------------+---------------------------------------------------------------- AVS_4D_goe~1 | _at | 1 | -.0057405 .1134455 -0.05 0.960 -.2280896 .2166087 2 | .1106163 .0333242 3.32 0.001 .0453022 .1759305 3 | .1409644 .0138573 10.17 0.000 .1138047 .1681242 4 | .0994199 .0248382 4.00 0.000 .050738 .1481018 ------------------------------------------------------------------------------ .