Quantcast
Channel: Statalist
Viewing all 73375 articles
Browse latest View live

Out-of-Sample Forecast GARCH(1,1)

$
0
0
Hi,

I am running a GARCH(1,1). I am using all observations but 90 to estimate the model. I would like to create an out of sample forecasting with the last 90 remaining observations. I have tried to do "statistics> Times Series > Forecasting" but the GARCH option does not appear (screenshot enclosed). How can I do that?

Array

ml model'ing a heckman estimator

$
0
0
I am trying to program an extension to the Heckman model, but before starting on that project, I'd like to be able to code the standard Heckman model. However, I keep getting the error message. I'm using the "official" example used to demonstrate the heckman command, so I'd be surprised the error is due to some data peculiarity. However, even after hours of staring, googling and trying different things, I'm still not a single step further.

The Heckman likelihood function has two parts. The first is the likelihood of not observing y (the dependent variable) given some observables z. This is the first part of `lnf'.
The second part is the combination of a) observing some y and b) observing this y in particular given some observables x. This is the second part of `lnf'. Part b) is somewhat like the inverse of the first part, but also taking into account the information from the x-observables.

I have copied the likelihoodfunction from "Notes on Sample Selection Models", by Bronwyn Hall, available from the author's website (download link).

I feel I just made some stupid mistake somewhere but I just can't find it. Does anywhere here have an idea?

Code:
could not calculate numerical derivatives -- discontinuous region with missing values encountered
Code:
use "http://www.stata-press.com/data/r14/womenwk.dta", clear
cap program drop _all

capture program drop ml_heckman
program ml_heckman
    version 10.1
    args lnf xb zd sigma rho
    
    local y "$ML_y1"
    
    quietly replace `lnf' =  log(1 - normal(`zd'))                                                                                         if missing(`y') == 1    // Dep-var unobserved
    quietly replace `lnf' =  lnnormalden(`y', `xb', `sigma') + lnnormal((`zd' + `rho'/`sigma'*(`y' - `xb'))/sqrt(1 - `rho'^2))     if missing(`y') == 0    // Dep-var observed
end

local dep = "wage"
local ind = "educ age"

local selind = "married children educ age"

quietly {
    heckman `dep' `ind', select(`selind')
    mat eb = e(b)
    mat wageb = eb[1, 1..3]
    mat selectb = eb[1, 4..8]
    mat rho = e(rho)
    mat sigma = e(sigma)
    
    mat all = [wageb, selectb, rho, sigma]
}

noisily di "ml model lf ml_heckman (xb: `dep' = `ind') (zd: `selind') (sigma:) (rho: ), vce(robust)"
ml model lf ml_heckman (xb: `dep' = `ind') (zd: `selind') (sigma:) (rho: ), vce(robust)

ml init all, copy

ml maximize, trace

Xtmelogit and Marginal effects

$
0
0
I'm trying to learn xtmelogit and I'm having some difficulty with the marginal effects. Essentially, I run a command that looks like: xtmelogit y Control1 Control2 Control3 Control4 x1 x2 || Level2: || Level1:

where x1 and x2 are categorical dichotomous variables.

I've read (and tried out the suggestions) from the two links below, but it's just not clicking.

http://www.ats.ucla.edu/stat/stata/f...logit_prob.htm
and
http://www.ats.ucla.edu/stat/stata/f..._xtmelogit.htm

Any help is appreciated.

Cluster analysis to create asset index

$
0
0
Hello i am new to the forum

I was wondering if any of you Stata geniuses could be so kind as to help me.

I am attempting to use the command cluster kmedians $assets, k(5) to create an asset index. ($assets refers to a sum of durable assets (tv, radio etc) which are binary variables).
Ideally it should come out with 5 quintiles each referring to different levels of socioeconomic status.
i.e 1 = 0-3 assets
2 = 4 assets
3 = 5-6 assets
4 = 7-11 assets
5 = 12 - 22 assets
Yet it is distributing them evenly with each cluster having the same number of assets.

