Displaying 3 results from an estimated 3 matches for "outome".
Did you mean:
outcome
2004 Apr 03
3
Seeking help for outomating regression (over columns) and storing selected output
Hello,
I have spent considerable time trying to figure out that which I am about to describe. This included searching Help, consulting my various R books, and trail and (always) error. I have been assuming I would need to use a loop (looping over columns) but perhaps and apply function would do the trick. I have unsuccessfully tried both.
A scaled down version of my situation is as follows:
2008 Feb 10
1
Using 'sapply' and 'by' in one function
...oefficients for the
predictor in separate models
fxb <- function(x) {lm(Outcome.1~Pred,da=x)$coef};
by(new,new$sex,fxb) #yields the coefficient for Outcome.1 for each sex
## I'd like to be able to combine 'sapply' and 'by' to be able to get
the regression coefficients for Outome.1 and Outcome.2 by each sex,
rather than running fxb a second time predicting 'Outcome.2' or by
subsetting the data - by sex - before I run the function, but the
following doesn't work -
by(new,new$sex,FUN=function(x)sapply(x[,1:2],fxa,new))
'Error in model.frame.default(formula =...
2008 Feb 11
0
Testing for differecnes between groups, need help to find the right test in R. (Kes Knave)
...oefficients for the
predictor in separate models
fxb <- function(x) {lm(Outcome.1~Pred,da=x)$coef};
by(new,new$sex,fxb) #yields the coefficient for Outcome.1 for each sex
## I'd like to be able to combine 'sapply' and 'by' to be able to get
the regression coefficients for Outome.1 and Outcome.2 by each sex,
rather than running fxb a second time predicting 'Outcome.2' or by
subsetting the data - by sex - before I run the function, but the
following doesn't work -
by(new,new$sex,FUN=function(x)sapply(x[,1:2],fxa,new))
'Error in model.frame.default(formula =...