Displaying 20 results from an estimated 10000 matches similar to: "No subject"
2023 Jul 08
1
Getting an error calling MASS::boxcox in a function
Thanks John.
?boxcox says:
*************************
Arguments
object
a formula or fitted model object. Currently only lm and aov objects are handled.
*************************
I read that as saying that
boxcox(lm(z+1 ~ 1),...)
should run without error. But it didn't. And perhaps here's why:
BoxCoxLambda <- function(z){
b <- MASS:::boxcox.lm(lm(z+1 ~ 1), lambda = seq(-5, 5,
2023 Jul 08
1
Getting an error calling MASS::boxcox in a function
Hi Bert,
On 2023-07-08 3:42 p.m., Bert Gunter wrote:
> Caution: This email may have originated from outside the organization. Please exercise additional caution with any links and attachments.
>
>
> Thanks John.
>
> ?boxcox says:
>
> *************************
> Arguments
>
> object
>
> a formula or fitted model object. Currently only lm and aov objects
2000 Feb 03
1
Re: your mail
> On Wed, 2 Feb 2000, Adriane Leal wrote:
>
> > I'd like to perform a box-cox transformation to a data set and also plot
> > lambda versus L(lambda) using R. Does anybody knows how can I do such a
> > thing?
gnlr3 in my gnlm library does both linear and nonlinear models with
Box-Cox transformation. However, it is somewhat nonstandard as it
renormalizes to obtain a
2023 Jul 08
1
Getting an error calling MASS::boxcox in a function
Dear Ron and Bert,
First (and without considering why one would want to do this, e.g.,
adding a start of 1 to the data), the following works for me:
------ snip ------
> library(MASS)
> BoxCoxLambda <- function(z){
+ b <- boxcox(z + 1 ~ 1,
+ lambda = seq(-5, 5, length.out = 101),
+ plotit = FALSE)
+ b$x[which.max(b$y)]
+ }
> mrow <- 500
2006 Oct 11
3
for loop not working in function
I'm trying to write a small function (below) to compute Box & Cox
transformations of x for arbitrary values of lambda. I'd like to
specify a range of values for lamba (min,max,step) and am having trouble
getting the for loop to work. Suggestions?
Any pointers to resources for learning to write functions in R for
neophyte programmers? Thanks. --Dale
boxcox <-
2023 Jul 08
1
Getting an error calling MASS::boxcox in a function
No, I'm afraid I'm wrong. Something went wrong with my R session and gave
me incorrect answers. After restarting, I continued to get the same error
as you did with my supposed "fix." So just ignore what I said and sorry for
the noise.
-- Bert
On Sat, Jul 8, 2023 at 8:28?AM Bert Gunter <bgunter.4567 at gmail.com> wrote:
> Try this for your function:
>
>
2023 Jul 08
1
Getting an error calling MASS::boxcox in a function
Hi,
Firstly, apologies as I have posted this on community.rstudio.com too.
I want to optimise a Box-Cox transformation on columns of a matrix (ie, a unique lambda for each column). So I wrote a function that includes the call to MASS::boxcox in order that it can be applied to each column easily. Except that I'm getting an error when calling the function. If I just extract a column of the
2023 Jul 08
1
Getting an error calling MASS::boxcox in a function
Try this for your function:
BoxCoxLambda <- function(z){
y <- z
b <- boxcox(y + 1 ~ 1,lambda = seq(-5, 5, length.out = 61), plotit =
FALSE)
b$x[which.max(b$y)] # best lambda
}
***I think*** (corrections and clarification strongly welcomed!) that `~`
(the formula function) is looking for 'z' in the GlobalEnv, the caller of
apply(), and not finding it. It finds
2004 Mar 01
1
boxcox in MASS library
Help page for boxcox function in MASS library says that
the transformation is y^lambda, which is different from
the Y' = log(Y) if lambda = 0 ,
Y' = ((Y ^ lambda) - 1)/lambda otherwise I'm used to.
Is this just a help page typo ?
Thanks.
----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.
2004 May 14
1
Problem with logtrans, from library MASS
Greetings all!
This problem occurs using R 1.8.1 on Windows XP. I downloaded the
binaries for R and all packages, including the VR bundle, in December 2003.
The data consists of NZ$ prices and attributes for 643 cars.
> summary(price)
Min. 1st Qu. Median Mean 3rd Qu. Max. NA's
14290 35800 48990 65400 79000 285000 2
> library(MASS)
> boxcox(price
2003 Jun 24
2
Haw I get best lambda in box-cox
Hi all,
Does anyone know of a function that return the best lambda in box-cox
transformation?
many thanks for any help.
--
Cristiane S. Rocha
Laboratorio Genoma Funcional - Bioinform?tica
Centro de Biologia Molecular e Engenharia Genetica
Universidade Estadual de Campinas
Campinas - SP - Brasil
Tel:(19)3788-1119
2008 Jun 05
1
choosing an appropriate linear model
I am trying to model the observed leaching of wood preservative chemicals
from treated wood during an outdoor experiment where leaching is caused by
rainfall events. For each rainfall event, the amount of rainfall was
recorded as well as the amount of preservative chemical leached. A number
of climatic variables were measured, but the most important is the amount of
rainfall.
I have tried a
2004 Dec 20
1
why use profile likelihood for Box Cox transformation?
Hi All,
I'm analysing some data that is conventionally modelled as log(Y) = a + bX + e. However, using the boxcox function, it appears that the optimum value of lambda is approx 0.05. I have 40 data sets of differing sizes and for about half of these, lambda is significantly non-zero. So, it is worth looking into.
The alternative model, Y^lambda = a + bX + e, has been explored before by
2006 Jul 29
1
boxcox transformation
I've got a vector of data (hours to drive from a to b) y.
After a qqplot I know, that they don't fit the normal probability.
I would like to transform these data with the boxcox transformation
(MASS), that they fit the model.
When I try
ybx<-boxcox(y~1,0)
qqnorm(ybx)
the plot is different from
library (TeachingDemos)
ybct<-bct(y,0) //
qqnorm(ybct)
How can I transform
2007 Jun 18
3
Inverse BoxCox transformation
Hi,
I can't seem to find a function in R that will reverse a BoxCox
transformation. Can somebody help me locate one please? Thanks in advance.
Best wishes,
Des
[[alternative HTML version deleted]]
2006 Feb 09
3
about Cox-Box transformation
Dear R-users,
I am using R version 1.8.0-1 under Suse 8.2.
I need to use the boxcox command because I want to apply a Cox-Box
transformation to a vector of rainfall values.
Within the libraries, the MASS library is present, but I don't know
whether this means that is automatically installed or not.
The command doesn't work. What do I have to do in order to make it
working? Is just a
2007 Dec 14
1
Help! - boxcox transformations
Hi,
Hope this does not sound too ignorant .
I am trying to detrend and transform variables to achieve normality and
stationarity (for time series use, namely spectral analysis). I am using the
boxcox transformations.
As my dataset contains zeros, I found I need to add a constant to it in
order to run "boxcox". I have ran tests adding several types of constants,
from .0001
2010 May 16
2
Box-Cox Transformation: Drastic differences when varying added constants
Dear experts,
I tried to learn about Box-Cox-transformation but found the following thing:
When I had to add a constant to make all values of the original variable
positive, I found that
the lambda estimates (box.cox.powers-function) differed dramatically
depending on the specific constant chosen.
In addition, the correlation between the transformed variable and the
original were not 1 (as I
2009 May 19
4
nlrwr package. Error when fitting the optimal Box-Cox transformation with two variables
Dear all:
I'm trying to fit the optimal Box-Cox
transformation related to nls (see the code
below) for the demand of money data in Green (3th
Edition) but in the last step R gives the next
error message.
Error en
`[.data.frame`(eval(object$data), ,
as.character(formula(object)[[2]])[2]) :
undefined columns selected.
?Any idea to solve the problem?
Thanks in advance,
2005 Jan 25
1
Box-Cox / data transformation question
Dear R users,
Is it reasonable to transform data (measurements of plant height) to the
power of 1/4? I?ve used boxcox(response~A*B) and lambda was close to 0.25.
Regards,
Christoph