I have a categorical outcome (Response) that is either -1 or 1. I also have predictors (Weight, Condition, Trial Type) where all are categorical except weight which is continuous.
Basically, what I want to know is if Response changed depending on the weight of the trial.
So like Sbj 500, were they more likely to have a response of -1 at the weight of 6 versus the weight of 1.
Since my outcome is categorical, I did a GLM. But my overall model is not sig but each predictor is. I am not sure what the appropriate test to do is.
# Sample data frame
df500 <- data.frame(Sbj = c(500), TrialNum=c(1:6),
Condition=c(1,1,1,1,1,1),
TrialType = c(1, 1, 1, -1, -1, -1),
Weight=c(1:6), Response=c(-1,1,-1,1,1,-1))
df501 <- data.frame(Sbj = c(501), TrialNum=c(1:6),
Condition=c(-1,-1,-1,-1,-1,-1),
TrialType = c(-1, -1, -1, 1, 1, 1),
Weight=c(6:1), Response=c(1,-1,-1,1,1,-1))
df502 <- data.frame(Sbj = c(502), TrialNum=c(1:6),
Condition=c(1,1,1,1,1,1),
TrialType = c(1, 1, 1, -1, -1, -1),
Weight=c(1:6), Response=c(1,-1,-1,-1,1,1))
df <- merge(df500, df501, all=TRUE)
df <- merge(df, df502, all=TRUE)
# GLM
GLM_m <- glm(Response ~ 1 + Condition*Type*Weight,
data = df, family = "binomial")
summary(GLM_m)
In my summary, the individual coefficients are sig, but the overall model is not. What does this mean?
Testing depends only on the type of outcome.
In your case, for categorical
outcome you should make use of tests such as accuracy
, precision
, recall
, f-score
and confusion matrix
.
You can use error based metrics for continuous
outcomes. These metrics include mean square error
, mean absolute error
, root mean square error
, just to mention a few.
To see how various features relate to the predictions, you must have a look at the model summary. The summary consists of coefficients of the various features and answer your question of how well each feature relates to the prediction (How strongly does the feature affect the prediction).
Here is a comprehensive explanation to the model summary of a glm model
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.