in model.response(mf, "numeric") : using type = "numeric" with a factor response will be ignored

1.1k views

Problem :

I face folowing error when I run an ANOVA on R
in model.response(mf, "numeric") : using type = "numeric" with a factor response will be ignored

Solution :

One can not use a linear regression model with a factor as response variable which is same you are attempting to do here . Regression models do require numeric response variables. So you should instead look at classification models.

You may wish to start by restating your "type" variable as a logical binomial variable. Instead of a factor called "type" with two levels "A" and "B", you may create a new variable called "is.type.a", which should contain TRUE or FALSE.

So you should try a logistic regression based on a binomial distribution as follows :

`model <- glm(is.type.a ~ age + gender,data=data,family="binomial")`

Related questions

1 answer 2 views
2 views
Problem: I have a data.frame whose class column is Factor. I'd like to convert it to numeric so that I can use a correlation matrix. How can I convert a Factor column to a numeric column?
1 vote
1 answer 1.5K views
1.5K views
Problem : I have my data as this the ticks feed on three of the groups of treated mouse's and compare whether my treatment has the effect on ticks the bacteria load. When I tried to make the mixed model like below: lmer.model01 = lmer(log10.load ~ treat + ... below : Error: number of levels of each grouping factor must be < number of observations What must have happened and how can fix this error?
1 answer 2.5K views
2.5K views
Problem : I have been facing below error message and traceback: Error in FUN(X[[i]], ...) : only defined on the data frame with all numeric variables 5 stop("only defined on the data frame with all numeric variables") 4 FUN(X[[i]], ...) 3 lapply(args, ... .numeric(data[good,]) But now I get the different error message back as below : "Error: (list) object cannot be coerced to type 'double'"
1 answer 3 views
3 views
Problem: Error in family\$linkinv(eta) : Argument eta must be a nonempty numeric vector.The reason the title of the question is the error I am getting is because I simply do not know how to interpret it.Can Anyone solve this problem?
1 answer 32 views
32 views
Problem: error in as.date.numeric(value) : 'origin' must be supplied.
1 answer 302 views
302 views