https://github.com/tingying-he/beauvis
Raw File
Tip revision: b9d419b129e9ab5310413b0b7191ca9290ad52d9 authored by Tobias Isenberg on 16 November 2023, 09:47:27 UTC
Update Readme.md
Tip revision: b9d419b
.Rhistory
list.by.group = TRUE,
drop.list.single.group = TRUE)
APV.model ='aesthetic_pleasure =~ enjoyable + likable + pleasing + nice + appealing'
fit <- cfa(APV.model,data = data_sun,std.lv = TRUE)
lavInspect(fit, what = "std.all", add.labels = TRUE, add.class = TRUE,
list.by.group = TRUE,
drop.list.single.group = TRUE)[[1]]
APV.model ='aesthetic_pleasure =~ enjoyable + likable + pleasing + nice + appealing'
fit1 <- cfa(APV.model,data = data_sun,std.lv = TRUE)
l1 <- lavInspect(fit1, what = "std.all", add.labels = TRUE, add.class = TRUE,
list.by.group = TRUE,
drop.list.single.group = TRUE)[[1]]
fit2 <- cfa(APV.model,data = data_star,std.lv = TRUE)
l2 <- lavInspect(fit2, what = "std.all", add.labels = TRUE, add.class = TRUE,
list.by.group = TRUE,
drop.list.single.group = TRUE)[[1]]
tea <- cbind(l1, l2)
tea
data <- read.csv(paste("03_EFA/data/",participantResponseFiles[[1]],sep=""), encoding="UTF-8")
parallel <- fa.parallel(correlation(1,data), n.obs=nrow(data), fa="fa", n.iter=100, main="Scree plots with parallel analysis")
library(png)
library(psych)
library(EFA.dimensions)
library(imager)
library(corrplot)
library(knitr)
library(kableExtra)
library(xtable)
library(dplyr)
library(tibble)
library(ggplot2)
data <- read.csv(paste("03_EFA/data/",participantResponseFiles[[1]],sep=""), encoding="UTF-8")
parallel <- fa.parallel(correlation(1,data), n.obs=nrow(data), fa="fa", n.iter=100, main="Scree plots with parallel analysis")
data <- read.csv(paste("03_EFA/data/",participantResponseFiles[[1]],sep=""), encoding="UTF-8")
parallel <- fa.parallel(cor(1,data), n.obs=nrow(data), fa="fa", n.iter=100, main="Scree plots with parallel analysis")
data <- read.csv(paste("03_EFA/data/",participantResponseFiles[[1]],sep=""), encoding="UTF-8")
parallel <- fa.parallel(cor(data), n.obs=nrow(data), fa="fa", n.iter=100, main="Scree plots with parallel analysis")
nfact <- parallel.nfact
data <- read.csv(paste("03_EFA/data/",participantResponseFiles[[1]],sep=""), encoding="UTF-8")
parallel <- fa.parallel(cor(data), n.obs=nrow(data), fa="fa", n.iter=100, main="Scree plots with parallel analysis")
nfact <- parallel$nfact
nfact
# DELETE!!!
data <- read.csv(paste("03_EFA/data/",participantResponseFiles[[1]],sep=""), encoding="UTF-8")
parallel <- fa.parallel(cor(data), n.obs=nrow(data), fa="fa", n.iter=100, main="Scree plots with parallel analysis")
parallel$nfact
knitr::opts_chunk$set(echo = TRUE)
# import data
data <- read.csv("04_CFA/validation results + demographics - valid - PID removed.csv" , encoding="UTF-8")
data
# split data
# results for Sunburst - our scale
data_sun <- data[, c('sunburst.enjoyable.', 'sunburst.likable.', 'sunburst.pleasing.', 'sunburst.nice.', 'sunburst.appealing.')]
# results for Sunburst - classic aesthetic for website scale
data_sun_ca <- data[, c('sunburst.aesthetic.', 'sunburst.pleasant.', 'sunburst.clear.', 'sunburst.clean.', 'sunburst.symmetric.')]
# results for Beamtree - our scale
data_beam <- data[, c('beamtree.enjoyable.', 'beamtree.likable.', 'beamtree.pleasing.', 'beamtree.nice.', 'beamtree.appealing.')]
# results for Beamtree - classic aesthetic for website scale
data_beam_ca <- data[, c('beamtree.aesthetic.', 'beamtree.pleasant.', 'beamtree.clear.', 'beamtree.clean.', 'beamtree.symmetric.')]
# results for Startree - our scale
data_star <- data[, c('startree.enjoyable.', 'startree.likable.', 'startree.pleasing.', 'startree.nice.', 'startree.appealing.')]
# results for Startree - classic aesthetic for website scale
data_star_ca <- data[, c('startree.aesthetic.', 'startree.pleasant.', 'startree.clear.', 'startree.clean.', 'startree.symmetric.')]
#Clean the column name function
cleanColnames <- function(data, visName){
# delete visName and . from column name of dataframe, only keep the terms as column name
names(data) <- sub(paste(visName, ".", sep =""), "", names(data))
names(data) <- sub("\\.", "", names(data))
return(data)
}
# Clean column names for all data
data_sun <- cleanColnames(data_sun, "sunburst")
data_sun_ca <- cleanColnames(data_sun_ca, "sunburst")
data_beam <- cleanColnames(data_beam, "beamtree")
data_beam_ca <- cleanColnames(data_beam_ca, "beamtree")
data_star <- cleanColnames(data_star, "startree")
data_star_ca <- cleanColnames(data_star_ca, "startree")
CFA <- function(data){
APV.model ='aesthetic_pleasure =~ enjoyable + likable + pleasing + nice + appealing'
fit <- cfa(APV.model,data = data,std.lv = TRUE)
pvalue <- fitMeasures(fit, "pvalue")
tli <- fitMeasures(fit, "tli")
cfi <- fitMeasures(fit, "cfi")
srmr <- fitMeasures(fit, "srmr")
rmsea <- fitMeasures(fit, "rmsea")
good_fit_list <- NULL
good_fit_list <- c(pvalue, tli, cfi, srmr, rmsea)
summary(fit, fit.measures=T, standardized=TRUE)
return(good_fit_list)
}
#CFA factor numbers
APV.model ='aesthetic_pleasure =~ enjoyable + likable + pleasing + nice + appealing'
fit1 <- cfa(APV.model,data = data_sun,std.lv = TRUE)
# import library
library(lavaan) #CFA
library(ltm) # Cronbach's alpha
#CFA factor numbers
APV.model ='aesthetic_pleasure =~ enjoyable + likable + pleasing + nice + appealing'
fit1 <- cfa(APV.model,data = data_sun,std.lv = TRUE)
l1 <- lavInspect(fit1, what = "std.all", add.labels = TRUE, add.class = TRUE,
list.by.group = TRUE,
drop.list.single.group = TRUE)[[1]]
fit2 <- cfa(APV.model,data = data_star,std.lv = TRUE)
l2 <- lavInspect(fit2, what = "std.all", add.labels = TRUE, add.class = TRUE,
list.by.group = TRUE,
drop.list.single.group = TRUE)[[1]]
fit3 <- cfa(APV.model,data = data_beam,std.lv = TRUE)
l3 <- lavInspect(fit3, what = "std.all", add.labels = TRUE, add.class = TRUE,
list.by.group = TRUE,
drop.list.single.group = TRUE)[[1]]
df_factor_loading_cfa <- cbind(l1, l2, l3)
df_factor_loading_cfa
write.table(df_factor_loading_cfa, paste("results/cfa_factor_loading.tsv",sep=""),row.names=TRUE,col.names=NA,sep='\t')
good_fit_sun <- CFA(data_sun)
good_fit_star <- CFA(data_star)
good_fit_beam <- CFA(data_beam)
good_fit_table <- cbind(good_fit_sun, good_fit_star, good_fit_beam)
good_fit_table
write.table(df_factor_loading_cfa, paste("results/cfa_good_fit.tsv",sep=""),row.names=TRUE,col.names=NA,sep='\t')
#CFA factor numbers
APV.model ='aesthetic_pleasure =~ enjoyable + likable + pleasing + nice + appealing'
fit1 <- cfa(APV.model,data = data_sun,std.lv = TRUE)
l1 <- lavInspect(fit1, what = "std.all", add.labels = TRUE, add.class = TRUE,
list.by.group = TRUE,
drop.list.single.group = TRUE)[[1]]
fit2 <- cfa(APV.model,data = data_star,std.lv = TRUE)
l2 <- lavInspect(fit2, what = "std.all", add.labels = TRUE, add.class = TRUE,
list.by.group = TRUE,
drop.list.single.group = TRUE)[[1]]
fit3 <- cfa(APV.model,data = data_beam,std.lv = TRUE)
l3 <- lavInspect(fit3, what = "std.all", add.labels = TRUE, add.class = TRUE,
list.by.group = TRUE,
drop.list.single.group = TRUE)[[1]]
df_factor_loading_cfa <- cbind(l1, l2, l3)
df_factor_loading_cfa
write.table(df_factor_loading_cfa, paste("results/cfa_factor_loading.tsv",sep=""),row.names=TRUE,col.names=NA,sep='\t')
good_fit_sun <- CFA(data_sun)
good_fit_star <- CFA(data_star)
good_fit_beam <- CFA(data_beam)
good_fit_table <- cbind(good_fit_sun, good_fit_star, good_fit_beam)
good_fit_table
write.table(good_fit_table, paste("results/cfa_good_fit.tsv",sep=""),row.names=TRUE,col.names=NA,sep='\t')
df_factor_loading_cfa <- df_factor_loading_cfa %>%
mutate_if(is.numeric, round, digits=3)
library(png)
library(psych)
library(EFA.dimensions)
library(imager) #install XQuartz
library(corrplot)
library(knitr)
library(kableExtra) #choose “no” when installing
library(xtable)
library(dplyr)
library(tibble)
library(ggplot2)
#CFA factor numbers
APV.model ='aesthetic_pleasure =~ enjoyable + likable + pleasing + nice + appealing'
fit1 <- cfa(APV.model,data = data_sun,std.lv = TRUE)
l1 <- lavInspect(fit1, what = "std.all", add.labels = TRUE, add.class = TRUE,
list.by.group = TRUE,
drop.list.single.group = TRUE)[[1]]
fit2 <- cfa(APV.model,data = data_star,std.lv = TRUE)
l2 <- lavInspect(fit2, what = "std.all", add.labels = TRUE, add.class = TRUE,
list.by.group = TRUE,
drop.list.single.group = TRUE)[[1]]
fit3 <- cfa(APV.model,data = data_beam,std.lv = TRUE)
l3 <- lavInspect(fit3, what = "std.all", add.labels = TRUE, add.class = TRUE,
list.by.group = TRUE,
drop.list.single.group = TRUE)[[1]]
df_factor_loading_cfa <- cbind(l1, l2, l3)
df_factor_loading_cfa <- df_factor_loading_cfa %>%
mutate_if(is.numeric, round, digits=3)
#CFA factor numbers
APV.model ='aesthetic_pleasure =~ enjoyable + likable + pleasing + nice + appealing'
fit1 <- cfa(APV.model,data = data_sun,std.lv = TRUE)
l1 <- lavInspect(fit1, what = "std.all", add.labels = TRUE, add.class = TRUE,
list.by.group = TRUE,
drop.list.single.group = TRUE)[[1]]
fit2 <- cfa(APV.model,data = data_star,std.lv = TRUE)
l2 <- lavInspect(fit2, what = "std.all", add.labels = TRUE, add.class = TRUE,
list.by.group = TRUE,
drop.list.single.group = TRUE)[[1]]
fit3 <- cfa(APV.model,data = data_beam,std.lv = TRUE)
l3 <- lavInspect(fit3, what = "std.all", add.labels = TRUE, add.class = TRUE,
list.by.group = TRUE,
drop.list.single.group = TRUE)[[1]]
df_factor_loading_cfa <- cbind(l1, l2, l3)
df_factor_loading_cfa
write.table(df_factor_loading_cfa, paste("results/cfa_factor_loading.tsv",sep=""),row.names=TRUE,col.names=NA,sep='\t')
good_fit_sun <- CFA(data_sun)
good_fit_star <- CFA(data_star)
good_fit_beam <- CFA(data_beam)
good_fit_table <- cbind(good_fit_sun, good_fit_star, good_fit_beam)
good_fit_table  <- good_fit_table  %>%
mutate_if(is.numeric, round, digits=3)
#CFA factor numbers
APV.model ='aesthetic_pleasure =~ enjoyable + likable + pleasing + nice + appealing'
fit1 <- cfa(APV.model,data = data_sun,std.lv = TRUE)
l1 <- lavInspect(fit1, what = "std.all", add.labels = TRUE, add.class = TRUE,
list.by.group = TRUE,
drop.list.single.group = TRUE)[[1]]
fit2 <- cfa(APV.model,data = data_star,std.lv = TRUE)
l2 <- lavInspect(fit2, what = "std.all", add.labels = TRUE, add.class = TRUE,
list.by.group = TRUE,
drop.list.single.group = TRUE)[[1]]
fit3 <- cfa(APV.model,data = data_beam,std.lv = TRUE)
l3 <- lavInspect(fit3, what = "std.all", add.labels = TRUE, add.class = TRUE,
list.by.group = TRUE,
drop.list.single.group = TRUE)[[1]]
#df_factor_loading_cfa <- cbind(l1, l2, l3)
df_factor_loading_cfa <- data.frame(matrix(ncol = 0, nrow = 5))
#list_pearson_con <- c(con_vali(data_sun, data_sun_ca)$estimate,con_vali(data_star, data_star_ca)$estimate,con_vali(data_beam, data_beam_ca)$estimate)
#list_pearson_dis <- c(dis_vali(data_sun)$estimate,dis_vali(data_star)$estimate,dis_vali(data_beam)$estimate)
colnames(df_factor_loading_cfa) <- c("SunBurst", "StarTree", "BeamTree")
#CFA factor numbers
APV.model ='aesthetic_pleasure =~ enjoyable + likable + pleasing + nice + appealing'
fit1 <- cfa(APV.model,data = data_sun,std.lv = TRUE)
l1 <- lavInspect(fit1, what = "std.all", add.labels = TRUE, add.class = TRUE,
list.by.group = TRUE,
drop.list.single.group = TRUE)[[1]]
fit2 <- cfa(APV.model,data = data_star,std.lv = TRUE)
l2 <- lavInspect(fit2, what = "std.all", add.labels = TRUE, add.class = TRUE,
list.by.group = TRUE,
drop.list.single.group = TRUE)[[1]]
fit3 <- cfa(APV.model,data = data_beam,std.lv = TRUE)
l3 <- lavInspect(fit3, what = "std.all", add.labels = TRUE, add.class = TRUE,
list.by.group = TRUE,
drop.list.single.group = TRUE)[[1]]
#df_factor_loading_cfa <- cbind(l1, l2, l3)
df_factor_loading_cfa <- data.frame(matrix(ncol = 0, nrow = 5))
#list_pearson_con <- c(con_vali(data_sun, data_sun_ca)$estimate,con_vali(data_star, data_star_ca)$estimate,con_vali(data_beam, data_beam_ca)$estimate)
#list_pearson_dis <- c(dis_vali(data_sun)$estimate,dis_vali(data_star)$estimate,dis_vali(data_beam)$estimate)
#colnames(df_factor_loading_cfa) <- c("SunBurst", "StarTree", "BeamTree")
df_factor_loading_cfa[ncol(df_factor_loading_cfa) + 1,] <- l1
df_factor_loading_cfa[ncol(df_factor_loading_cfa) + 1,] <- l2
df_factor_loading_cfa[ncol(df_factor_loading_cfa) + 1,] <- l3
#row.names(df_pearson) <- c("Classic Aesthetic", "Age")
df_factor_loading_cfa <- df_factor_loading_cfa %>%
mutate_if(is.numeric, round, digits=3)
df_factor_loading_cfa
#df_factor_loading_cfa
write.table(df_factor_loading_cfa, paste("results/cfa_factor_loading.tsv",sep=""),row.names=TRUE,col.names=NA,sep='\t')
#CFA factor numbers
APV.model ='aesthetic_pleasure =~ enjoyable + likable + pleasing + nice + appealing'
fit1 <- cfa(APV.model,data = data_sun,std.lv = TRUE)
l1 <- lavInspect(fit1, what = "std.all", add.labels = TRUE, add.class = TRUE,
list.by.group = TRUE,
drop.list.single.group = TRUE)[[1]]
fit2 <- cfa(APV.model,data = data_star,std.lv = TRUE)
l2 <- lavInspect(fit2, what = "std.all", add.labels = TRUE, add.class = TRUE,
list.by.group = TRUE,
drop.list.single.group = TRUE)[[1]]
fit3 <- cfa(APV.model,data = data_beam,std.lv = TRUE)
l3 <- lavInspect(fit3, what = "std.all", add.labels = TRUE, add.class = TRUE,
list.by.group = TRUE,
drop.list.single.group = TRUE)[[1]]
df_factor_loading_cfa <- cbind(l1, l2, l3)
df_factor_loading_cfa
write.table(df_factor_loading_cfa, paste("results/cfa_factor_loading.tsv",sep=""),row.names=TRUE,col.names=NA,sep='\t')
good_fit_sun <- CFA(data_sun)
good_fit_star <- CFA(data_star)
good_fit_beam <- CFA(data_beam)
good_fit_table <- cbind(good_fit_sun, good_fit_star, good_fit_beam)
good_fit_table
write.table(good_fit_table, paste("results/cfa_good_fit.tsv",sep=""),row.names=TRUE,col.names=NA,sep='\t')
#CFA factor numbers
APV.model ='aesthetic_pleasure =~ enjoyable + likable + pleasing + nice + appealing'
fit1 <- cfa(APV.model,data = data_sun,std.lv = TRUE)
l1 <- lavInspect(fit1, what = "std.all", add.labels = TRUE, add.class = TRUE,
list.by.group = TRUE,
drop.list.single.group = TRUE)[[1]]
fit2 <- cfa(APV.model,data = data_star,std.lv = TRUE)
l2 <- lavInspect(fit2, what = "std.all", add.labels = TRUE, add.class = TRUE,
list.by.group = TRUE,
drop.list.single.group = TRUE)[[1]]
fit3 <- cfa(APV.model,data = data_beam,std.lv = TRUE)
l3 <- lavInspect(fit3, what = "std.all", add.labels = TRUE, add.class = TRUE,
list.by.group = TRUE,
drop.list.single.group = TRUE)[[1]]
l1
df_factor_loading_cfa <- cbind(l1, l2, l3)
df_factor_loading_cfa
write.table(df_factor_loading_cfa, paste("results/cfa_factor_loading.tsv",sep=""),row.names=TRUE,col.names=NA,sep='\t')
#CFA factor numbers
APV.model ='aesthetic_pleasure =~ enjoyable + likable + pleasing + nice + appealing'
fit1 <- cfa(APV.model,data = data_sun,std.lv = TRUE)
l1 <- lavInspect(fit1, what = "std.all", add.labels = FALSE, add.class = TRUE,
list.by.group = TRUE,
drop.list.single.group = TRUE)[[1]]
fit2 <- cfa(APV.model,data = data_star,std.lv = TRUE)
l2 <- lavInspect(fit2, what = "std.all", add.labels = TRUE, add.class = TRUE,
list.by.group = TRUE,
drop.list.single.group = TRUE)[[1]]
fit3 <- cfa(APV.model,data = data_beam,std.lv = TRUE)
l3 <- lavInspect(fit3, what = "std.all", add.labels = TRUE, add.class = TRUE,
list.by.group = TRUE,
drop.list.single.group = TRUE)[[1]]
df_factor_loading_cfa <- cbind(l1, l2, l3)
df_factor_loading_cfa
#write.table(df_factor_loading_cfa, paste("results/cfa_factor_loading.tsv",sep=""),row.names=TRUE,col.names=NA,sep='\t')
#CFA factor numbers
APV.model ='aesthetic_pleasure =~ enjoyable + likable + pleasing + nice + appealing'
fit1 <- cfa(APV.model,data = data_sun,std.lv = TRUE)
l1 <- lavInspect(fit1, what = "std.all", add.labels = FALSE, add.class = TRUE,
list.by.group = TRUE,
drop.list.single.group = TRUE)[[1]]
fit2 <- cfa(APV.model,data = data_star,std.lv = TRUE)
l2 <- lavInspect(fit2, what = "std.all", add.labels = FALSE, add.class = TRUE,
list.by.group = TRUE,
drop.list.single.group = TRUE)[[1]]
fit3 <- cfa(APV.model,data = data_beam,std.lv = TRUE)
l3 <- lavInspect(fit3, what = "std.all", add.labels = FALSE, add.class = TRUE,
list.by.group = TRUE,
drop.list.single.group = TRUE)[[1]]
df_factor_loading_cfa <- cbind(l1, l2, l3)
df_factor_loading_cfa
#write.table(df_factor_loading_cfa, paste("results/cfa_factor_loading.tsv",sep=""),row.names=TRUE,col.names=NA,sep='\t')
#CFA factor numbers
APV.model ='aesthetic_pleasure =~ enjoyable + likable + pleasing + nice + appealing'
fit1 <- cfa(APV.model,data = data_sun,std.lv = TRUE)
l1 <- lavInspect(fit1, what = "std.all", add.labels = FALSE, add.class = TRUE,
list.by.group = TRUE,
drop.list.single.group = TRUE)[[1]]
fit2 <- cfa(APV.model,data = data_star,std.lv = TRUE)
l2 <- lavInspect(fit2, what = "std.all", add.labels = FALSE, add.class = TRUE,
list.by.group = TRUE,
drop.list.single.group = TRUE)[[1]]
fit3 <- cfa(APV.model,data = data_beam,std.lv = TRUE)
l3 <- lavInspect(fit3, what = "std.all", add.labels = FALSE, add.class = TRUE,
list.by.group = TRUE,
drop.list.single.group = TRUE)[[1]]
df_factor_loading_cfa <- cbind(SunBurst = l1, StarTree = l2, BeamTree = l3)
df_factor_loading_cfa
#write.table(df_factor_loading_cfa, paste("results/cfa_factor_loading.tsv",sep=""),row.names=TRUE,col.names=NA,sep='\t')
#CFA factor numbers
APV.model ='aesthetic_pleasure =~ enjoyable + likable + pleasing + nice + appealing'
fit1 <- cfa(APV.model,data = data_sun,std.lv = TRUE)
l1 <- lavInspect(fit1, what = "std.all", add.labels = FALSE, add.class = TRUE,
list.by.group = TRUE,
drop.list.single.group = TRUE)[[1]]
fit2 <- cfa(APV.model,data = data_star,std.lv = TRUE)
l2 <- lavInspect(fit2, what = "std.all", add.labels = FALSE, add.class = TRUE,
list.by.group = TRUE,
drop.list.single.group = TRUE)[[1]]
fit3 <- cfa(APV.model,data = data_beam,std.lv = TRUE)
l3 <- lavInspect(fit3, what = "std.all", add.labels = FALSE, add.class = TRUE,
list.by.group = TRUE,
drop.list.single.group = TRUE)[[1]]
df_factor_loading_cfa <- cbind(l1, l2, l3)
colnames(df_factor_loading_cfa)
df_factor_loading_cfa
#write.table(df_factor_loading_cfa, paste("results/cfa_factor_loading.tsv",sep=""),row.names=TRUE,col.names=NA,sep='\t')
#CFA factor numbers
APV.model ='aesthetic_pleasure =~ enjoyable + likable + pleasing + nice + appealing'
fit1 <- cfa(APV.model,data = data_sun,std.lv = TRUE)
l1 <- lavInspect(fit1, what = "std.all", add.labels = FALSE, add.class = TRUE,
list.by.group = TRUE,
drop.list.single.group = TRUE)[[1]]
fit2 <- cfa(APV.model,data = data_star,std.lv = TRUE)
l2 <- lavInspect(fit2, what = "std.all", add.labels = FALSE, add.class = TRUE,
list.by.group = TRUE,
drop.list.single.group = TRUE)[[1]]
fit3 <- cfa(APV.model,data = data_beam,std.lv = TRUE)
l3 <- lavInspect(fit3, what = "std.all", add.labels = FALSE, add.class = TRUE,
list.by.group = TRUE,
drop.list.single.group = TRUE)[[1]]
df_factor_loading_cfa <- cbind(l1, l2, l3)
colnames(df_factor_loading_cfa)[1] <- "SunBurst"
#CFA factor numbers
APV.model ='aesthetic_pleasure =~ enjoyable + likable + pleasing + nice + appealing'
fit1 <- cfa(APV.model,data = data_sun,std.lv = TRUE)
l1 <- lavInspect(fit1, what = "std.all", add.labels = FALSE, add.class = TRUE,
list.by.group = TRUE,
drop.list.single.group = TRUE)[[1]]
fit2 <- cfa(APV.model,data = data_star,std.lv = TRUE)
l2 <- lavInspect(fit2, what = "std.all", add.labels = FALSE, add.class = TRUE,
list.by.group = TRUE,
drop.list.single.group = TRUE)[[1]]
fit3 <- cfa(APV.model,data = data_beam,std.lv = TRUE)
l3 <- lavInspect(fit3, what = "std.all", add.labels = FALSE, add.class = TRUE,
list.by.group = TRUE,
drop.list.single.group = TRUE)[[1]]
df_factor_loading_cfa <- cbind(l1, l2, l3)
colnames(df_factor_loading_cfa) <- c("aa", "bb", "cc")
df_factor_loading_cfa
#write.table(df_factor_loading_cfa, paste("results/cfa_factor_loading.tsv",sep=""),row.names=TRUE,col.names=NA,sep='\t')
#CFA factor numbers
APV.model ='aesthetic_pleasure =~ enjoyable + likable + pleasing + nice + appealing'
fit1 <- cfa(APV.model,data = data_sun,std.lv = TRUE)
l1 <- lavInspect(fit1, what = "std.all", add.labels = FALSE, add.class = TRUE,
list.by.group = TRUE,
drop.list.single.group = TRUE)[[1]]
fit2 <- cfa(APV.model,data = data_star,std.lv = TRUE)
l2 <- lavInspect(fit2, what = "std.all", add.labels = FALSE, add.class = TRUE,
list.by.group = TRUE,
drop.list.single.group = TRUE)[[1]]
fit3 <- cfa(APV.model,data = data_beam,std.lv = TRUE)
l3 <- lavInspect(fit3, what = "std.all", add.labels = FALSE, add.class = TRUE,
list.by.group = TRUE,
drop.list.single.group = TRUE)[[1]]
df_factor_loading_cfa <- cbind(l1, l2, l3)
colnames(df_factor_loading_cfa) <- c("SunBurst", "StarTree", "BeamTree")
rownames(df_factor_loading_cfa) <- c("enjoyable", "likable", "pleasing", "nice","appealing")
df_factor_loading_cfa
#write.table(df_factor_loading_cfa, paste("results/cfa_factor_loading.tsv",sep=""),row.names=TRUE,col.names=NA,sep='\t')
#CFA factor numbers
APV.model ='aesthetic_pleasure =~ enjoyable + likable + pleasing + nice + appealing'
fit1 <- cfa(APV.model,data = data_sun,std.lv = TRUE)
l1 <- lavInspect(fit1, what = "std.all", add.labels = FALSE, add.class = TRUE,
list.by.group = TRUE,
drop.list.single.group = TRUE)[[1]]
fit2 <- cfa(APV.model,data = data_star,std.lv = TRUE)
l2 <- lavInspect(fit2, what = "std.all", add.labels = FALSE, add.class = TRUE,
list.by.group = TRUE,
drop.list.single.group = TRUE)[[1]]
fit3 <- cfa(APV.model,data = data_beam,std.lv = TRUE)
l3 <- lavInspect(fit3, what = "std.all", add.labels = FALSE, add.class = TRUE,
list.by.group = TRUE,
drop.list.single.group = TRUE)[[1]]
df_factor_loading_cfa <- cbind(l1, l2, l3)
colnames(df_factor_loading_cfa) <- c("SunBurst", "StarTree", "BeamTree")
rownames(df_factor_loading_cfa) <- c("enjoyable", "likable", "pleasing", "nice","appealing")
df_factor_loading_cfa %>% mutate_if(is.numeric, ~round(., 3))
#CFA factor numbers
APV.model ='aesthetic_pleasure =~ enjoyable + likable + pleasing + nice + appealing'
fit1 <- cfa(APV.model,data = data_sun,std.lv = TRUE)
l1 <- lavInspect(fit1, what = "std.all", add.labels = FALSE, add.class = TRUE,
list.by.group = TRUE,
drop.list.single.group = TRUE)[[1]]
fit2 <- cfa(APV.model,data = data_star,std.lv = TRUE)
l2 <- lavInspect(fit2, what = "std.all", add.labels = FALSE, add.class = TRUE,
list.by.group = TRUE,
drop.list.single.group = TRUE)[[1]]
fit3 <- cfa(APV.model,data = data_beam,std.lv = TRUE)
l3 <- lavInspect(fit3, what = "std.all", add.labels = FALSE, add.class = TRUE,
list.by.group = TRUE,
drop.list.single.group = TRUE)[[1]]
df_factor_loading_cfa <- cbind(l1, l2, l3)
colnames(df_factor_loading_cfa) <- c("SunBurst", "StarTree", "BeamTree")
rownames(df_factor_loading_cfa) <- c("enjoyable", "likable", "pleasing", "nice","appealing")
mutate(df_factor_loading_cfa, across(where(is.numeric), round, 3))
#CFA factor numbers
APV.model ='aesthetic_pleasure =~ enjoyable + likable + pleasing + nice + appealing'
fit1 <- cfa(APV.model,data = data_sun,std.lv = TRUE)
l1 <- lavInspect(fit1, what = "std.all", add.labels = FALSE, add.class = TRUE,
list.by.group = TRUE,
drop.list.single.group = TRUE)[[1]]
fit2 <- cfa(APV.model,data = data_star,std.lv = TRUE)
l2 <- lavInspect(fit2, what = "std.all", add.labels = FALSE, add.class = TRUE,
list.by.group = TRUE,
drop.list.single.group = TRUE)[[1]]
fit3 <- cfa(APV.model,data = data_beam,std.lv = TRUE)
l3 <- lavInspect(fit3, what = "std.all", add.labels = FALSE, add.class = TRUE,
list.by.group = TRUE,
drop.list.single.group = TRUE)[[1]]
df_factor_loading_cfa <- cbind(l1, l2, l3)
colnames(df_factor_loading_cfa) <- c("SunBurst", "StarTree", "BeamTree")
rownames(df_factor_loading_cfa) <- c("enjoyable", "likable", "pleasing", "nice","appealing")
df_factor_loading_cfa <- as.data.frame(df_factor_loading_cfa)
mutate(df_factor_loading_cfa, across(where(is.numeric), round, 3))
df_factor_loading_cfa
#write.table(df_factor_loading_cfa, paste("results/cfa_factor_loading.tsv",sep=""),row.names=TRUE,col.names=NA,sep='\t')
#CFA factor numbers
APV.model ='aesthetic_pleasure =~ enjoyable + likable + pleasing + nice + appealing'
fit1 <- cfa(APV.model,data = data_sun,std.lv = TRUE)
l1 <- lavInspect(fit1, what = "std.all", add.labels = FALSE, add.class = TRUE,
list.by.group = TRUE,
drop.list.single.group = TRUE)[[1]]
fit2 <- cfa(APV.model,data = data_star,std.lv = TRUE)
l2 <- lavInspect(fit2, what = "std.all", add.labels = FALSE, add.class = TRUE,
list.by.group = TRUE,
drop.list.single.group = TRUE)[[1]]
fit3 <- cfa(APV.model,data = data_beam,std.lv = TRUE)
l3 <- lavInspect(fit3, what = "std.all", add.labels = FALSE, add.class = TRUE,
list.by.group = TRUE,
drop.list.single.group = TRUE)[[1]]
df_factor_loading_cfa <- cbind(l1, l2, l3)
colnames(df_factor_loading_cfa) <- c("SunBurst", "StarTree", "BeamTree")
rownames(df_factor_loading_cfa) <- c("enjoyable", "likable", "pleasing", "nice","appealing")
df_factor_loading_cfa <- as.data.frame(df_factor_loading_cfa)
df_factor_loading_cfa <- mutate(df_factor_loading_cfa, across(where(is.numeric), round, 3))
df_factor_loading_cfa
#write.table(df_factor_loading_cfa, paste("results/cfa_factor_loading.tsv",sep=""),row.names=TRUE,col.names=NA,sep='\t')
good_fit_sun <- CFA(data_sun)
good_fit_star <- CFA(data_star)
good_fit_beam <- CFA(data_beam)
good_fit_table <- cbind(good_fit_sun, good_fit_star, good_fit_beam)
good_fit_table <- as.data.frame(good_fit_table)
good_fit_table <- mutate(good_fit_table, across(where(is.numeric), round, 3))
good_fit_table
write.table(good_fit_table, paste("results/cfa_good_fit.tsv",sep=""),row.names=TRUE,col.names=NA,sep='\t')
#CFA factor numbers
APV.model ='aesthetic_pleasure =~ enjoyable + likable + pleasing + nice + appealing'
fit1 <- cfa(APV.model,data = data_sun,std.lv = TRUE)
l1 <- lavInspect(fit1, what = "std.all", add.labels = FALSE, add.class = TRUE,
list.by.group = TRUE,
drop.list.single.group = TRUE)[[1]]
fit2 <- cfa(APV.model,data = data_star,std.lv = TRUE)
l2 <- lavInspect(fit2, what = "std.all", add.labels = FALSE, add.class = TRUE,
list.by.group = TRUE,
drop.list.single.group = TRUE)[[1]]
fit3 <- cfa(APV.model,data = data_beam,std.lv = TRUE)
l3 <- lavInspect(fit3, what = "std.all", add.labels = FALSE, add.class = TRUE,
list.by.group = TRUE,
drop.list.single.group = TRUE)[[1]]
df_factor_loading_cfa <- cbind(l1, l2, l3)
colnames(df_factor_loading_cfa) <- c("SunBurst", "StarTree", "BeamTree")
rownames(df_factor_loading_cfa) <- c("enjoyable", "likable", "pleasing", "nice","appealing")
df_factor_loading_cfa <- as.data.frame(df_factor_loading_cfa)
df_factor_loading_cfa <- mutate(df_factor_loading_cfa, across(where(is.numeric), round, 3))
df_factor_loading_cfa
write.table(df_factor_loading_cfa, paste("results/cfa_factor_loading.tsv",sep=""),row.names=TRUE,col.names=NA,sep='\t')
back to top