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

# Re: st: factor variables and pweights not accepted in qreg Stata v13

 From Joerg Luedicke To statalist@hsphsun2.harvard.edu Subject Re: st: factor variables and pweights not accepted in qreg Stata v13 Date Wed, 26 Jun 2013 11:26:57 -0400

```I cannot replicate the problem:

. sysuse auto
(1978 Automobile Data)

. qreg price weight length i.foreign
Iteration  1:  WLS sum of weighted deviations =  112795.66

Iteration  1: sum of abs. weighted deviations =     111901
Iteration  2: sum of abs. weighted deviations =  110529.43
Iteration  3: sum of abs. weighted deviations =  109524.57
Iteration  4: sum of abs. weighted deviations =   109468.3
Iteration  5: sum of abs. weighted deviations =  109105.27
note:  alternate solutions exist
Iteration  6: sum of abs. weighted deviations =  108931.02
Iteration  7: sum of abs. weighted deviations =   108887.4
Iteration  8: sum of abs. weighted deviations =  108822.59

Median regression                                    Number of obs =        74
Raw sum of deviations   142205 (about 4934)
Min sum of deviations 108822.6                     Pseudo R2     =    0.2347

------------------------------------------------------------------------------
price |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
weight |   3.933588   1.328718     2.96   0.004     1.283543    6.583632
length |  -41.25191   45.46469    -0.91   0.367    -131.9284    49.42456
|
foreign |
Foreign  |   3377.771   885.4198     3.81   0.000     1611.857    5143.685
_cons |   344.6489   5182.394     0.07   0.947     -9991.31    10680.61
------------------------------------------------------------------------------

. qreg price weight length foreign [pw= displacement]
Iteration  1:  WLS sum of weighted deviations =   23571568

Iteration  1: sum of abs. weighted deviations =   23596808
Iteration  2: sum of abs. weighted deviations =   23268657
Iteration  3: sum of abs. weighted deviations =   23264763
Iteration  4: sum of abs. weighted deviations =   23242098
Iteration  5: sum of abs. weighted deviations =   23240219
Iteration  6: sum of abs. weighted deviations =   23239934

Median regression                                    Number of obs =        74
Raw sum of deviations 3.54e+07 (about 5379)
Min sum of deviations 2.32e+07                     Pseudo R2     =    0.3438

------------------------------------------------------------------------------
|               Robust
price |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
weight |   6.274595   .2034548    30.84   0.000     5.868817    6.680372
length |  -99.88108   7.523739   -13.28   0.000    -114.8867   -84.87546
foreign |   3937.741   68.35094    57.61   0.000     3801.419    4074.062
_cons |   4400.254   875.7561     5.02   0.000     2653.614    6146.895
------------------------------------------------------------------------------

In the -qreg- help file it says:

"qreg allows fweights, aweights, iweights, and pweights;"

Not sure how this kind of stuff maps to dialog boxes as I never use them.

Joerg

On Tue, Jun 25, 2013 at 5:16 PM, Ariel Linden, DrPH
<ariel.linden@gmail.com> wrote:
> I just got version 13 today and immediately fired it up...
>
> Contrary to the help file for -qreg- that says "indepvars may contain factor
> variables; see fvvarlist" and "qreg allows fweights, aweights, iweights, and
> pweights; see weight", I got an error when running the following code:
>
> . sysuse auto
>
> . qreg price weight length i.foreign
> factor variables and time-series operators not allowed
> r(101);
>
> . qreg price weight length foreign [pw= displacement]
> pweight not allowed
> r(101);
>
> n.b. I just noticed that in the dialog box for qreg, there is no pweight
> option...
>
> Ariel
>
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/faqs/resources/statalist-faq/
> *   http://www.ats.ucla.edu/stat/stata/
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/
```