Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: Re: Finding and graphing intersection of lines


From   Scott Merryman <[email protected]>
To   [email protected]
Subject   Re: st: Re: Finding and graphing intersection of lines
Date   Wed, 3 Aug 2011 07:30:50 -0500

Does this help?

clear
set obs 31
gen q1 = _n-1
//reaction curves
gen r1 = 30 - 2*q1
gen r2 = 15 - .5*q1
replace r1 = . if r1 <0

//intersection point
local b1 = (r1[2] - r1[1])/(q1[2] - q1[1])
local b2 = (r2[2] - r2[1])/(q1[2] - q1[1])
local p1 = (-r1[1]+ r2[1]) /(`b1' - `b2')
local p2 = (r2[1]*`b1' -r1[1]*`b2' ) /(`b1' - `b2')

line r1 r2 q ///
 || scatteri `p1' `p2'  (2) "Cournot Equilibrium" ,mlabgap(2) ms(O)  ///
 || , scheme(lean1) xtitle(Quantity Firm1) ytitle(Quantity Firm2)  ///
   legend(off) xlabel(0 15 30) ylabel(0 15 30)


Scott


On Tue, Aug 2, 2011 at 11:21 PM, Charles Vinis <[email protected]> wrote:
> Thanks for the reply. I basically made a stata loop that gives
> different market shares for firms (or average market shares by
> country) based on a percentage point change in marginal cost for one
> (or a group) of firms, then I reshape the set and use the data points
> to make a line plot of the market share against the percent change in
> marginal cost. Here's an example of the type of graph I'm doing: (I'm
> using # delimit ; to end lines)
>
> graph twoway line sim_comp_share pct_decrease_mc_fslr if(company ==
> "first_solar" & year == 2010), color(brown)
> || line avg_ctry_comp_share  pct_decrease_mc_fslr if(ctry_code_hq ==
> "usa" & year == 2010), color(green)
> || line avg_ctry_comp_share pct_decrease_mc_fslr if(ctry_code_hq ==
> "china" & year == 2010), color(red)
> || line avg_ctry_comp_share pct_decrease_mc_fslr if(ctry_code_hq ==
> "germany" & year == 2010), color(blue)
> || line avg_ctry_comp_share pct_decrease_mc_fslr if(ctry_code_hq ==
> "taiwan" & year == 2010), color(purple)
> ytitle(Market Share)
> xtitle(Percent Decrease in First Solar MC)
> legend(label(1 First Solar) label(2 USA) label(3 China) label(4
> Germany) label(5 Taiwan));
>
> Basically I would like for STATA to tell me exactly at which point
> (what % decrease in MC and what market share) First Solar's market
> share is equal to the average market share of a German or a Chinese
> firm, and I would like to get stata to label that point on the graph.
> Any ideas?

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index