search for: covar3

Displaying 1 result from an estimated 1 matches for "covar3".

Did you mean: covar
2010 Oct 12
1
Help with function writing
...of covariates and, ideally, I would like to be able to enter the covariates in a group (e.g. as a list) rather than individually. Is there any way of doing this? Example: #define function involving regression model with several covariates custom <- function(outcome, exposure, covar1, covar2, covar3){ model <- lm(outcome ~ exposure + covar1 + covar2 + covar3) expected <- predict(model) summary(expected) } library(MASS) attach(birthwt) custom(bwt, lwt, low, age, race) #Works when 3 covariates are specified custom(bwt,lwt,low,age) # Does not work with < or > 3 covariates v...