Skip to content
This repository was archived by the owner on Jun 1, 2023. It is now read-only.
This repository was archived by the owner on Jun 1, 2023. It is now read-only.

Inclusion of three types of models in search paper - Linear, GAM and Bayesian to Study Search #2

@jialincheoh

Description

@jialincheoh

Linear Model with Interaction term


## Interactions
df <- read.csv("final_unal0_functions_complete.csv")
# fit a smooth which varies by comparison_type
df$comparison_type <- factor(df$comparison_type)
fit.in1 <- lm(ssim_exp_scale ~ stage*comparison_type, data=df)
visreg(fit.in1, "stage", by="comparison_type")

Screenshot 2023-02-26 at 5 22 36 PM

GAM Model with factor smooth interaction ( Gaussian Family )


library(mgcv)
library(visreg)
df <- read.csv("final_unal0_functions_complete.csv")
# fit a smooth which varies by comparison_type
df$comparison_type <- factor(df$comparison_type)
# separate smooth functions for each level of the factor 
# each has its own smoothness parameter 
# centred ( no group means ) so include factor as a fixed effect
a2 <- gam(ssim_exp_scale ~ s(stage, k = 3, fx = TRUE, by = comparison_type) + comparison_type, data = df, family = gaussian())
summary(a2)
visreg(a2, xvar = "stage", by = "comparison_type", data = df, method = "REML")

Screenshot 2023-02-26 at 5 24 30 PM

Bayesian Analysis with Zero-One-Inflated Beta Model

library('brms')
library('lmerTest')
df <- read.csv("final_unal0_functions_complete.csv")
# fit a smooth which varies by comparison_type
df$comparison_type <- factor(df$comparison_type)
# separate smooth functions for each level of the factor 
# each has its own smoothness parameter 
# centred ( no group means ) so include factor as a fixed effect
a1 <- brm(ssim_exp_scale ~ s(stage, k = 3, fx = TRUE, by = comparison_type) + comparison_type, data = df, family = zero_one_inflated_beta(), iter = 3000)
summary(a1)

Screenshot 2023-02-26 at 5 49 16 PM

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions