[R] model construction

roger koenker rkoenker at uiuc.edu
Wed Feb 13 18:57:32 CET 2008


Weighting is entirely ok, if you think that the large transactions
are ones for which the observed price is more accurate.
(This sounds unlikely to me, but it might be possible;  the
seller might devote more careful calculation to larger sales.)
Weights in lm() should be chosen as w_i = 1/v_i  where v_i
is the conditional variance of the ith observation.  You can
of course check to see whether variability of prices is
increasing in quantity -- this would be prudent.

url:    www.econ.uiuc.edu/~roger            Roger Koenker
email    rkoenker at uiuc.edu            Department of Economics
vox:     217-333-4558                University of Illinois
fax:       217-244-6678                Champaign, IL 61820


On Feb 13, 2008, at 10:57 AM, Daniel Dunn wrote:

> I buy flowers at a local market on a fairly regular basis.  The flower
> vendors post their prices and if I want to buy only one or two  
> flowers I
> will generally get the posted price.  From time to time I want to  
> buy large
> quantities of flowers, and sometimes a vendor will give me a better  
> price
> than their posted price for the bulk order, but more often I have to  
> offer
> them a higher price than the posted price to get my desired  
> quantity.  I
> have collected the outcome of several thousand visits to the flower  
> market
> and I want to analyze whether there is any relationship between the  
> amount
> of flowers I am buying and the 'average' increment above the posted  
> price
> that I end up needing to pay.  Moreover, I am interested in the  
> "right hand
> side" of this relationship since tomorrow, being Valentine's Day, I am
> contemplating purchasing a very large number of flowers.  So, if
>
>
>
> amt = a vector of quantities of flowers bought on various days
>
> deltaP = a vector of the differences between the purchase price and  
> the
> posted price on those days
>
>
>
> Two simple models might be:
>
>
>
> mottle1 = lm( deltaP ~ amt )
>
> or
>
> mottle2 = lm( deltaP ~ amt - 1 )
>
>
>
> But, I have the urge to set the model up as follows
>
>
>
> mottle3 = lm( deltaP ~ amt - 1, weights = amt )
>
>
>
> because I want the big purchases to weigh much more in the  
> calculation of
> the slope than the small purchases, but I have an uneasy feeling  
> that this
> amounts to double-dipping/counting.  Can anyone explain to me if/why  
> this is
> a bad idea?
>
>
>
> Thanks,
>
>
>
> Dan
>
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list