Dear r-help members I posted this message already yesterday, but don't know whether it reached you since I joined the group only yesterday. I would like to estimate the boxcox transformed model (y^t - 1)/t ~ b0 + b1 * x. Unfortunately, R returns with an error message when I try to perform this with the call nls( I((y^t - 1)/t) ~ I(b0 + b1*x), start = c(t=1,b0=0,b1=0), data = mydataframe) The error message is: Object "t" not found Apparently R seems not to accept parameters on the left hand side of a regression model. I know that my do-it-yourself strategy is not necessary, since the package box-cox is available. Unfortunately, I want the use the box-cox transformation in a quantile regression, i.e. I have to replace nls by nlrq in the call above. Any suggestions? Thanks and best regards, Johannes Ludsteck <><><><><><><><><><><><><><><><><><> Johannes Ludsteck Institut fuer Volkswirtschaftslehre Lehrstuhl Prof. Dr. Moeller Universitaet Regensburg Universitaetsstrasse 31 93053 Regensburg Tel +49/0941/943-2741
>Dear r-help members >I posted this message already yesterday, but don't know whether it >reached you since I joined the group only yesterday. >I would like to estimate the boxcox transformed model > (y^t - 1)/t ~ b0 + b1 * x. >Unfortunately, R returns with an error message when I try to >perform this with the call >nls( I((y^t - 1)/t) ~ I(b0 + b1*x), > start = c(t=1,b0=0,b1=0), data = mydataframe)>The error message is: Object "t" not found>Apparently R seems not to accept parameters on the left hand >side of a regression model. I know that my do-it-yourself >strategy is not necessary, since the package box-cox is >available. Unfortunately, I want the use the box-cox >transformation in a quantile regression, i.e. I have to replace >nls by nlrq in the call above.>Any suggestions?>Thanks and best regards, > Johannes LudsteckYou suggest the solution yourself: transform the equation to have all parameters at the right, thus: y ~ ((b0 + b1 * x) * t + 1) ^ 1/t (double check if this is correct) Best, Philippe Grosjean ...........]<(({?<...............<?}))><............................... ) ) ) ) ) ( ( ( ( ( Dr. Philippe Grosjean ) ) ) ) ) ( ( ( ( ( Numerical Ecology Laboratory ) ) ) ) ) Mons-Hainaut University ( ( ( ( ( 8, Av. du Champ de Mars, 7000 Mons ) ) ) ) ) Belgium ( ( ( ( ( ) ) ) ) ) e-mail: phgrosjean at sciviews.org ( ( ( ( ( SciViews project coordinator (http://www.sciviews.org) ) ) ) ) ) .......................................................................
On 20 Nov 2003 at 15:24, Philippe Grosjean wrote:> >Dear r-help members > >I posted this message already yesterday, but don't know whether it > >reached you since I joined the group only yesterday. I would like to > >estimate the boxcox transformed model > > (y^t - 1)/t ~ b0 + b1 * x. > >Unfortunately, R returns with an error message when I try to > >perform this with the call > >nls( I((y^t - 1)/t) ~ I(b0 + b1*x), > > start = c(t=1,b0=0,b1=0), data = mydataframe) > > >The error message is: Object "t" not found > > >Apparently R seems not to accept parameters on the left hand > >side of a regression model. I know that my do-it-yourself > >strategy is not necessary, since the package box-cox is > >available. Unfortunately, I want the use the box-cox > >transformation in a quantile regression, i.e. I have to replace > >nls by nlrq in the call above. > > >Any suggestions? > > >Thanks and best regards, > > Johannes Ludsteck > > You suggest the solution yourself: transform the equation to have all > parameters at the right, thus: > > y ~ ((b0 + b1 * x) * t + 1) ^ 1/t >Bit this is still not correct, since the transformation changes the scale of the variance, and lesat squares will not be correct. There is needed a factor (the jacobian) to compensate for this, Kjetil Halvorsen> (double check if this is correct) > > Best, > > Philippe Grosjean > > ...........]<(({?<...............<?}))><.............................. > . > ) ) ) ) ) > ( ( ( ( ( Dr. Philippe Grosjean > ) ) ) ) ) > ( ( ( ( ( Numerical Ecology Laboratory > ) ) ) ) ) Mons-Hainaut University > ( ( ( ( ( 8, Av. du Champ de Mars, 7000 Mons > ) ) ) ) ) Belgium > ( ( ( ( ( > ) ) ) ) ) e-mail: phgrosjean at sciviews.org > ( ( ( ( ( SciViews project coordinator (http://www.sciviews.org) > ) ) ) ) ) > ...................................................................... > . > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://www.stat.math.ethz.ch/mailman/listinfo/r-help
>> You suggest the solution yourself: transform the equation to have all >> parameters at the right, thus: >> >> y ~ ((b0 + b1 * x) * t + 1) ^ 1/t >>>Bit this is still not correct, since the transformation changes >the scale of the variance, and lesat squares will not be correct. >There is needed a factor (the jacobian) to compensate for this,>Kjetil HalvorsenOK, sorry you are correct: one would need also to calculate residuals as (y - ymodel)^2*t instead of (y - ymodel)^2 in the case of nls. This effects also nlrq, although in a somewhat reduced manner. Best, Philippe Grosjean