If anyone can help me it would be most appreciated.

Thanks in advance

About groups inside studies of inequality

$
0
0
Hello everyone, Anyone know how i can label the groups generate by command ineqdeco? Thanks

Looping nested If/Or across multiple string variables

$
0
0
Hello. I am using Stata 14.1. I have data on contract terms for approximately 130,000 observations containing over 200 variables. For each unique observation I have data on all contract terms used for that observation. These contract terms have both a generic and specific variable. Each contains the type of contract term using a string (Accounting, Stock Price, etc.). I would like to create new variables (indicator variables) taking the value of one if an observation has ANY contract term containing the string "Accounting". Further, I would like to create another variable containing the count of all contract terms containing the string "Accounting". I believe the anycount program has this capability if my variables contained numerical values. I cannot, however, locate a program to look across multiple string variables. Additionally, it seems a bit clunky to try and write a loop using IF and OR to deal with looking across this large number of variables. Any insight on how to streamline this process would be appreciated.

A sample of the data is below.

Thanks,

Melissa Martin

Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input byte uniqueid str11 contract_term1_gen str10 contract_term1_spec str11 contract_term2_gen str6 contract_term2_spec str11 contract_term3_gen str10 contract_term3_spec byte(Accounting StockPrice Other eps ebit)
1 "Accounting"  "EBITDA"     "Stock Price" ""       "Stock Price" ""           . . . . .
2 "Stock Price" ""           "Accounting"  "EBIT"   "Other"       "Cust. Sat." . . . . .
3 "Accounting"  "EPS"        "Accounting"  "EBIT"   "Accounting"  "Sales"      . . . . .
4 "Other"       "Cust. Sat." "Other"       "Safety" "Other"       "MTB"        . . . . .
5 "Other"       "Emp. Sat."  "Accounting"  "EPS"    "Other"       "Safety"     . . . . .
end

Can (should) the confidence interval on the RMSEA be changed?

$
0
0
Hi all,

For a recent paper, I ran a pretty standard SEM model in Stata 14 and used the estat gof, stats(all) command to get the fit indices. I reported (along with other fit indices) the RMSEA with the 90% confidence intervals. The paper has received a revise and resubmit, but the editor asked that I give the 95% confidence intervals instead. Is there a way to get this through Stata? Or should I just calculate myself? I am also wondering about the appropriateness of this, considering that when I see the RMSEA CI's given in papers, the usual is for 90% and the references I've found (Kline, 2005; Kenny, Kaniskan, & McCoach, 2015) all use 90%, not 95%. Advice?

Thanks.

Postfile only posting to the first row of new dataset when used in a loop

$
0
0
Hello Statalisters,

I'm having a small issue with postfile that i'm unable to work around. I'm using postfile to store some values from a matrix of regression results at the end of a simulation, but it's only printing to the first row in the new dataset. As such I should end up with hundreds of rows, but i'm only ending up with one. Does anyone have any thoughts on why this is?

I've highlighted in red below the bit that's not working exactly as i'd like.

Code:
**Setting up a log to veiw output
capture log close _all
log using "stratification_sims$S_DATE.txt", append text name("First Attempt")


local sample 100 300 500 700 900 1100 1300 1500 1700 1900 2100 2300 2500 2700 2900 //set up local for different sample sizes
local strata = ""

