Announcement

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

  • twoway scatter only for selected cities

    Hello everyone,

    Code:
    graph twoway (scatter RealHP Year if veluwe==1, lcolor(red)) (lfit RealHP Year if veluwe==1) ,by(GM_code)
    im getting graphs of all the cities, I onlty want those municipalities that are equal to veluwe==1, however i want them to be split in several graphs individually.

    I hope someone could help me out with this.

    I appreciate everyones help!

    Kind regards,

    Adam Klaas

  • #2
    Isn't that what the code does?

    Comment


    • #3
      Originally posted by Nick Cox View Post
      Isn't that what the code does?
      Its giving me this:
      https://ibb.co/CzW3ZWF

      I also get
      Code:
      (note:  regress could not fit model)
      (note:  regress could not fit model)

      Comment


      • #4
        In each regression model, it'd take at least three data points to produce "normal-looking" results. Two points will yield estimates without any calculated error, and one point will not even sustain the model. In your case, some of the GM codes have just one data point, so when you used lfit to request a regression line, it didn't work.

        Also, I am not sure if the graph goes with your code, in your graph the lines are not straight, but lfit should fit a straight line. Please double check.

        Comment


        • #5
          Originally posted by Ken Chui View Post
          In each regression model, it'd take at least three data points to produce "normal-looking" results. Two points will yield estimates without any calculated error, and one point will not even sustain the model. In your case, some of the GM codes have just one data point, so when you used lfit to request a regression line, it didn't work.

          Also, I am not sure if the graph goes with your code, in your graph the lines are not straight, but lfit should fit a straight line. Please double check.
          If I do one graph putting all that is equal to veluwe==1 then I get the cities in one graph no issues whatsoever, however thats not really what I want.

          I have to add that I am working with panel data so 352 cities over the years 2000-2020.

          Like for example I want it like this:

          Graph 1: City x
          Graph 2: city Z

          and so on

          Comment


          • #6
            So, the graph "works" but does it help? What might work better is

            1. A graph with all data.

            2. Selected cities, in ones or twos or threes. Tastes differ, as do outputs. Unless you're printing this on very large paper, it is difficult for me to imagine a display working well with more than 5 x 5 panels, and 2 x 2 can be hard work.

            Comment

            Working...
            X