[quantileFit] changing variable names

Hello,

I am currently using quantileFit and trying to change the variable names. I've tried three different ways of defining variable names as written below and am still getting the result which is based on the default names x01, x02, etc.

The code that I've used is

tau = seqa(0.05,0.1,10);

struct qfitOut qOut;
struct qfitControl qCtl;
qCtl = qfitControlCreate();

//three ways of defining var names

qCtl.varnames="constant"$~"pos_daily"$~"neg_daily"$~"weekly"$~"monthly";
qCtl.varnames={"constant","pos_daily","neg_daily","weekly","monthly"};
qCtl.varnames={constant,pos_daily,neg_daily,weekly,monthly};

qCtl.bootstrap=100;
qCtl.verbose=1;

qOut = quantileFit(Y, X, tau, qCtl);

Also, I am not able to find the detailed tutorial for quantileFit. The help section has outlined relevant options and so on but it is not complete. For example, it has explanations for qCtl.varnamesqCtl.bootstrap, etc but it does not say anything about defining the controls. No link to qfitControlCreate or any hint on the reserved word qfitControl. Is there someplace that has a more comprehensive explanation for quantileFit or quantileFitLoc? There are documents for olsmt, optmt, and so on but I could not locate one for the quantile.


 

Thank you very much!

 

2 Answers



0



new;
cls;

rndseed 4893;

N = 1000;
X = 10*rndu(N, 3) - 5;
b_hat = { 2, -1, 0.5 };
y = 5 + X*b_hat + rndn(rows(X), 1)*10;

// Set up tau for regression
tau = 0.05|0.50|0.75|0.95;

struct qfitControl ctl;
ctl = qFitControlCreate();

// Create string array of variable names
ctl.varnames = "Alpha" $| "Beta" $| "Gamma";

// Call quantileFit
call quantileFit(y, X, tau, ctl);

which returns:

============================================================
 Linear Quantile Regression
============================================================

Total observations:                                    1000
Number of variables:                                      3

VAR. / tau (in %)        5%       50%       75%       95%
-----------------------------------------------------------
CONSTANT          -11.9972     5.6790    12.1160    21.0821
Alpha               1.9468     1.9532     1.9120     2.1104
Beta               -1.6559    -1.2839    -1.0226    -1.0420
Gamma               0.7706     0.5872     0.3307     0.2627

With regard to qfitControlCreate the only thing you need to know is that it fills the qfitControl structure with default settings and it should always be called as the first step after declaring the qfitControl structure, like this:

// Declare `qCtl` to be a `qfitControl` structure
// and fill with default settings
struct qfitControl qCtl;
qCtl = qfitControlCreate();

I will post some more about the other controls later.

aptech

1,773

Your Answer

2 Answers

0

new;
cls;

rndseed 4893;

N = 1000;
X = 10*rndu(N, 3) - 5;
b_hat = { 2, -1, 0.5 };
y = 5 + X*b_hat + rndn(rows(X), 1)*10;

// Set up tau for regression
tau = 0.05|0.50|0.75|0.95;

struct qfitControl ctl;
ctl = qFitControlCreate();

// Create string array of variable names
ctl.varnames = "Alpha" $| "Beta" $| "Gamma";

// Call quantileFit
call quantileFit(y, X, tau, ctl);

which returns:

============================================================
 Linear Quantile Regression
============================================================

Total observations:                                    1000
Number of variables:                                      3

VAR. / tau (in %)        5%       50%       75%       95%
-----------------------------------------------------------
CONSTANT          -11.9972     5.6790    12.1160    21.0821
Alpha               1.9468     1.9532     1.9120     2.1104
Beta               -1.6559    -1.2839    -1.0226    -1.0420
Gamma               0.7706     0.5872     0.3307     0.2627

With regard to qfitControlCreate the only thing you need to know is that it fills the qfitControl structure with default settings and it should always be called as the first step after declaring the qfitControl structure, like this:

// Declare `qCtl` to be a `qfitControl` structure
// and fill with default settings
struct qfitControl qCtl;
qCtl = qfitControlCreate();

I will post some more about the other controls later.


You must login to post answers.

Have a Specific Question?

Get a real answer from a real person

Need Support?

Get help from our friendly experts.

Try GAUSS for 14 days for FREE

See what GAUSS can do for your data

© Aptech Systems, Inc. All rights reserved.

Privacy Policy