• Register
0 votes

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
6 5 3
6,930 points

Please log in or register to answer this question.

1 Answer

0 votes

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")
9 7 4
38,600 points

Related questions

0 votes
1 answer 1.8K 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'"
asked Dec 16, 2019 alecxe 7.5k points
1 vote
1 answer 1.1K 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?
asked Dec 28, 2019 alecxe 7.5k points
0 votes
1 answer 75 views
0 votes
1 answer 262 views
Problem: I have very good knowledge of r, ggplot and unix. I am now a days trying to analyze the dataset of the GSR values. I had first transformed my all the required unix values into the readable data and after that I created the plot of my GSR values in the ... . But I had already supplied the origin when I tried to transform my unix into the readable data and also again in the ggplot code.
asked Jul 27, 2020 Raphael Pacheco 4.9k points
1 vote
1 answer 40 views
Problem : I am trying to understand R and I am very new to Programming as wel. If I try to create the box chart with the use of standard error bars I often face below error message: “Error: ggplot2 doesn't know how to deal with data of class numeric”. Looking for help in quick fixing the above error.
asked May 5, 2020 stewart 4k points
0 votes
1 answer 447 views
0 votes
1 answer 226 views
0 votes
1 answer 215 views
Problem : I am very new to r programming. I have the array and I want to implement the below method: x<-function(b){ if (b>0){ b/sum(b) } else 1 } This method is written to check if there is any value which is larger than the 0 and if it says ... message: &ldquo;Warning message: r the condition has length > 1 and only the first element will be used&rdquo;. How can I fix the above error message?
asked Feb 24, 2020 mphil 2.3k points
0 votes
3 answers 677 views
Problem : I am trying to coerce a list object to type 'double' Please find below my code: a <- structure(list(`X$Days` = c("10", "38", "66", "101", "129", "185", "283", "374")), .Names = "X$Days") Here a is like $`X$Days` [1] ... however the coercing functions are returning me following error: Error: (list) object cannot be coerced to type 'double' Please let me know how can I resolve the issue.
asked Dec 3, 2019 alecxe 7.5k points
1 vote
1 answer 1.7K views
Problem : I am facing following error : formula(formula, data = data) : invalid model formula in ExtractVars I am using the below code: install.packages("rpart") library("rpart") # you must change the below from windows to work on your linux box: mydata <- read.csv(file="c ... file to commas. I guess it is unable to read the data correctly. I am very new to the R and also a very new programmer.
asked Dec 14, 2019 alecxe 7.5k points