forval iter =1/2{ //number of times the simulation is run
    foreach size of local sample{
        preserve
            qui set obs `size' //set different sample sizes
            qui gen id = _n //generate a unique id
            local cats "`"2"' `"2"' `"2"' `"3"' `"4"' `"5"'" //set up local for category values of stratification var
            local num : list sizeof local(cats)
            quietly forval i = 1/`num'{
                local catind :word `i' of `cats'
                gen obs`i' = mod(_n,`catind') //generate i number of stratification vars based on values of local cats
                if `i'<=2                  local fcn mod(_n,2) //generating two binary vars
                else if `i' == 3           local fcn mod(_n,4) //generating a categorical var    
                else if `i' == 4         local fcn rbeta(6, 1) //generating a negatively-skewed var
                else if `i' == 5        local fcn rbeta(1, 4) //generating a positively-skewed var
                else if `i' == 6           local fcn rnormal() //generating a normally-distributed var
                qui gen unobs`i' = `fcn'
            }
            
                qui ds obs*, skip(1)
                local stratlist "`r(varlist)'" //store all stratification vars in a local
                local strata
                forval stratnum = 1/`num'{
                    local strat: word `stratnum' of `stratlist'
                    local strata `"`strata' `strat'"' //looping through stratification vars and adding a new one on each iteration
                    di in red "the below randomisation is stratified on:" `"`strata'"'
                    
                    qui egen strata=group(`strata') //gen a variable that makes unique groups based on strat vars
                    set seed 31540 //setting a seed for replicability
                    qui gen randomnum = runiform() //generating a random number
                    qui bysort strata: egen order=rank(randomnum) //generating a rank order var based on the random number
                    qui bysort strata: gen treat = (order <= _N/2) //assigning condition based on rank
                    
                    qui ds unobs*, skip(1)
                    local unobs "`r(varlist)'"
                    local variables `strata' `unobs' //putting observables and unobservables in one local
                    foreach var of local variables{ //balance test
                        qui: reg `var' treat, r //regressing covariate on treatment  and testing for imbalance
                        matrix A = r(table) //convert regression results to matrix
                        mat li A
                        di `"`var'"' //this is the value I want in the below data
                        postfile buffer pvaltre pvalcon rhs using "sim_results.dta", replace
                        post buffer (A[4,1]) (A[4,2]) (`=`"`var'"'') //putting p-values and IV in buffer
                    postclose buffer
                    
                    }
                        des, s
                        qui drop strata randomnum order treat
                }
        restore
    }
}

