FSRedaTobit enables to monitor several quantities in each step of the forward search
Example of use of FSRedaTobit based on a starting point coming from LMS.
n=200; p=3; randn('state', 123456); X=randn(n,p); % Uncontaminated data y=randn(n,1)+1; % Contaminated data ycont=y; cont=1:5; ycont(cont)=ycont(cont)+5; ycont(ycont<=0)=0; [out]=LXS(ycont,X,'nsamp',1000); out=FSRedaTobit(ycont,X,out.bs); fground=struct; fground.funit=cont resfwdplot(out,'fground',fground)
Example of use of function FSReda using a random start and traditional t-stat monitoring.
n=200; p=3; randn('state', 123456); X=randn(n,p); % Uncontaminated data y=randn(n,1); % Contaminated data ycont=y; ycont(1:5)=ycont(1:5)+6; ycont(ycont<=0)=0; out=FSRedaTobit(ycont,X,0,'tstat','trad');
In the example of Kleiber and Zeileis (2008, p. 142), the number of a person's extramarital sexual inter-courses ("affairs") in the past year is regressed on the person's age, number of years married, religiousness, occupation, and won rating of the marriage. The dependent variable is left-censored at zero and not right-censored. Hence this is a standard Tobit model which can be estimated by the following lines
load affairs.mat X=affairs{:,["age" "yearsmarried" "religiousness" "occupation" "rating"]}; y=affairs{:,"affairs"}; out=FSRedaTobit(y,X,0); resfwdplot(out)
Warning: Rank problem in step 7: Beta coefficients are used from the most recent correctly computed step Warning: Matrix is singular to working precision. Warning: Matrix is singular to working precision. Warning: Matrix is singular to working precision. Warning: Matrix is singular to working precision. Warning: Matrix is singular to working precision. Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.794142e-49. Warning: Matrix is singular to working precision. Warning: Matrix is singular to working precision. m=100 m=200 m=300 m=400 m=500 m=600 Warning: The opengl function will be removed in a future release. Use the rendererinfo function instead.
rng(2) n=300; lambda=-0.5; p=5; sigma=0.1; beta=1*ones(p,1); X=0.2*randn(n,p); epsilon=randn(n,1); y=X*beta+sigma*epsilon; y=normYJ(y,1,lambda,'inverse',true,'Jacobian',false); sel=1:30; y(sel)=y(sel)+1.2; qq=quantile(y,0.3); y(y<=qq)=qq; left=min(y); right=Inf; % See function FSRfanTobit on the procedure to find the correct % transformation yf=normYJ(y,1,lambda,'inverse',false,'Jacobian',false); leftf=normYJ(left,1,lambda,'inverse',false,'Jacobian',false); rightf=normYJ(right,1,lambda,'inverse',false,'Jacobian',false); zlimits=[leftf rightf]; % Call to FSRedaTobit outLXS=LXS(yf,X); out=FSRedaTobit(yf,X,outLXS.bs,'left',leftf,'right',rightf,'init',100); fground.funit=1:30; resfwdplot(out,'fground',fground);
Total estimated time to complete LMS: 0.03 seconds Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 3.440395e-22. Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 3.652843e-22. Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 7.526618e-24. Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 2.265409e-22. Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 6.603410e-21. Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.798020e-22. Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 2.561114e-19. Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 2.899712e-20. Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 4.130698e-22. Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.422141e-19. Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.533060e-22. Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 6.618250e-26. Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.107271e-20. Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.865440e-27. Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 6.236248e-28. m=100 m=200 m=300 Warning: The opengl function will be removed in a future release. Use the rendererinfo function instead.
y
— Response variable.
Vector.Response variable, specified as a vector of length n, where n is the number of observations. Each entry in y is the response for the corresponding row of X.
Missing values (NaN's) and infinite values (Inf's) are allowed, since observations (rows) with missing or infinite values will automatically be excluded from the computations.
Data Types: single| double
X
— Data matrix of explanatory variables (also called 'regressors')
of dimension (n x p-1).
Rows of X represent observations, and
columns represent variables.Missing values (NaN's) and infinite values (Inf's) are allowed, since observations (rows) with missing or infinite values will automatically be excluded from the computations.
Data Types: single| double
bsb
— list of units forming the initial
subset.
Vector or scalar.If bsb=0 (default), then the procedure starts with p units randomly chosen, else if bsb is not 0, the search will start with m0=length(bsb).
Data Types: single| double
Specify optional comma-separated pairs of Name,Value
arguments.
Name
is the argument name and Value
is the corresponding value. Name
must appear
inside single quotes (' '
).
You can specify several name and value pair arguments in any order as
Name1,Value1,...,NameN,ValueN
.
'balancedSearch',false
, 'conflev',[0.90 0.93]
, 'init',100 starts monitoring from step m=100
, 'left',1
, 'intercept',false
, 'nocheck',true
, 'right',800
, 'tstat','trad'
balancedSearch
—Balanced search.scalar logical.If Balanced search the proportion of observations in the subsets equals (as much as possible) the proportion of units in the sample. The default value of balancedSearch is true.
Example: 'balancedSearch',false
Data Types: logical
conflev
—confidence levels to be used to compute confidence interval
for the elements of $\beta$ and for $\sigma^2$.vector.The default value of conflev is [0.95 0.99] that is 95% and 99% confidence intervals are computed.
Example: 'conflev',[0.90 0.93]
Data Types: double
init
—Search initialization.scalar.It specifies the point where to initialize the search and start monitoring required diagnostics. If init is not specified it will be set equal to : p+1, if the sample size is smaller than 40;
min(3*p+1,floor(0.5*(n+p+1))), otherwise.
Example: 'init',100 starts monitoring from step m=100
Data Types: double
left
—left limit for the censored dependent variable.scalar.If set to -Inf, the dependent variable is assumed to be not left-censored; default value of left is zero (classical Tobit model).
Example: 'left',1
Data Types: double
intercept
—Indicator for constant term.true (default) | false.Indicator for the constant term (intercept) in the fit, specified as the comma-separated pair consisting of 'Intercept' and either true to include or false to remove the constant term from the model.
Example: 'intercept',false
Data Types: boolean
nocheck
—Check input arguments.boolean.If nocheck is equal to true, no check is performed on matrix y and matrix X. Notice that y and X are left unchanged. In other words the additional column of ones for the intercept is not added. As default nocheck=false. The controls on h, alpha and nsamp still remain
Example: 'nocheck',true
Data Types: boolean
right
—right limit for the censored dependent variable.scalar.If set to Inf, the dependent variable is assumed to be not right-censored; default value of left is Inf (classical Tobit model).
Example: 'right',800
Data Types: double
tstat
—the kind of t-statistics which have to be monitored.character.tstat = 'trad' implies monitoring of traditional t statistics (out.Tols). In this case the estimate of $\sigma^2$ at step m is based on $s^2_m$ (notice that $s^2_m<<\sigma^2$ when m/n is small) tstat = 'scal' (default) implies monitoring of rescaled t statistics In this case the estimate of $\sigma^2$ at step m is based on $s^2_m / var_{truncnorm(m/n)}$ where $var_{truncnorm(m/n)}$ is the variance of the truncated normal distribution.
Example: 'tstat','trad'
Data Types: char
out
— description
StructureStructure which contains the following fields
Value | Description |
---|---|
RES |
n x (n-init+1) = matrix containing the monitoring of scaled residuals: 1st row = residual for first unit; ...; nth row = residual for nth unit. |
LEV |
(n+1) x (n-init+1) = matrix containing the monitoring of leverage: 1st row = leverage for first unit: ...; nth row = leverage for nth unit. |
BB |
n x (n-init+1) matrix containing the information about the units belonging to the subset at each step of the forward search: 1st col = indexes of the units forming subset in the initial step; ...; last column = units forming subset in the final step (all units). |
mdr |
n-init x 3 matrix which contains the monitoring of minimum deletion residual or (m+1)ordered residual at each step of the forward search: 1st col = fwd search index (from init to n-1); 2nd col = minimum deletion residual; 3rd col = (m+1)-ordered residual. Remark: these quantities are stored with sign, that is the min deletion residual is stored with negative sign if it corresponds to a negative residual. |
msr |
n-init+1 x 3 = matrix which contains the monitoring of maximum studentized residual or m-th ordered residual: 1st col = fwd search index (from init to n); 2nd col = maximum studentized residual; 3rd col = (m)-ordered studentized residual. |
nor |
(n-init+1) x 4 matrix containing the monitoring of normality test in each step of the forward search: 1st col = fwd search index (from init to n); 2nd col = Asymmetry test; 3rd col = Kurtosis test; 4th col = Normality test. |
Bols |
(n-init+1) x (p+1) matrix containing the monitoring of estimated beta coefficients in each step of the forward search. |
S2 |
(n-init+1) x 5 matrix containing the monitoring of S2 or R2, F test, in each step of the forward search: 1st col = fwd search index (from init to n); 2nd col = monitoring of S2; 3rd col = monitoring of R2; 4th col = monitoring of rescaled S2. In this case the estimated of $\sigma^2$ at step m is divided by the consistency factor (to make the estimate asymptotically unbiased). 5th col = monitoring of F test. Note that an asymptotic unbiased estimate of sigma2 is used. |
coo |
(n-init+1) x 3 matrix containing the monitoring of Cook or modified Cook distance in each step of the forward search: 1st col = fwd search index (from init to n); 2nd col = monitoring of Cook distance; 3rd col = monitoring of modified Cook distance. |
Tols |
(n-init+1) x (p+1) matrix containing the monitoring of estimated t-statistics (as specified in option input 'tstat'. in each step of the forward search |
Un |
(n-init) x 11 Matrix which contains the unit(s) included in the subset at each step of the fwd search. REMARK: in every step the new subset is compared with the old subset. Un contains the unit(s) present in the new subset but not in the old one. Un(1,2), for example, contains the unit included in step init+1. Un(end,2) contains the units included in the final step of the search. |
betaINT |
Confidence intervals for the elements of $\beta$. betaINT is a (n-init+1)-by-2*length(confint)-by-p 3D array. Each third dimension refers to an element of beta: betaINT(:,:,1) is associated with first element of beta; ...; betaINT(:,:,p) is associated with last element of beta. The first two columns contain the lower and upper confidence limits associated with conflev(1). Columns three and four contain the lower and upper confidence limits associated with conflev(2); ...; The last two columns contain the lower and upper confidence limits associated with conflev(end). For example, betaint(:,3:4,5) contain the lower and upper confidence limits for the fifth element of beta using confidence level specified in the second element of input option conflev. |
sigma2INT |
confidence interval for $\sigma^2$. 1st col = fwd search index; 2nd col = lower confidence limit based on conflev(1); 3rd col = upper confidence limit based on conflev(1); 4th col = lower confidence limit based on conflev(2); 5th col = upper confidence limit based on conflev(2); ... penultimate col = lower confidence limit based on conflev(end); last col = upper confidence limit based on conflev(end); |
y |
A vector with n elements that contains the response variable which has been used |
X |
Data matrix of explanatory variables which has been used (it also contains the column of ones if input option intercept was missing or equal to 1) |
class |
'FSReda'. |
Atkinson, A.C. and Riani, M. (2000), "Robust Diagnostic Regression Analysis", Springer Verlag, New York.
LXS
|
FSReda
|
FSRfanTobit