Displaying 1 result from an estimated 1 matches for "actno".
Did you mean:
actio
2011 Aug 24
2
Regression by factor using "sapply"
...ught I had figured out how to do this using "by" and "sapply" formula
but I keep getting an error message of: "$ operator is invalid for atomic
vectors"
Here is what I've bee trying to use
# data is stored in a table called "usage"; other than the "ActNo" field,
all the fields are numeric
byDD <- function(data) {lm(AvgKWh~ AvgHDD + AvgCDD, data=data)}
byActNo <- by(usage, usage$ActNo, FUN=byDD)
sapply(byActNo, summary(byActno)$coef)
Thanks in advance! I'm sure a similar question has been covered somewhere
but everytime I follow the...