Displaying 20 results from an estimated 900 matches similar to: "Getting an error calling MASS::boxcox in a function"
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
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
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
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
2025 Jan 23
3
Details about the boxcox function
Hi,
I tried with
library(MASS)
methods('boxcox')
# [1] boxcox.default* boxcox.formula* boxcox.lm*
Then
> boxcox.lm
Error: object 'boxcox.lm' not found
How to look into the codes of boxcox.lm?
Thanks for your time
[[alternative HTML version deleted]]
2013 Mar 06
1
red SNA
Estimados
Le consulto porque estoy intentando presentar unos datos de alguna forma un
poco distinta, salir un poco de la costumbre.
Primero describo los datos:
Suponiendo una secuencia:
golpe al auto -> torura de vidrio -> rotura de aciento
otro auto
golpe al auto -> -> rotura de aciento , a este por alguna causa no se le
rompio el vidio o esa información es desconocida.
Esta
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
2018 Aug 05
2
MASS::boxcox "object not found"
Hi there,
I wrote a function that wraps MASS::boxcox as:
bc <- function(vec) {
lam <- boxcox(lm(vec ~ 1))
lam <- lam$x[which.max(lam$y)]
(vec^lam - 1)/lam
}
When I invoke it as:
> x <- runif(20)
> bc(x)
Error in eval(predvars, data, env) : object 'vec' not found
I have googled, and rewrote the above function as:
bc <- function(vec) {
dat <<-
2018 Aug 05
2
MASS::boxcox "object not found"
Hi there,
I wrote a function that wraps MASS::boxcox as:
bc <- function(vec) {
lam <- boxcox(lm(vec ~ 1))
lam <- lam$x[which.max(lam$y)]
(vec^lam - 1)/lam
}
When I invoke it as:
> x <- runif(20)
> bc(x)
Error in eval(predvars, data, env) : object 'vec' not found
I have googled, and rewrote the above function as:
bc <- function(vec) {
dat <<-
2005 Jul 13
1
Boxcox transformation / homogeneity of variances
Dear r-helpers,
Prior to analysis of variance, I ran the Boxcox function (MASS library) to
find the best power transformation of my data. However, reading the Boxcox
help file, I cannot figure out if this function (through its associated
log-likelihood function) corrects for * normality only * or if it also
induces * homogeneity of variances *. I found in Biometry (Sokal and Rohlf,
p. 419)
2008 Mar 07
1
boxcox.fit error
Hi,
Thakns all for your help
I am doing the next in my dataframe tabla, column pend1, because the
Lilliefors (Kolmogorov-Smirnov) test give me a pvalue < alfa. (data no
normal distribution). I need do a transformation with box-cox or
other:
> bc <- boxcox.fit(tabla$pend1)
R send to me:
Error in boxcox.fit(tabla$pend1) : Transformation requires positive data
The summary for my data
2009 Nov 30
1
Scaling variables to positive values using scale() or performing BoxCox on negative data
Hi,
I'm doing some work with linear models, and I've scaled my data using the
scale(dataset) function. This was great at removing the skew, but I now
can't perform the Box Cox transformation on the data set (using the
boxcox(dataset) function), as the scaling has returned negative values.
So my question is: how can I get the scale function to return a positive set
of data (so I can
2025 Jan 27
0
Model.matrix pregunta correcta
Estimados
En el correo anterior copie y pegue mal. Este es el correcto.
Copio y pego un código reproducible donde está la pregunta, yo lo realicé con en un archivo cmd pero si no me equivoco en rstudio o cualquier otro debería ser leído sin problemas al cortar y pegar.
---
title: "Pregunta"
author: "Javier Marcuzzi"
format: html
editor: visual
---
## Consulta y descripción
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
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]]
2013 Dec 12
1
boxcox transformations
Hi,
I am new to R.
I need help with regards to box cox transformation.
I have phenotypic data for e.g. plant height.
data is non-normal. Skewness is 0.34.
Could you please help me?
Regards,
Yogi
--
View this message in context: http://r.789695.n4.nabble.com/boxcox-transformations-tp4682077.html
Sent from the R help mailing list archive at Nabble.com.
[[alternative HTML version deleted]]
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 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.
2024 Dec 20
2
Colores diseño matriz
Hola,
Tienes varios ejemplos de cómo hacer esto en esta galería de gráficos,
tanto de R como de Python.
https://r-graph-gallery.com/heatmap.html
Gracias,
Carlos Ortega
www.qualityexcellence.es
El mar, 17 dic 2024 a las 14:38, Javier Marcuzzi (<
javier.ruben.marcuzzi en gmail.com>) escribió:
> Estimados
>
> Estoy pensando en buscar la forma para explicar algo, dentro de la forma