[R] bootstrapping quantile regression

2012-02-15 Thread Julia Lira
Dear all, I am currently running an experiment using quantile regression. In order to get more accurate results for a hypothesis test, I need to run a bootstrapping version of quantile regression and I need to find the estimated covariance matrix among all the coefficients for several quantiles

[R] VarCov matrix - quantile regression.

2012-01-20 Thread Julia Lira
Dear all, I would like to know how to print the variance-covariance matrix used in the function anova.rq () when investigating whether the coefficients of a quantile regression model is the same for a range of quantiles. To be more precise, when I use the function summary.rq(, cov=TRUE) conside

[R] "tau + h > 1: error in summary.rq"

2012-01-10 Thread Julia Lira
Dear all, I am doing a simulation for my model that works when I use only the rq() command. However, since I need to use the varcov matrix for my Wald test, I need to compute summary(rq(), cov=TRUE). But the simulation does not work because of the error: tau + h > 1: error in summary.rq I tr

[R] VarCov matrix between coefficients across quantiles - summary.rq

2012-01-06 Thread Julia Lira
Dear all, I am trying to design a Wald test to verify whether some coefficients are statistically equal. I would like to test not only whether they are jointly equal for a given quantile, but for a range of quantiles. Hence, I need to extract the variance-covariance matrix among the coefficient

Re: [R] extract cov matrix in summary.rq and use as a matrix.

2011-12-05 Thread Julia Lira
gt; To: julia.l...@hotmail.co.uk > > I'm not at my desk so this is untested, but I'm pretty sure double brackets > will do the trick: > > qf2_1[[3]] > > M > > On Dec 5, 2011, at 7:14 AM, Julia Lira wrote: > > > > > Dear all, > > > > I

[R] extract cov matrix in summary.rq and use as a matrix.

2011-12-05 Thread Julia Lira
Dear all, I need to extract the covariance matrix of my quantile regression estimation to use in a test. My regression is: qf2_1 <- summary(rq(wb2 ~ apv2 + vol2, tau = phi2[1]), cov = TRUE) I can extract the covaraince matrix by using: qf2_1 [3]. However, if I try to use it in the test, it do

[R] Constrained linear regression

2011-11-26 Thread Julia Lira
Dear all, I need to run a simple linear regression such that: y = b0 + b1*x1 + (1-b1)*x2 + e which I know I can use: lm(y ~ I(x1 - x2) + offset(x2)). However, I also need to restrict the coefficient b1 to be between 0 and 1. Is there any way to include such restriction in the linear regression es

[R] wald test: compare quantile regression estimators from different samples

2011-11-19 Thread Julia Lira
Dear all, I am trying to compare the estimated coefficients of a quantile regression model between two different samples. It is a Wald test, but I cannot find one way to do that in R.The samples are collected conditional on a specific characteristic and I would like to test whether such charact

Re: [R] linear against nonlinear alternatives - quantile regression

2011-11-05 Thread Julia Lira
y (sometimes a dubious practice because if you then remove > > nonlinear terms you are mildly cheating). > > > > require(rms) > > f <- Rq(y ~ x1 + rcs(x2,4), tau=.25) > > anova(f) # tests associations and nonlinearity of x2 > > > > Frank > > > >

[R] linear against nonlinear alternatives - quantile regression

2011-11-05 Thread Julia Lira
Dear all, I would like to know whether any specification test for linear against nonlinear model hypothesis has been implemented in R using the quantreg package. I could read papers concerning this issue, but they haven't been implemented at R. As far as I know, we only have two specificatio

[R] nlrq {quantreg}

2011-10-16 Thread Julia Lira
Dear all, I sent an email on Friday asking about nlrq {quantreg}, but I haven't received any answer. I need to estimate the quantile regression estimators of a model as: y = exp(b0+x'b1+u). The model is nonlinear in parameters, although I can linearise it by using log.When I write: fitnl <- nlr

[R] quantile function nonlinear in parameters.

2011-10-14 Thread Julia Lira
Dear all, I need to run a quantile regression to estimate the coefficients of the following model: Q_{Y}(τ|X)=exp(β₀(τ)+X′β₁(τ)). Since the model is nonlinear, I need to use nlrq(.). However, if I try nlrq(Y~exp(X), tau=τ), the software does not accept and also does not unders

[R] Loop in columns by group

2010-10-13 Thread Julia Lira
Dear all, I need to do a loop as following: #Consider a matrix: M <- matrix(1, nrow=10, ncol=20) #Matrices to store the looping results M1 <- matrix(0, nrow=10, ncol=400) h <- c(1:20/1000) #loop for (j in h){ M1 <- M/(2*j) } But this means that the first 20 columns of matrix M

Re: [R] loop

2010-10-13 Thread Julia Lira
roject.org > Subject: Re: [R] loop > > Julia, > > Can you provide a reproducible example? Your code calls the > 'rq' function which is not found on my system. > > Any paring down of the code to make it more readable would > help us help yo

[R] loop

2010-10-13 Thread Julia Lira
Dear all, I have just sent an email with my problem, but I think no one can see the red part, beacuse it is black. So, i am writing again the codes: rm(list=ls()) #remove almost everything in the memory set.seed(180185) nsim <- 10 mresultx <- matrix(-99, nrow=1000, ncol=nsim) mresultb <- ma

[R] (no subject)

2010-10-13 Thread Julia Lira
Dear all, I have just sent an email with my problem, but I think no one can see the red part, beacuse it is black. So, i am writing again the codes: rm(list=ls()) #remove almost everything in the memory set.seed(180185) nsim <- 10 mresultx <- matrix(-99, nrow=1000, ncol=nsim) mresultb <-

[R] loop

2010-10-13 Thread Julia Lira
Dear all, I am trying to run a loop in my codes, but the software returns an error: "subscript out of bounds" I dont understand exactly why this is happenning. My codes are the following: rm(list=ls()) #remove almost everything in the memory set.seed(180185) nsim <- 10 mresultx <- ma

Re: [R] quantile regression

2010-10-07 Thread Julia Lira
; > ## Do something that generates variable qf05 > > > > M[i,] <- coeff(qf05) > > } > > > > then M would be a nsim by 2 matrix, with each row holding the > > coefficients from a different simulation. You could also look at > > removing the loop by vectorisi

Re: [R] quantile regression

2010-10-07 Thread Julia Lira
: [R] quantile regression From: minhua...@gmail.com To: julia.l...@hotmail.co.uk You should define M as a vector or matrix depending on the length of coef(qf05) and let M[i] or M[,i] be coef(qf05). On Thu, Oct 7, 2010 at 6:40 PM, Julia Lira wrote: Dear all, I am a new user in r and

[R] quantile regression

2010-10-07 Thread Julia Lira
Dear all, I am a new user in r and I am facing some problems with the quantile regression specification. I have two matrix (mresultb and mresultx) with nrow=1000 and ncol=nsim, where I specify (let's say) nsim=10. Hence, the columns in my matrix represents each simulation of a determined va

[R] loop in R

2010-10-06 Thread Julia Lira
Dear all, I need to do a loop in R, but I am not sure the software is generating "n" times the variables I request differently. When I ask to print the last matrix created, I just can see the loop for n=1. To be more precise, supose I need to simulate 10 times one variable and I want to fi