Displaying 6 results from an estimated 6 matches for "formula2".
Did you mean:
formula
2007 Aug 15
3
Formula in lm inside lapply
...2,group)
#write formula inside lm--works fine
res1 <- lapply(levels(df$group), function(x) lm(y~x1,df, subset = group
==x))
res1
res2 <- lapply(levels(df$group),function(x) lm(y~x1+x2,df, subset =
group ==x))
res2
#try to pass formula into lm()--does not work
formula1 <- as.formula(y~x1)
formula2 <- as.formula(y~x1+x2)
resf1 <- lapply(levels(df$group),function(x) lm(formula1,df, subset =
group ==x))
resf1
resf2 <- lapply(levels(df$group),function(x) lm(formula2,df, subset =
group ==x))
Resf2
The error message is
'Error in eval(expr, envir, enclos): object "x" not fo...
2010 Dec 13
2
Does a formula object have a "left hand side"
Hello,
Does anyone know of a function that will determine whether
or not a formula object has a left hand side?
I.e., can differentiate between
y ~ x + z
and
~ x + z
Perhaps I'm overlooking the obvious...
Thanks!
2007 Oct 01
4
Disentagling formulas
I am writing a program in which I would like to take in a formula, change the response (Y) variable into something else, and then pass the formula, with the new Y variable to another function. That is, I am starting with
formula <- Y~X1+X2+X3
and I'd like to do something like
Y <- formula$Y
newY <- f(Y)
lm(newY~X1+X2+X3)
So far, it seems that my
2012 May 14
0
update.formula simplify = FALSE
Dear R users,
I am building a packaged where I want to use the "update.formula" function,
but modifying the option "simplify = TRUE" to "FALSE". Since this is not an
argument, I modified the code and created a new function as:
update.formula2 <- function (old, new, ...) {
tmp <- .Internal(update.formula(as.formula(old), as.formula(new)))
out <- formula(terms.formula(tmp, simplify = FALSE))
return(out)
}
This works fine. But when creating and checking the package ("R CMD check
--as-cran mypackage"), I obta...
2011 Apr 19
0
Error message in package:bayesSurv. Why?
...as precise
dates of birth of children and onset of depression, rather than the data
being interval-censored as in the tandmobile dataset.
I've set up survreg3 as follows
sample.childmdd <- bayessurvreg3(
formula=Surv(childtime+.01,childevent)~nchild+cluster(id),
random=~1,
formula2=Surv(mddtime+.01,mddevent)~nchild+blustatus+well.before+earlydep+cluster(id),
random2=~1,
onlyX=FALSE,
dir="chaindir.childmdd", nsimul=nsimul.childmdd,
prior=prior.gspl.child, prior2=prior.gspl.mdd,
prior.beta=prior.beta.child, prior.beta2=prior.bet...
2012 Jun 27
4
formula version of sunflowerplot() fails when axis label specified
Hello, R-help,
does anybody have already a work-around for the problem that the formula
version of sunflowerplot() throws an error when provided with a value for
xlab (or ylab) different from NULL:
> sunflowerplot( Sepal.Length ~ Sepal.Width, data = iris, xlab = "A")
Error in model.frame.default(formula = Sepal.Length ~ Sepal.Width, data = iris, :
variable lengths differ