Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Creating the inverse distribution function of an extreme value distribution

    Dear Statalist-Users,

    I want to analyze the effect of several variables on the probability to donate in the blood donation context using panel data. I am using a logit-model with the dependent variable of donation.
    I have one independent variable with the range of 0 to 8 (most of the values are 0) for which I want to control the endogeneity using copula.
    Regarding to Park & Gupta (2012) I need to generate the inverse distribution function of the extreme value distribution with mean 1.5 and scale parameter 0.2 for that variable.

    I have the following code (which works) for the case of a linear regression model and the case that regarding to Park & Gupta the inverse of the normal cumulative distribution function is needed:

    Code:
    cumul varx, gen (emp_varx) equal
    sort emp_varx
    replace emp_varx = emp_varx[_n-1] if emp_varx==1
    gen c_emp_varx = invnormal(emp_varx)
    Is there a command to get the inverse of the extreme value distribution or a way to change the code to make it fit to my current problem?
    Last edited by Maximilian Bartels; 28 Jun 2017, 07:49.

  • #2
    That code should not work as invnormal() is the correct function name.

    The quantile function for a Gumbel distribution (various other names) is (part Stata code, part pseudocode)

    mode - scale * log(-log(p))

    where p is cumulative probability within (0, 1).

    See e.g. https://en.wikipedia.org/wiki/Gumbel_distribution and/or gumbelfit from SSC.

    I don't recollect seeing the Gumbel ever parameterised in terms of the mean, but if you really mean that your code would be different.

    I would not use cumul here, but plotting position code. I find the account at http://www.stata.com/support/faqs/st...ing-positions/ easy to follow.
    Last edited by Nick Cox; 28 Jun 2017, 07:39.

    Comment


    • #3
      Hi Nick!

      Thank you for you're fast answer. invnormal() was a typo, sorry for that and thanks for the correction.

      What do you exactly mean by the scale command/part?

      Thanks for your help.

      Comment


      • #4
        I understand by scale parameter what my references do, namely the Wikipedia entry and gumbelfit

        Comment


        • #5
          Hello,
          Finally did you find the code to generate the inverse of the normal cumulative distribution function ?

          Please can anyone help me to make a Stata Code that generates the variable bellow named C_CSR.


          Click image for larger version

Name:	Capture d’écran 2018-05-14 à 12.57.22 AM.png
Views:	4
Size:	24.6 KB
ID:	1444047


          Thank you in advance !

          Comment


          • #6
            Code:
            help invnormal()
            as already implied.

            Comment


            • #7
              Hello Sir Nick,
              Thank you very much for responding me !

              But I didn't understand how to use this function correctly despite that I tried with stata help.
              Please can you help me with the exactly code of the equation in the photo bellow, as you see there is two functions : the INCDF and the empirical distribution of the variable(CSR).
              Click image for larger version

Name:	Capture d’écran 2018-05-14 à 12.57.22 AM.png
Views:	4
Size:	24.6 KB
ID:	1444105


              Thank you for your time and consideration regarding this matter !

              Comment


              • #8
                Sorry, but it's difficult to help more and not repeat myself or what is already documented for you in the help.

                I have no idea precisely what your CSR beasts are. You (a) don't define them or (b) give an accessible reference for anyone to follow or (c) give example data, so you're testing my psychic powers, which are negligible, or assuming that I read all the papers and books you do, which is mostly incorrect.

                What's left is just what the help will tell you, more or less, namely that invnormal() expects to be fed something in the interval (0, 1).

                "empirical distribution" presumably means (cumulative) empirical distribution (function), but note that invnormal() will choke on 1 as an argument. So what comes out of cumul will usually not be quite right.

                https://www.stata.com/support/faqs/s...ing-positions/

                may help. If not, you need to tell us more using (a) (b) (c) above. Example data are best.

                Comment


                • #9
                  I'm testing the impact of CSR on firm performance using panel data.
                  CSR is the Corporate Social Responsibility variable which is measured by the equally weighted average of the environmental, the social and the governance score for each focal firm for every year. Thus, CSR correlates with the error term causing endogeneity and in turn produces biased estimates. To correct for such endogeneity I include Gaussian copulas in the model estimation following previous studies.
                  Gaussian copulas capture the correlation of the endogenous variables and the error term by modeling their joint normal distribution on the basis of the observed data. They generate consistent parameter estimates even when the assumed normal distribution of the error term is not present (Park and Gupta 2012). I hope so to construct the copula term for CSR variable as bellow using STATA :

                  Thanks !
                  Attached Files

                  Comment


                  • #10
                    That's interesting substantive context, except that you're assuming that we recognise the allusion to Park and Gupta 2012. (Please see FAQ Advice on how to give references, and while doing that you might as well read it all the way through to #18.)

                    It doesn't let me give any further help on how to code this.

                    Comment


                    • #11
                      Regarding the reference, see

                      Sungho Park, Sachin Gupta, "Handling Endogenous Regressors by Joint Estimation Using Copulas", Marketing Science, vol. 31 issue 4, 2012
                      https://doi.org/10.1287/mksc.1120.0718

                      The article is not available for free, however a preliminary version is available on SSRN: https://papers.ssrn.com/sol3/papers....act_id=2025669

                      Comment

                      Working...
                      X