I have the following issue. I have to adjust t-tests for size so that their true size equals the nominal size, and then compute the relative p-values. I aim to estimate the power of size-adjusted tests.

What I have done so far does not involte any size-adjustment. In fact, I obtained the t-statistics as follows

m: t = b:/se

and, then, computed the relative p-values

m: pvalue = 2*ttail(N-k, abs(t)).

However, I get size-uncorrected power tests when I compute the rejection rates based on those p-values. So, the naive comparison of powers is completely uniformative.

I would like to know how I have to proceed to get the empirical critical values that must be used to set the rejection rule. That is, is there a function like ttail() which computes the probability that the t statistics - computed as specified above - exceed the critical value of the statistics from the empirical distribution?

Thank you for any advice you can give me.

]]>

I am doing a 2000 times monte carlo simulation of two-stage least square estimation with random numbers in Mata with following codes, but I do not know how to extract the esimation results from Mata to Stata. My idea is to stack each estimation result on top of the other and get a varible with 2000 observations. But the code return errors: st_store(): 3200 conformability error

<istmt>: - function returned error

Could anyone help me work this out? Thanks!

Code:

clear all set obs 2000 gen B_2SLS =. mata rseed(435632) for (i=1; i<=2000; i++){ R = (1, 0.5\ 0.5, 1) C = cholesky(R) E1 = rnormal(2, 200, 0, 1)' E = E1*C' Z1 = rnormal(5, 200, 0, 1)' Z = Z1*I(5) P0 = 0.01*J(5, 1, 1) B0 = (1) X = Z*P0 + E[., 1] Y = X*B0 + E[., 2] P = Z*luinv(Z'*Z)*Z' B_2SLS = (X'*P*Y) / (X'*P*X) st_store((strtoreal("i")::strtoreal("i"+"1")), "B_2SLS", B_2SLS) } end

I am using the most recent data from the World Value Survey to examine the effects of the interaction, my problem is the following:

In order to assign every country a regimescore I have used the Freedomhouse reports from 2012/13 to generate a new "regimetype" variable, and assigned every observation in the data set with the appropriate score (from 1 to 7). My problem is then: how do i aggregate the scores from each observation, to make it a group level variable? Or is it possible just to run the mixed command like

- mixed prejudice(yvar) c.education(xvar)##c.regimetype(xvar2)||regimetype :

I hope the question makes sense. ]]>

Specifically, I need to perform the same operations on string matrices which are not possible in the ado-language of Stata.]]>

I need to check if two 3D matrices, which represent values at (x,y,z) spatial locations, are equal.

If use an associative array to handle the 3 dimensions, it seems like I need to use a loop.

The simple example below illustrates the issue for a one-dimensional associative array.

Code:

: A=asarray_create("real",1) : : B=asarray_create("real",1) : : asarray(A,1,42) : : asarray(B,1,42) : : A==B 0 : : a=asarray(A,1) : : b=asarray(B,1) : : a==b 1

Specific to this query, I have been curious about using pointers in conjunction with

I wasn't able to find anything specific in the documentation speaking to this, but is my novice's observation accurate, i.e. that

For instance:

Code:

. mata ------------------------------------------------- mata (type end to exit) ---------------------------------------------------- : : p=J(3,1,NULL) : : for (j=1;j<=3;j++) { > p[j]=&I(j) > } : : mata matsave pointmat p, replace (saving p[3,1]) file pointmat.mmat saved : : mata clear : : mata matuse pointmat (loading p[3,1]) : : for (j=1;j<=3;j++) { > *p[j] > } 1 [symmetric] 1 2 +---------+ 1 | 1 | 2 | 0 1 | +---------+ [symmetric] 1 2 3 +-------------+ 1 | 1 | 2 | 0 1 | 3 | 0 0 1 | +-------------+ : : end

P.S. I posted this as a response in an existing thread but realized it should probably be a new posting

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

Letâ€™s assume I have an array called dX composed of 4 matrices X1, X2, X3 and X4 (each of dimensions nxn). Letâ€™s call these the layers of the array. If I want to change element (i,j) in layer k by value z, I would do the following

1. W=asarray(dX,k)

2. W[i,j]=z

3.asarray(dX,k,W)

In step 1 I would obviously recover matrix Xk for the first iteration but after a first round of changes it will not be matrix Xk anymore.

in step 2 I change the element of interest with the wanted value

in step 3 I replace layer k with my new matrix W

I know that we can access element (i,j) of layer k in array dX by typing â€śasarray(dX,k)[1,1]â€ť. Unfortunately typing â€śasarray(dX,k)[1,1]=zâ€ť would not work.

I am pretty sure that my way of proceeding is not efficient, but I did not find any better way up to now.

Any help would be appreciated

All the best

Vincenzo]]>

When I attempt to store the estimates using estso it works, it only stores the coefficient but not the number of observation which results in publishing tables that have empty observations.

I highly appreciate your help.

My code is as follows:

xi: cgmreg neonatal commonlaw rural poor birthinterval i.v106 bord age_mother un_population_density_2015 mother_works malaria_prevalence_2015 land_surface_temperature_2015 aridity_2015 rainfall_2015 dhsyear distkm_sq if distkm<=200, cluster (cohort ethnicity)

eststo neo1

esttab neo1 neo2 neo3 using Neonatal.tex,label nonumbers ///

longtable nogaps p staraux starlevels( * 0.10 ** 0.05 *** 0.01) mtitles( "less than 200 Km" "less than 150 km" "less than 100 Km") compress title(\label{Table 3}Dependent Variable: Neonatal Mortality)

stats(N,fmt(%9.0fc)) addnotes("Standard errors are clustered at the ethnic and country level using the approach of Cameron, Gelbach, and Miller (2011)) replace // ///]]>