Generation

generate functionTue, 18 Apr 2023

m1 <- clm(categorical_FOD_FODs ~ 0 + Condition_FODs:Language_used_FODs, data = indvar_FODs) How can I conduct this analysis using 'logistic regression'?

# This is a function that will take four inputs: # 1) matrix: a matrix of data # 2) outcome: the column name of the outcome/dependent variable # 3) predictors: a vector of column names, indicating which columns are the predictors/independent variables # 4) family: the family object, e.g. binomial() # This function will return a summary of a logistic regression model. # The function requires that you have the 'dplyr' package installed. log_reg <- function(matrix, outcome, predictors, family) { # Install and load the 'dplyr' package. #install.packages("dplyr") #library(dplyr) # Fit a logistic regression model, using the variables in 'predictors' # as the predictors and the variable in 'outcome' as the outcome # The model should use the family indicated by 'family'. # Make sure to save your model in the 'fit' object! #fit <- glm

Questions about programming?Chat with your personal AI assistant