Wow, that was an unnecessarily complicated suggestion.

Just run

 title("My title")

after running boxcox().

Duncan Murdoch

On 04/03/2021 12:30 p.m., Duncan Murdoch wrote:
On 04/03/2021 8:41 a.m., DY Kim wrote:
Greetings!

I am currently using R x64 4.0.4.

I used the box-cox power transformation to create a range of lambdas and
log-likelihood values using the equation.

b1=boxcox (DV ~ IV1 + IV2, data= newdata)

The above codes automatically created a plot with lambdas and
log-likelihood values.

I want to add a main and subtitle to the plot. Would you please provide me
with codes? Any help would be appreciated. Thank you.

The MASS:::boxcox.default method doesn't support adding a title.  If you
want one, you'll have to edit the function to put in a title in the call
to plot().  For example:

    boxcox.default <- MASS:::boxcox.default
    fix(boxcox.default)

and then edit this line

    plot(xl, loglik, xlab = xlab, ylab = ylab, type = "l",
              ylim = range(loglik, lim))

to

    plot(xl, loglik, xlab = xlab, ylab = ylab, type = "l",
              ylim = range(loglik, lim), main = "My title")

and save the result.  (You could make a slightly more sophisticated
change such as adding "main" as an argument to the function, and using
"main = main" in the call to plot(). )

Duncan Murdoch


______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to