Announcement

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

  • Calculate the standard deviation of a variable expressed in logarithms

    Hi.

    I have to calculate the standard deviation of a prediction that is expressed in logarithms in a regression with panel data,
    the model form is log-log, I have the dependent variable "y" and the independent variables "x",
    when I perform a regression of the linear form I can use the command "predict ystdp, stdp",
    but when the model is of the log-log form the command "predict ystdp, stdp" calculates the standard deviation for the dependent variable "Lny"
    but what I need is the standard deviation of the variable "y" for the log-log model, would there be some command in stata to perform this calculation?

    Thanks for the help

  • #2
    Why do you think you need this? If you want intervals for the predictions, you could exponentiate those for the logged response, or use a log link with xtgee.

    Comment


    • #3
      I suspect you meant standard error. The standard error is the standard deviation of a sample mean or some other quantity estimated from a model. The standard deviation is merely a descriptor of the amount of variance of some quantity. The syntax for -predict- refers to standard errors, not SDs.

      The rest of my response would be identical to Nick's: if you really do need the SE of the predicted ys, you may be better off using a GLM or a GEE with a log link, which would not require you to transform the ys at all (although you still need to transform the xs if justified).
      Be aware that it can be very hard to answer a question without sample data. You can use the dataex command for this. Type help dataex at the command line.

      When presenting code or results, please use the code delimiters format them. Use the # button on the formatting toolbar, between the " (double quote) and <> buttons.

      Comment


      • #4
        Ricardo:
        I do agree with the previous comments.
        If you are really interested in ln_stanadard deviation, the painful procedure to calculate it is reported in http://journals.sagepub.com/doi/pdf/...2280202sm290ra.
        Kind regards,
        Carlo
        (Stata 19.0)

        Comment


        • #5

          Thanks everyone for answering, you're right Weiwen need the standard error (SE of the predictions). I'm working for a model that allows me to compare the electrical energy losses (variable "y") of each region of my country through a given complexity index by the prediction of the variable "y" for the last year of observation of each region (the log-log model gave the most significant coefficients), once the complexity index of each region was obtained, I obtained a ranking of ordered complexity from highest to lowest, I need the standard error to calculate the probability that a B region is positioned on top of a region A in the ranking, this probability would be to define the loss reduction goal of each region by means of the weighted average of the current energy losses of a region and that of the benchmark region, would there be an practice example to calculate with Stata the standard error of the variable y in a log-log model? Thanks for your time

          Comment

          Working...
          X