Also, you will see from the above code that i'm trying to make three variables in the new dataset (pvaltre, pvalcon, and rhs). I've tried making the rhs variable string equal to the value of `var' on that iteration of the - foreach var of local variables - loop. It is, however, returning as a number in the new dta file - see the data below.


Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input float(pvaltre pvalcon rhs)
.9405507 .4036193 1.2672622
end

-melogit- model and results of LR test vs. logistic model

$
0
0
Hi Statalisters,

I was hoping to get some insight on an issue regarding the results of model run using -melogit-. I'm including random intercept and random slope for time with an independent covariance structure. The variance for the random effect of time is var(time) = 1.49e-32. I assume this to be basically 0. The very last line of the results shows the LR test vs. logistic model with chibar2(01) = 273.70. Shouldn't the degrees of freedom (DF) for this test be equal to 2 because of the number of random effects parameters (intercept, slope for time)? I was wondering if Stata shows this DF as 01 (instead of 2) because of the near zero variance value for the random effect of time.


Code:
. melogit mother_arv i.neighbourhood_code i.time || pid: time, covariance(independent) or intpoints(30) nolog


Mixed-effects logistic regression               Number of obs     =      1,126
Group variable:             pid                 Number of groups  =        369

                                                Obs per group:
                                                              min =          1
                                                              avg =        3.1
                                                              max =          4

Integration method: mvaghermite                 Integration pts.  =         30

                                                Wald chi2(26)     =     104.35
Log likelihood = -552.22049                     Prob > chi2       =     0.0000
------------------------------------------------------------------------------------
        mother_arv | Odds Ratio   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------------+----------------------------------------------------------------
                   |
neighbourhood_code |
              10b  |   1.207952     2.3024     0.10   0.921     .0288157    50.63732
              11a  |    2.25662   3.551237     0.52   0.605     .1032582    49.31651
              11b  |   .8161043   1.359599    -0.12   0.903     .0311657    21.37051
              14a  |   1.809929   2.862215     0.38   0.708     .0815783    40.15581
              14b  |   2.090404    3.21591     0.48   0.632     .1025011    42.63164
              15a  |   24.29792   44.09448     1.76   0.079     .6931968    851.6898
              15b  |   1.406641   2.811707     0.17   0.864     .0279726    70.73491
              16a  |   .9344255   1.452309    -0.04   0.965     .0444206    19.65643
              16b  |   1.549229   2.418588     0.28   0.779     .0726537    33.03494
               1a  |   .6313577   1.009388    -0.29   0.774     .0275049    14.49241
               1b  |   .8952589   1.540925    -0.06   0.949       .03068    26.12416
               2a  |   .1389245   .2901412    -0.95   0.345     .0023177    8.327169
               2b  |   2.878584   4.702568     0.65   0.517     .1171178     70.7514
               3a  |   1.651276   2.731845     0.30   0.762     .0645068    42.27016
               3b  |   .6614926   1.036998    -0.26   0.792     .0306286    14.28642
               4a  |   .9051596   1.252004    -0.07   0.943     .0601665    13.61744
               4b  |   1.837907    3.43343     0.33   0.745     .0472256    71.52695
               5a  |   4.742137   7.526132     0.98   0.327     .2113745    106.3887
               5b  |    .765496   1.172417    -0.17   0.861     .0380419    15.40367
               7a  |   2.090668   3.815726     0.40   0.686     .0584437     74.7881
               7b  |   .7830528   1.309081    -0.15   0.884     .0295652    20.73962
               8a  |    4.09229   6.750339     0.85   0.393     .1613939    103.7637
               8b  |   3.536745   6.249113     0.71   0.475     .1108171    112.8758
                   |
              time |
    18 months (3)  |   6.987664   2.429721     5.59   0.000     3.534726    13.81364
      3 years (4)  |   15.35489   5.948513     7.05   0.000     7.186044    32.80982
      5 years (5)  |   381.7355   224.0763    10.13   0.000     120.8127    1206.181
                   |
             _cons |   .0610643   .0697011    -2.45   0.014     .0065192     .571981
-------------------+----------------------------------------------------------------
pid                |
          var(time)|   1.49e-32   2.98e-17                             .           .
         var(_cons)|   15.79767   3.533842                      10.19024    24.49072
------------------------------------------------------------------------------------
LR test vs. logistic model: chibar2(01) = 273.70      Prob >= chibar2 = 0.0000
Thanks,

Tom

Date manipulation + volume weighted average

$
0
0
Dear Statalist users,

I am a master student from Maastricht University trying to "replicate" parts of a financial article: "Impact of the Dodd-Frank act on credit rating" (Dimitrov et al., 2015). I have basic knowledge in Stata, I managed to make my way till this step but now I m stuck, help is more than greatly appreciated.

I am using Stata 12.

cusip_id correspond to different bonds which ratings have been upgraded or downgraded on particular dates (rating_date)
execution_date corresponds to trades of each bonds that have been made, with corresponding quantity and price next to it.

What I am trying to do is keep bonds for which there has been at least one trade before and after the rating date. For example, in the example generated by dataex, I would keep the cusip_id "200300606" with a rating date of either 13Feb2013 or 14Feb2013 because each has at least one trade ("execution_trade") before and after the rating dates. In opposition, I would not keep the cusip_id with a rating date of 12Mar2012 because it only has trades before the rating date and not a single trade after.

Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input long rating_date str4 reason str14 cusip_id long execution_date double(quanti price)
19402 "UPG" "200300606" 19054 4860364.5      40.5
19402 "UPG" "200300606" 19072    770000      38.5
19402 "UPG" "200300606" 19072    782500    39.125
19402 "UPG" "200300606" 19121   2031250    40.625
19402 "UPG" "200300606" 19121   2025000      40.5
19402 "UPG" "200300606" 19124    2887.5      38.5
19402 "UPG" "200300606" 19124    2812.5      37.5
19402 "UPG" "200300606" 19124    2887.5      38.5
19402 "UPG" "200300606" 19225 3116814.4      43.4
19402 "UPG" "200300606" 19225 3113223.6     43.35
19402 "UPG" "200300606" 19723     30000     45.95
19402 "UPG" "200300606" 19723     30000        46
19402 "UPG" "200300606" 19751     75000     46.25
19402 "UPG" "200300606" 19751     25000     46.25
19402 "UPG" "200300606" 19751    100000    46.125
19402 "UPG" "200300606" 19754     25000    46.375
19402 "UPG" "200300606" 19754     25000      46.5
19403 "UPG" "200300606" 19054 4860364.5      40.5
19403 "UPG" "200300606" 19072    782500    39.125
19403 "UPG" "200300606" 19072    770000      38.5
19403 "UPG" "200300606" 19121   2031250    40.625
19403 "UPG" "200300606" 19121   2025000      40.5
19403 "UPG" "200300606" 19124    2812.5      37.5
19403 "UPG" "200300606" 19124    2887.5      38.5
19403 "UPG" "200300606" 19124    2887.5      38.5
19403 "UPG" "200300606" 19225 3113223.6     43.35
19403 "UPG" "200300606" 19225 3116814.4      43.4
19403 "UPG" "200300606" 19723     30000     45.95
19403 "UPG" "200300606" 19723     30000        46
19403 "UPG" "200300606" 19751     75000     46.25
19403 "UPG" "200300606" 19751    100000    46.125
19403 "UPG" "200300606" 19751     25000     46.25
19403 "UPG" "200300606" 19754     25000    46.375
19403 "UPG" "200300606" 19754     25000      46.5
19064 "UPG" "210387205" 19018  24995.84   27.1399
19064 "UPG" "210387205" 19018  24995.84 27.187908
19064 "UPG" "210387205" 19019  11039.14 25.011932
19064 "UPG" "210387205" 19019  11039.14     27.19
19064 "UPG" "210387205" 19022      2717     27.17
19064 "UPG" "210387205" 19022  24338.52   27.0428
19064 "UPG" "210387205" 19022      2705     27.05
19064 "UPG" "210387205" 19022      2705   26.7561
19064 "UPG" "210387205" 19022  24338.52   27.0428
19064 "UPG" "210387205" 19022   2715.99   27.1599
19064 "UPG" "210387205" 19022      2717 27.462602
19064 "UPG" "210387205" 19022   2715.99 27.452611
19064 "UPG" "210387205" 19024      2714 27.432926
19064 "UPG" "210387205" 19024      2714     27.14
19064 "UPG" "210387205" 19024  18983.93   27.1199
19064 "UPG" "210387205" 19024  18983.93 27.161778
end
format %d rating_date
format %d execution_date
Then, if anyone has time, I might need an advice with regards to how I could properly calculate the volume weighted average across the days before the rating_date and after the rating_date (this to calculate the impact of a rating change on the price of a bond).

Thank you very much for you time,

Pierre Louveau

ylabel containing apostrophes overlap with ytitle

$
0
0
Hi

When I use an apostrophe in the ylabel the ytitlegap is not correctly specified.
I used the margin option to set the gap.
However, I wonder if there is an other way to define the ylabel to avoid this problem?

I'm using Stata 13.1


Code:
clear
sysuse auto

* problem
tw scatter price price, scheme(s2color) ///
ylabel(0 "0" 5000 "5'000" 10000 "10'000" 15000 "15'000", angle(horizontal))

* no problem
tw scatter price price, scheme( s2color) ///
ylabel(0 "0" 5000 "5.000" 10000 "10.000" 15000 "15.000", angle(horizontal))

* quick fix
tw scatter price price, scheme(s2color)  ///
ylabel(0 "0" 5000 "5'000" 10000 "10'000" 15000 "15'000",  angle(horizontal)) ///
ytitle(, margin(0 12 0 0))

no p-value and standard derivation in estimation of ATT in propensity score matching

$
0
0
Hello, I have computed the ATT with psmatch2. My syntax is:

psmatch2 group t70 t71 t66 t10 t08 t30 , outcome(fors1) logit odds neighbor(1) caliper(10) noreplace

This shows means for matched and unmatched grouping, but I miss the p-value and the standard derivation.
Has anyone a hint?

help with Interpreting the results ITS with single interruption

$
0
0
Hi everyone,

I am just wondering if you could give me a hand to make sure what I have done is correct please?
I have run an ITS with single interruption at point 614 (please see below).

1)Could I say the finding suggests that the level of arrivals was at 6333986 (cons) and increasing by 777 (but not significant)?
2)adding in first month of interruption arrivals dropped significantly by -372564 (x614)?
3)but then with significant increase in monthly (_x_t614) trend?
4) finally lincom estimate produced by specifying trend posttrend, that after the interruption, arrival started to pick up?


I hope you can help me :-)
Best wishes
Yeg



------------------------------------------------------------------------------
| Newey-West
Arrivals | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
_t | 777.8001 621.509 1.25 0.213 -453.1767 2008.777
_x614 | -372564.4 45549.34 -8.18 0.000 -462780.6 -282348.2
_x_t614 | 22630.29 1599.061 14.15 0.000 19463.15 25797.44
_cons | 633986.5 20249.85 31.31 0.000 593879.1 674093.9
------------------------------------------------------------------------------

Postintervention Linear Trend: 614

Treated: _b[_t]+_b[_x_t614]
------------------------------------------------------------------------------
Linear Trend | Coeff Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
Treated | 2.34e+04 1473.4503 15.8866 0.0000 2.05e+04 2.63e+04
------------------------------------------------------------------------------

Cannot find ado/personal

$
0
0
Hello Statalisters,

I'm writing a short programme to help with some graphing tasks, and i'm running into a problem locating my ado/personal folder.

I'm running Stata on Mac OSX El Capitan, and the output from - sysdir - is:

Code:
STATA:  /Applications/Stata/
BASE:  /Applications/Stata/ado/base/
SITE:  /Applications/Stata/ado/site/
PLUS:  ~/Library/Application Support/Stata/ado/plus/
PERSONAL:  ~/Library/Application Support/Stata/ado/personal/
OLDPLACE:  ~/ado/
However, when I go to the terminal to try and access this folder I receive the following error:

Code:
$ ~/Library/Application Support/Stata/ado/personal/

-bash: /Users/chris.larkin/Library/Application: No such file or directory
Further, when I go directly to:
Code:
$ ~/Library/
via the terminal, and look through the Application Support folder nested under Stata, I can only find ado/plus/, but no ado/personal/. Stata seems to think there is though - do I need to make one in the location Stata thinks it exists?

Many thanks in advance!

Likelihood-ratio test of the xttobit

$
0
0
Hello statalist,

I have run a xttobit command and I have got the following for the Likelihood-ratio test,

Likelihood-ratio test of sigma_u=0: chibar2 (01)= 0.00 prob>=chibar2= 1.000

does that mean that xttobit and tobit are not different and then I can use the tobit command.

Many thanks in advance
Ahmad

New command -veracrypt- on SSC

$
0
0
A new command -veracrypt- is now available for download from SSC thanks to Kit Baum's help. To install, type -ssc install veracrypt- in Stata. This is based on Matthew White's great -truecrypt- command.

-veracrypt- allows you to mount or dismount VeraCrypt and TrueCrypt encrypted volumes from within Stata. More information on VeraCrypt is available here: <https://veracrypt.codeplex.com>.

—Patrick

Multilevel structural model with gsem

$
0
0
Dear all,

I'm facing some problems with gsem. I have a two-level hierarchy data with households [hhID] nested within areas[PSU].

I'd like to specify a SEM in which the measurement model expresses the relationship between the latent variable (defined at the household level) L1 and a set of binary observed items q1-q8, and the structural model has a multilevel structure that allows for decomposing the variance of the latent variable in its between- and within-area components.

The specification of the (empty) multilevel structural model is

L1_jk = v_00 + u_0k + e_jk

where u_0k and e_jk represent, respectively, residuals at level two and one (j is the subscript for the households and k subscript for the areas).

How can I code such a model using gsem?

My try (contaminating with code from xtmixed) has been:


gsem (L1->q1-q8, logit) (L1<- ||v001: )

But of course it does not work.

I've found a lot of material about latent variables specified at level two but few about multilevel structural model.

Can you please help me?

Many thanks,
F

time-varying variables in seqlogit command

$
0
0
Hi everyone,

I am facing a problem with the seqlogit command, which enables to estimate a sequential logit model.

Indeed, I want to include both constant variables over time and time-varying variables.
I understood that the dataset should be shaped in wide format, which I did, and my X variables are then in this format: x11 x12 x13 x21 x22 x23, the first number referring to the variable, and the second number referring to the time.

Here is my problem: when I type the following command:

seqlogit lastcycle sex educ hhsize single housing otheractive, ///
tree(1 : 2 3 4 5, 2 : 3 4 5, 3 : 4 5, 4 : 5) ///
x1 (amount1 sectorname1 projectage1)

I don't have any problem and Stata calculates everything, giving me the coefficients for constant variables (in the first line of the command) for all transitions, and the coefficients of specific variables for t=1 (in the line starting with x1) for the first transition only.

Now when I type the following command, which is what I want to estimate:

seqlogit lastcycle sex educ hhsize single housing otheractive, ///
tree(1 : 2 3 4 5, 2 : 3 4 5, 3 : 4 5, 4 : 5) ///
x1 (amount1 sectorname1 projectage1) ///
x2 (amount2 sectorname2 projectage2) ///
x3 (amount3 sectorname3 projectage3) ///
x4 (amount4 sectorname4 projectage4)

I got an error message saying : "Transition 1 r(2000);"

I don't understand because I added the x2 x3 x4 lines exactly the same way as x1, with the specific values of each time-varying variable I want Stata to take into account for each specific transition.

So maybe it is a syntax mistake ? I hope it is, but I don't see it... I also tried to put everything in one line instead of using slashes but it does not work either.

Could someone help me with this ?

Thank you very much !

The question about endogeneity test of panel data model without instrument variables

$
0
0
Dear all,

I used balanced panel data and have googled with the following string -test for endogeneity in panel data- gives back some Stata-related entries. But there is no specific case fits for my model which contains no instrument variables. I attached the commands and results in stata below. Based on the regression of -xtreg-, how should I start to the test of endogeneity in stata?

Code:
xtset id yr
sort id yr
xtreg ex  tfpch  logavem  c_tfpch_c_logavem avlogperavar  logperavinterest shock east_1,re vce(r)
Array

Array

Thanks,
David

Equivalent to &quot;inlist&quot; for AND conditions?

$
0
0
I'm familiar with inlist, and generally use it in the format:

"gen example=1 if inlist(1,var1,var2,var3)"

as equivalent to "gen example=1 if 1==var1|1==var2|1==var3"

My question: Is there an equivalent to inlist for & conditions?

i.e. Ideally something to the effect of:

"gen example2=1 if function(1,var1,var2,var3)"

as equivalent to "gen example2=1 if 1==var1&1==var2&1==var3"


Thanks,

James
Viewing all 73375 articles
Browse latest View live


Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>