Announcement

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

  • #16
    set obs isn't relevant to the case where your data are already in memory. It's only needed because I create a fake dataset.

    Comment


    • #17
      If I delete set obs, the code becomes this:

      Code:
      *Fixed effects: Heterogeneity across entities (stripplot)
      clear
      set seed 2803
      
      gen performance = exp(rnormal(-2, 1))
      gen type_industry = ceil(_n/ 100)
      
      label def type_industry 1 `" "Basic" "Materials" "'  ///
      2  `" "Communi-" "cations" "' 3 `" "Consumer" "Cyclical" "' 4 `" "Consumer" "Non-Cyclical" "' ///
      5  "Energy"  6 "Financial"  7 "Industrial"  8 "Technology" 9  "Utilities" , modify
      
      label val type_industry type_industry
      
      * get a gmean() function (don't remove the *) 
      * ssc inst egenmore
      
      * sort on geometric mean (don't remove the *) 
      * ssc inst myaxis
      myaxis xaxis=type_industry, sort(gmean performance)
      
      * ssc inst stripplot
      stripplot performance, over(xaxis) centre vertical cumul cumprob refline scheme(s1color) xla(, noticks labsize(small)) xsize(7) xtitle("") ysc(log) yla(5 2 1 0.5 0.2 0.1 0.05 0.02, ang(h))  reflevel(gmean) mc(blue)



      And I get the error no observations (r 2000).





      Lucas BORDURE
      Student MSc. in International Finance
      Rennes School of Business
      Stata SE 16.1

      Comment


      • #18
        Already answered. That code creates a fake dataset. Therefore you need set obs. Otherwise put, how does Stata know how many observations to use unless you spell it out?

        Comment


        • #19
          But if you create a fake database. I imagine that it does not correspond to the observations of my base file named "File4". By deduction, I imagine that the result is not related by my initial observations but the result is related by the generation of random observations created by this following 2 commands.
          Code:
          set obs 900
          set seed 2803

          So the code beginning from **Fixed effects: Heterogeneity across entities (stripplot) is wrong.
          Code:
          use"File4.dta", clear
          
          
          *means and standard deviations of intangible assets by industry
          preserve
          collapse (mean) mean_intangible_assets_industry=intangible_assets (sd) sd_intangible_assets_industry=intangible_assets, by (industry)
          asdoc list, replace
          restore
          *means and standard deviations of intangible assets by year
          preserve
          collapse (mean) mean_intangible_assets_year=intangible_assets (sd) sd_intangible_assets_year=intangible_assets, by (year)
          asdoc list, replace
          restore
          *descriptive statistics for control variables (average, mean, sd)
          asdoc tabstat enterprise_value_added market_capitalization leverage stock_growth dividend_payout_ratio stock_volatility, stat(mean p50 sd), replace
          *correlation for control variables 
          corr enterprise_value_added market_capitalization leverage stock_growth dividend_payout_ratio stock_volatility
          *setting panel data
          xtset i year
          *exploring panel data
          xtline ln_firm_performance
          xtline ln_firm_performance, overlay
          
          
          
          *OLS regression
          regress firm_performance intangible_assets
          scatter firm_performance intangible_assets, ms(none) ylabel(minmax) xlabel(minmax) mlabel(industry_l) mlabpos(0) || lfit firm_performance intangible_assets, clstyle(p2)
          
          
          
          *Fixed effects: Heterogeneity across entities (stripplot)
          clear
          set obs 900
          set seed 2803
          
          gen performance = exp(rnormal(-2, 1))
          gen type_industry = ceil(_n/ 100)
          
          label def type_industry 1 `" "Basic" "Materials" "'  ///
          2  `" "Communi-" "cations" "' 3 `" "Consumer" "Cyclical" "' 4 `" "Consumer" "Non-Cyclical" "' ///
          5  "Energy"  6 "Financial"  7 "Industrial"  8 "Technology" 9  "Utilities" , modify
          
          label val type_industry type_industry
          
          * get a gmean() function (don't remove the *) 
          * ssc inst egenmore
          
          * sort on geometric mean (don't remove the *) 
          * ssc inst myaxis
          myaxis xaxis=type_industry, sort(gmean performance)
          
          * ssc inst stripplot
          stripplot performance, over(xaxis) centre vertical cumul cumprob refline scheme(s1color) xla(, noticks labsize(small)) xsize(7) xtitle("") ysc(log) yla(5 2 1 0.5 0.2 0.1 0.05 0.02, ang(h))  reflevel(gmean) mc(blue)

          I would be grateful if a code integrating my initial observations could be runned.

          Lucas BORDURE
          Student MSc. in International Finance
          Rennes School of Business
          Stata SE 16.1

          Comment


          • #20

            As you have downloaded stripplot, the suggestion is to use your own dataset and your own variable names and to work out what options you need.

            Comment

            Working...
            X