This is the Creature of Habit Cluster Analysis Using Graph Theory

#libraries needed
library(magrittr)
library(dplyr)
library(tidyr)
library(tidyverse)
library(factoextra)
library(ggpubr)
library(ggrepel)
library(fpc)
library(igraph)
library(network)
library(randomNames)
library(statnet)
library(mokken)
library(sirt)
library(psych)
library(cluster)
library(psych) ##factor analysis and other functions
library(tidytext) ##sentiment analysis package
library(cluster)
library(lavaan) ##latent variable analysis
library(semPlot) ## path diagrams and visual analysis of various SEM packages' output
library(kableExtra) ## construct complex table with 'kable' and pipe syntax
library(GGally) ## extension to GGPlot
library(stringr)
library(DiagrammeR)

Attaching package: ‘DiagrammeR’

The following object is masked from ‘package:igraph’:

    count_automorphisms
library(OpenMX) ## extended structural equation modeling
Error in library(OpenMX) : there is no package called ‘OpenMX’
creaturedataALL <- read.csv("~/Library/CloudStorage/OneDrive-ProcterandGamble/2024 Files/Habit Formation/Habit Strength Measurement/habit strength data/creature of habit/creature of habit.csv")
creaturedataALL <- na.omit(creaturedataALL)

creaturedemies <- creaturedataALL[1:7]
colnames(creaturedemies)
[1] "Response.ID"      "Gender"           "Age.Ranges"       "Household.Income" "Hispanic.Origin"  "Race"            
[7] "Region"          
library(dplyr)

creatclustRAW <- creaturedataALL[8:67] %>%
  dplyr::mutate_all(~ stringr::str_replace(., "^$", NA_character_)) %>%
  dplyr::mutate_all(
    .funs = ~ as.numeric (recode(
      .x = .,
      "Strongly Agree" = 7,
      "Somewhat Agree" = 6,
      "Agree" = 5,
      "Neither Agree Nor Disagree" = 4,
      "Disagree" = 3,
      "Somewhat Disagree" = 2,
      "Strongly Disagree" = 1,
           ))
  )

creathabitq <- colnames(creatcore)
library(igraph)

Attaching package: ‘igraph’

The following objects are masked from ‘package:dplyr’:

    as_data_frame, groups, union

The following objects are masked from ‘package:stats’:

    decompose, spectrum

The following object is masked from ‘package:base’:

    union
network <- graph_from_data_frame(creatclustRAW)
plot(network)

Number of Clusters in Network

clusters <- igraph::degree(network)
print(clusters)
  6   4   3   7   5   1   2 
166 159  61 132 172  47  63 

Cluster Definitions


cluster_def <- make_neighborhood_graph(network)
print(cluster_def)
[[1]]
IGRAPH d016e4f DN-- 7 400 -- 
+ attr: name (v/c), I.tend.to.go.to.bed.at.roughly.the.same.time.every.night. (e/n),
| I.cannot.stand.leaving.things.unfinished. (e/n), I.usually.exercise.at.the.same.time.of.day. (e/n),
| I.wake.up.at.roughly.the.same.time.every.day..even.without.the.help.of.an.alarm.clock. (e/n),
| I.tend.to.do.things.in.the.same.order.every.morning..e.g..get.up..go.to.the.toilet..have.a.coffee...
| (e/n),
| I.often.find.myself.running.on..autopilot...and.then.wonder.why.I.ended.up.in.a.particular.place.or.doing.something.that.I.did.not.intend.to.do.
| (e/n), I.always.try.to.get.the.same.seat.in.places.such.as.on.the.bus..in.the.cinema..or.in.church. (e/n),
| I.have.a.nightly.wind.down.routine.that.helps.me.to.fall.asleep.more.easily. (e/n),
| I.get.annoyed.by.people.who.open.a.new.packet.of.food.or.bottle.of.drink..e.g..milk..before.the.old.one.is.finished.
| (e/n), I.have.a.favorite.mug.for.my.tea.coffee. (e/n),
| I.rely.on.what.is.tried.and.tested.rather.than.exploring.something.new. (e/n),
| I.generally.keep.a.spare.set.of.things.such.as.batteries.that.I.can.fall.back.on..if.needed.. (e/n),
| Although.sometimes.tempted.to.go.for.special.offers..I.generally.buy.household.brands.that.I.can.trust..
| (e/n), I.tend.to.like.routine. (e/n), I.hate.it.when.the.grocery.store.rearranges.the.aisles. (e/n),
| If.I.could..I.would.probably.always.pick.the.same.outfit.to.wear.every.day.. (e/n),
| I.am.one.of.those.people.who.get.really.annoyed.by.last.minute.cancellations. (e/n),
| I.haven.t.bothered.to.change.my.hairstyle.for.several.years. (e/n), I.hate.being.late.for.anything. (e/n),
| I.generally.put.my.phone.on.charge.even.when.it.is.more.than.half.full. (e/n),
| I.regularly.tidy.up.my.workspace. (e/n),
| I.tend.to.stick.with.the.version.of.the.software.package.that.I.am.familiar.with.for.as.long.as.I.can.
| (e/n), I.quite.happily.work.within.my.comfort.zone.rather.than.challenging.myself..if.I.don.t.have.to..
| (e/n), If.I.can..I.like.to.give.exact.change.at.the.checkout.. (e/n), I.find.comfort.in.regularity. (e/n),
| I.always.tend.to.visit.the.same.websites.when.browsing.the.internet. (e/n),
| I.like.to.revisit.places.where.I.have.been.before. (e/n), I.am.prone.to.eating.more.when.I.feel.stressed.
| (e/n), I.have.a.preferred.sandwich.that.I.always.pick. (e/n),
| In.a.restaurant..I.tend.to.order.dishes.that.I.am.familiar.with. (e/n),
| I.tend.to.plan.meals.days.in.advance. (e/n),
| I.usually.eat.at.certain.times.of.the.day..even.when.I.am.on.holiday.. (e/n),
| I.like.to.finish.meals.either.with.something.sweet.or.something.savory. (e/n),
| I.always.lick.the.lid.of.a.yogurt. (e/n), I.typically.eat.the.best.part.of.the.meal.at.the.end. (e/n),
| I.often.find.myself.finishing.off.a.packet.of.biscuits.just.because.it.is.lying.there. (e/n),
| I.quickly.get.bored.of.preparing.the.same.dishes.over.and.over.again. (e/n),
| I.often.find.myself.opening.up.the.cabinet.to.take.a.snack. (e/n),
| When.walking.past.a.plate.of.sweets.or.biscuits..I.can.t.resist.taking.one.. (e/n),
| I.tend.to.cook.more.than.I.can.eat. (e/n), I.usually.sit.at.the.same.place.at.the.dinner.table. (e/n),
| I.usually.treat.myself.to.a.snack.at.the.end.of.the.workday. (e/n),
| I.generally.cook.with.the.same.spices.flavorings. (e/n),
| I.always.follow.a.certain.order.when.preparing.a.meal. (e/n),
| Whenever.I.go.into.the.kitchen..I.typically.look.in.the.fridge.. (e/n),
| I.like.to.eat.some.foods.in.a.certain.way..e.g..I.eat.the.pizza.crust.first.or.cut.up.all.the.meat.on.the.plate.in.one.go..
| (e/n), I.always.add.salt.before.tasting.food. (e/n),
| When.I.come.home..I.often.have.no.idea.what.to.have.for.dinner.. (e/n), I.only.eat.when.I.am.hungry.
| (e/n), I.always.need.something.to.drink.with.a.meal. (e/n),
| Eating.snacks.like.chips.straight.out.of.the.packet.is.typical.of.me. (e/n),
| It.feels.odd.not.having.both.a.knife.and.fork.for.eating.meals. (e/n),
| Television.makes.me.particularly.prone.to.uncontrolled.eating. (e/n),
| I.often.find.myself.eating.without.being.aware.of.it. (e/n),
| I.normally.buy.the.same.foods.from.the.same.grocery.store. (e/n),
| Finishing.everything.on.my.plate.is.typical.of.me. (e/n),
| I.often.take.a.snack.while.on.the.go..e.g..when.driving..walking.down.the.street..or.surfing.the.web...
| (e/n), Rout.v.Habit.Reactions.score (e/n)
+ edges from d016e4f (vertex names):

[[2]]
IGRAPH 6ca46d5 DN-- 7 400 -- 
+ attr: name (v/c), I.tend.to.go.to.bed.at.roughly.the.same.time.every.night. (e/n),
| I.cannot.stand.leaving.things.unfinished. (e/n), I.usually.exercise.at.the.same.time.of.day. (e/n),
| I.wake.up.at.roughly.the.same.time.every.day..even.without.the.help.of.an.alarm.clock. (e/n),
| I.tend.to.do.things.in.the.same.order.every.morning..e.g..get.up..go.to.the.toilet..have.a.coffee...
| (e/n),
| I.often.find.myself.running.on..autopilot...and.then.wonder.why.I.ended.up.in.a.particular.place.or.doing.something.that.I.did.not.intend.to.do.
| (e/n), I.always.try.to.get.the.same.seat.in.places.such.as.on.the.bus..in.the.cinema..or.in.church. (e/n),
| I.have.a.nightly.wind.down.routine.that.helps.me.to.fall.asleep.more.easily. (e/n),
| I.get.annoyed.by.people.who.open.a.new.packet.of.food.or.bottle.of.drink..e.g..milk..before.the.old.one.is.finished.
| (e/n), I.have.a.favorite.mug.for.my.tea.coffee. (e/n),
| I.rely.on.what.is.tried.and.tested.rather.than.exploring.something.new. (e/n),
| I.generally.keep.a.spare.set.of.things.such.as.batteries.that.I.can.fall.back.on..if.needed.. (e/n),
| Although.sometimes.tempted.to.go.for.special.offers..I.generally.buy.household.brands.that.I.can.trust..
| (e/n), I.tend.to.like.routine. (e/n), I.hate.it.when.the.grocery.store.rearranges.the.aisles. (e/n),
| If.I.could..I.would.probably.always.pick.the.same.outfit.to.wear.every.day.. (e/n),
| I.am.one.of.those.people.who.get.really.annoyed.by.last.minute.cancellations. (e/n),
| I.haven.t.bothered.to.change.my.hairstyle.for.several.years. (e/n), I.hate.being.late.for.anything. (e/n),
| I.generally.put.my.phone.on.charge.even.when.it.is.more.than.half.full. (e/n),
| I.regularly.tidy.up.my.workspace. (e/n),
| I.tend.to.stick.with.the.version.of.the.software.package.that.I.am.familiar.with.for.as.long.as.I.can.
| (e/n), I.quite.happily.work.within.my.comfort.zone.rather.than.challenging.myself..if.I.don.t.have.to..
| (e/n), If.I.can..I.like.to.give.exact.change.at.the.checkout.. (e/n), I.find.comfort.in.regularity. (e/n),
| I.always.tend.to.visit.the.same.websites.when.browsing.the.internet. (e/n),
| I.like.to.revisit.places.where.I.have.been.before. (e/n), I.am.prone.to.eating.more.when.I.feel.stressed.
| (e/n), I.have.a.preferred.sandwich.that.I.always.pick. (e/n),
| In.a.restaurant..I.tend.to.order.dishes.that.I.am.familiar.with. (e/n),
| I.tend.to.plan.meals.days.in.advance. (e/n),
| I.usually.eat.at.certain.times.of.the.day..even.when.I.am.on.holiday.. (e/n),
| I.like.to.finish.meals.either.with.something.sweet.or.something.savory. (e/n),
| I.always.lick.the.lid.of.a.yogurt. (e/n), I.typically.eat.the.best.part.of.the.meal.at.the.end. (e/n),
| I.often.find.myself.finishing.off.a.packet.of.biscuits.just.because.it.is.lying.there. (e/n),
| I.quickly.get.bored.of.preparing.the.same.dishes.over.and.over.again. (e/n),
| I.often.find.myself.opening.up.the.cabinet.to.take.a.snack. (e/n),
| When.walking.past.a.plate.of.sweets.or.biscuits..I.can.t.resist.taking.one.. (e/n),
| I.tend.to.cook.more.than.I.can.eat. (e/n), I.usually.sit.at.the.same.place.at.the.dinner.table. (e/n),
| I.usually.treat.myself.to.a.snack.at.the.end.of.the.workday. (e/n),
| I.generally.cook.with.the.same.spices.flavorings. (e/n),
| I.always.follow.a.certain.order.when.preparing.a.meal. (e/n),
| Whenever.I.go.into.the.kitchen..I.typically.look.in.the.fridge.. (e/n),
| I.like.to.eat.some.foods.in.a.certain.way..e.g..I.eat.the.pizza.crust.first.or.cut.up.all.the.meat.on.the.plate.in.one.go..
| (e/n), I.always.add.salt.before.tasting.food. (e/n),
| When.I.come.home..I.often.have.no.idea.what.to.have.for.dinner.. (e/n), I.only.eat.when.I.am.hungry.
| (e/n), I.always.need.something.to.drink.with.a.meal. (e/n),
| Eating.snacks.like.chips.straight.out.of.the.packet.is.typical.of.me. (e/n),
| It.feels.odd.not.having.both.a.knife.and.fork.for.eating.meals. (e/n),
| Television.makes.me.particularly.prone.to.uncontrolled.eating. (e/n),
| I.often.find.myself.eating.without.being.aware.of.it. (e/n),
| I.normally.buy.the.same.foods.from.the.same.grocery.store. (e/n),
| Finishing.everything.on.my.plate.is.typical.of.me. (e/n),
| I.often.take.a.snack.while.on.the.go..e.g..when.driving..walking.down.the.street..or.surfing.the.web...
| (e/n), Rout.v.Habit.Reactions.score (e/n)
+ edges from 6ca46d5 (vertex names):

[[3]]
IGRAPH 1af87bd DN-- 7 400 -- 
+ attr: name (v/c), I.tend.to.go.to.bed.at.roughly.the.same.time.every.night. (e/n),
| I.cannot.stand.leaving.things.unfinished. (e/n), I.usually.exercise.at.the.same.time.of.day. (e/n),
| I.wake.up.at.roughly.the.same.time.every.day..even.without.the.help.of.an.alarm.clock. (e/n),
| I.tend.to.do.things.in.the.same.order.every.morning..e.g..get.up..go.to.the.toilet..have.a.coffee...
| (e/n),
| I.often.find.myself.running.on..autopilot...and.then.wonder.why.I.ended.up.in.a.particular.place.or.doing.something.that.I.did.not.intend.to.do.
| (e/n), I.always.try.to.get.the.same.seat.in.places.such.as.on.the.bus..in.the.cinema..or.in.church. (e/n),
| I.have.a.nightly.wind.down.routine.that.helps.me.to.fall.asleep.more.easily. (e/n),
| I.get.annoyed.by.people.who.open.a.new.packet.of.food.or.bottle.of.drink..e.g..milk..before.the.old.one.is.finished.
| (e/n), I.have.a.favorite.mug.for.my.tea.coffee. (e/n),
| I.rely.on.what.is.tried.and.tested.rather.than.exploring.something.new. (e/n),
| I.generally.keep.a.spare.set.of.things.such.as.batteries.that.I.can.fall.back.on..if.needed.. (e/n),
| Although.sometimes.tempted.to.go.for.special.offers..I.generally.buy.household.brands.that.I.can.trust..
| (e/n), I.tend.to.like.routine. (e/n), I.hate.it.when.the.grocery.store.rearranges.the.aisles. (e/n),
| If.I.could..I.would.probably.always.pick.the.same.outfit.to.wear.every.day.. (e/n),
| I.am.one.of.those.people.who.get.really.annoyed.by.last.minute.cancellations. (e/n),
| I.haven.t.bothered.to.change.my.hairstyle.for.several.years. (e/n), I.hate.being.late.for.anything. (e/n),
| I.generally.put.my.phone.on.charge.even.when.it.is.more.than.half.full. (e/n),
| I.regularly.tidy.up.my.workspace. (e/n),
| I.tend.to.stick.with.the.version.of.the.software.package.that.I.am.familiar.with.for.as.long.as.I.can.
| (e/n), I.quite.happily.work.within.my.comfort.zone.rather.than.challenging.myself..if.I.don.t.have.to..
| (e/n), If.I.can..I.like.to.give.exact.change.at.the.checkout.. (e/n), I.find.comfort.in.regularity. (e/n),
| I.always.tend.to.visit.the.same.websites.when.browsing.the.internet. (e/n),
| I.like.to.revisit.places.where.I.have.been.before. (e/n), I.am.prone.to.eating.more.when.I.feel.stressed.
| (e/n), I.have.a.preferred.sandwich.that.I.always.pick. (e/n),
| In.a.restaurant..I.tend.to.order.dishes.that.I.am.familiar.with. (e/n),
| I.tend.to.plan.meals.days.in.advance. (e/n),
| I.usually.eat.at.certain.times.of.the.day..even.when.I.am.on.holiday.. (e/n),
| I.like.to.finish.meals.either.with.something.sweet.or.something.savory. (e/n),
| I.always.lick.the.lid.of.a.yogurt. (e/n), I.typically.eat.the.best.part.of.the.meal.at.the.end. (e/n),
| I.often.find.myself.finishing.off.a.packet.of.biscuits.just.because.it.is.lying.there. (e/n),
| I.quickly.get.bored.of.preparing.the.same.dishes.over.and.over.again. (e/n),
| I.often.find.myself.opening.up.the.cabinet.to.take.a.snack. (e/n),
| When.walking.past.a.plate.of.sweets.or.biscuits..I.can.t.resist.taking.one.. (e/n),
| I.tend.to.cook.more.than.I.can.eat. (e/n), I.usually.sit.at.the.same.place.at.the.dinner.table. (e/n),
| I.usually.treat.myself.to.a.snack.at.the.end.of.the.workday. (e/n),
| I.generally.cook.with.the.same.spices.flavorings. (e/n),
| I.always.follow.a.certain.order.when.preparing.a.meal. (e/n),
| Whenever.I.go.into.the.kitchen..I.typically.look.in.the.fridge.. (e/n),
| I.like.to.eat.some.foods.in.a.certain.way..e.g..I.eat.the.pizza.crust.first.or.cut.up.all.the.meat.on.the.plate.in.one.go..
| (e/n), I.always.add.salt.before.tasting.food. (e/n),
| When.I.come.home..I.often.have.no.idea.what.to.have.for.dinner.. (e/n), I.only.eat.when.I.am.hungry.
| (e/n), I.always.need.something.to.drink.with.a.meal. (e/n),
| Eating.snacks.like.chips.straight.out.of.the.packet.is.typical.of.me. (e/n),
| It.feels.odd.not.having.both.a.knife.and.fork.for.eating.meals. (e/n),
| Television.makes.me.particularly.prone.to.uncontrolled.eating. (e/n),
| I.often.find.myself.eating.without.being.aware.of.it. (e/n),
| I.normally.buy.the.same.foods.from.the.same.grocery.store. (e/n),
| Finishing.everything.on.my.plate.is.typical.of.me. (e/n),
| I.often.take.a.snack.while.on.the.go..e.g..when.driving..walking.down.the.street..or.surfing.the.web...
| (e/n), Rout.v.Habit.Reactions.score (e/n)
+ edges from 1af87bd (vertex names):

[[4]]
IGRAPH 0f99627 DN-- 7 400 -- 
+ attr: name (v/c), I.tend.to.go.to.bed.at.roughly.the.same.time.every.night. (e/n),
| I.cannot.stand.leaving.things.unfinished. (e/n), I.usually.exercise.at.the.same.time.of.day. (e/n),
| I.wake.up.at.roughly.the.same.time.every.day..even.without.the.help.of.an.alarm.clock. (e/n),
| I.tend.to.do.things.in.the.same.order.every.morning..e.g..get.up..go.to.the.toilet..have.a.coffee...
| (e/n),
| I.often.find.myself.running.on..autopilot...and.then.wonder.why.I.ended.up.in.a.particular.place.or.doing.something.that.I.did.not.intend.to.do.
| (e/n), I.always.try.to.get.the.same.seat.in.places.such.as.on.the.bus..in.the.cinema..or.in.church. (e/n),
| I.have.a.nightly.wind.down.routine.that.helps.me.to.fall.asleep.more.easily. (e/n),
| I.get.annoyed.by.people.who.open.a.new.packet.of.food.or.bottle.of.drink..e.g..milk..before.the.old.one.is.finished.
| (e/n), I.have.a.favorite.mug.for.my.tea.coffee. (e/n),
| I.rely.on.what.is.tried.and.tested.rather.than.exploring.something.new. (e/n),
| I.generally.keep.a.spare.set.of.things.such.as.batteries.that.I.can.fall.back.on..if.needed.. (e/n),
| Although.sometimes.tempted.to.go.for.special.offers..I.generally.buy.household.brands.that.I.can.trust..
| (e/n), I.tend.to.like.routine. (e/n), I.hate.it.when.the.grocery.store.rearranges.the.aisles. (e/n),
| If.I.could..I.would.probably.always.pick.the.same.outfit.to.wear.every.day.. (e/n),
| I.am.one.of.those.people.who.get.really.annoyed.by.last.minute.cancellations. (e/n),
| I.haven.t.bothered.to.change.my.hairstyle.for.several.years. (e/n), I.hate.being.late.for.anything. (e/n),
| I.generally.put.my.phone.on.charge.even.when.it.is.more.than.half.full. (e/n),
| I.regularly.tidy.up.my.workspace. (e/n),
| I.tend.to.stick.with.the.version.of.the.software.package.that.I.am.familiar.with.for.as.long.as.I.can.
| (e/n), I.quite.happily.work.within.my.comfort.zone.rather.than.challenging.myself..if.I.don.t.have.to..
| (e/n), If.I.can..I.like.to.give.exact.change.at.the.checkout.. (e/n), I.find.comfort.in.regularity. (e/n),
| I.always.tend.to.visit.the.same.websites.when.browsing.the.internet. (e/n),
| I.like.to.revisit.places.where.I.have.been.before. (e/n), I.am.prone.to.eating.more.when.I.feel.stressed.
| (e/n), I.have.a.preferred.sandwich.that.I.always.pick. (e/n),
| In.a.restaurant..I.tend.to.order.dishes.that.I.am.familiar.with. (e/n),
| I.tend.to.plan.meals.days.in.advance. (e/n),
| I.usually.eat.at.certain.times.of.the.day..even.when.I.am.on.holiday.. (e/n),
| I.like.to.finish.meals.either.with.something.sweet.or.something.savory. (e/n),
| I.always.lick.the.lid.of.a.yogurt. (e/n), I.typically.eat.the.best.part.of.the.meal.at.the.end. (e/n),
| I.often.find.myself.finishing.off.a.packet.of.biscuits.just.because.it.is.lying.there. (e/n),
| I.quickly.get.bored.of.preparing.the.same.dishes.over.and.over.again. (e/n),
| I.often.find.myself.opening.up.the.cabinet.to.take.a.snack. (e/n),
| When.walking.past.a.plate.of.sweets.or.biscuits..I.can.t.resist.taking.one.. (e/n),
| I.tend.to.cook.more.than.I.can.eat. (e/n), I.usually.sit.at.the.same.place.at.the.dinner.table. (e/n),
| I.usually.treat.myself.to.a.snack.at.the.end.of.the.workday. (e/n),
| I.generally.cook.with.the.same.spices.flavorings. (e/n),
| I.always.follow.a.certain.order.when.preparing.a.meal. (e/n),
| Whenever.I.go.into.the.kitchen..I.typically.look.in.the.fridge.. (e/n),
| I.like.to.eat.some.foods.in.a.certain.way..e.g..I.eat.the.pizza.crust.first.or.cut.up.all.the.meat.on.the.plate.in.one.go..
| (e/n), I.always.add.salt.before.tasting.food. (e/n),
| When.I.come.home..I.often.have.no.idea.what.to.have.for.dinner.. (e/n), I.only.eat.when.I.am.hungry.
| (e/n), I.always.need.something.to.drink.with.a.meal. (e/n),
| Eating.snacks.like.chips.straight.out.of.the.packet.is.typical.of.me. (e/n),
| It.feels.odd.not.having.both.a.knife.and.fork.for.eating.meals. (e/n),
| Television.makes.me.particularly.prone.to.uncontrolled.eating. (e/n),
| I.often.find.myself.eating.without.being.aware.of.it. (e/n),
| I.normally.buy.the.same.foods.from.the.same.grocery.store. (e/n),
| Finishing.everything.on.my.plate.is.typical.of.me. (e/n),
| I.often.take.a.snack.while.on.the.go..e.g..when.driving..walking.down.the.street..or.surfing.the.web...
| (e/n), Rout.v.Habit.Reactions.score (e/n)
+ edges from 0f99627 (vertex names):

[[5]]
IGRAPH 4e9a602 DN-- 7 400 -- 
+ attr: name (v/c), I.tend.to.go.to.bed.at.roughly.the.same.time.every.night. (e/n),
| I.cannot.stand.leaving.things.unfinished. (e/n), I.usually.exercise.at.the.same.time.of.day. (e/n),
| I.wake.up.at.roughly.the.same.time.every.day..even.without.the.help.of.an.alarm.clock. (e/n),
| I.tend.to.do.things.in.the.same.order.every.morning..e.g..get.up..go.to.the.toilet..have.a.coffee...
| (e/n),
| I.often.find.myself.running.on..autopilot...and.then.wonder.why.I.ended.up.in.a.particular.place.or.doing.something.that.I.did.not.intend.to.do.
| (e/n), I.always.try.to.get.the.same.seat.in.places.such.as.on.the.bus..in.the.cinema..or.in.church. (e/n),
| I.have.a.nightly.wind.down.routine.that.helps.me.to.fall.asleep.more.easily. (e/n),
| I.get.annoyed.by.people.who.open.a.new.packet.of.food.or.bottle.of.drink..e.g..milk..before.the.old.one.is.finished.
| (e/n), I.have.a.favorite.mug.for.my.tea.coffee. (e/n),
| I.rely.on.what.is.tried.and.tested.rather.than.exploring.something.new. (e/n),
| I.generally.keep.a.spare.set.of.things.such.as.batteries.that.I.can.fall.back.on..if.needed.. (e/n),
| Although.sometimes.tempted.to.go.for.special.offers..I.generally.buy.household.brands.that.I.can.trust..
| (e/n), I.tend.to.like.routine. (e/n), I.hate.it.when.the.grocery.store.rearranges.the.aisles. (e/n),
| If.I.could..I.would.probably.always.pick.the.same.outfit.to.wear.every.day.. (e/n),
| I.am.one.of.those.people.who.get.really.annoyed.by.last.minute.cancellations. (e/n),
| I.haven.t.bothered.to.change.my.hairstyle.for.several.years. (e/n), I.hate.being.late.for.anything. (e/n),
| I.generally.put.my.phone.on.charge.even.when.it.is.more.than.half.full. (e/n),
| I.regularly.tidy.up.my.workspace. (e/n),
| I.tend.to.stick.with.the.version.of.the.software.package.that.I.am.familiar.with.for.as.long.as.I.can.
| (e/n), I.quite.happily.work.within.my.comfort.zone.rather.than.challenging.myself..if.I.don.t.have.to..
| (e/n), If.I.can..I.like.to.give.exact.change.at.the.checkout.. (e/n), I.find.comfort.in.regularity. (e/n),
| I.always.tend.to.visit.the.same.websites.when.browsing.the.internet. (e/n),
| I.like.to.revisit.places.where.I.have.been.before. (e/n), I.am.prone.to.eating.more.when.I.feel.stressed.
| (e/n), I.have.a.preferred.sandwich.that.I.always.pick. (e/n),
| In.a.restaurant..I.tend.to.order.dishes.that.I.am.familiar.with. (e/n),
| I.tend.to.plan.meals.days.in.advance. (e/n),
| I.usually.eat.at.certain.times.of.the.day..even.when.I.am.on.holiday.. (e/n),
| I.like.to.finish.meals.either.with.something.sweet.or.something.savory. (e/n),
| I.always.lick.the.lid.of.a.yogurt. (e/n), I.typically.eat.the.best.part.of.the.meal.at.the.end. (e/n),
| I.often.find.myself.finishing.off.a.packet.of.biscuits.just.because.it.is.lying.there. (e/n),
| I.quickly.get.bored.of.preparing.the.same.dishes.over.and.over.again. (e/n),
| I.often.find.myself.opening.up.the.cabinet.to.take.a.snack. (e/n),
| When.walking.past.a.plate.of.sweets.or.biscuits..I.can.t.resist.taking.one.. (e/n),
| I.tend.to.cook.more.than.I.can.eat. (e/n), I.usually.sit.at.the.same.place.at.the.dinner.table. (e/n),
| I.usually.treat.myself.to.a.snack.at.the.end.of.the.workday. (e/n),
| I.generally.cook.with.the.same.spices.flavorings. (e/n),
| I.always.follow.a.certain.order.when.preparing.a.meal. (e/n),
| Whenever.I.go.into.the.kitchen..I.typically.look.in.the.fridge.. (e/n),
| I.like.to.eat.some.foods.in.a.certain.way..e.g..I.eat.the.pizza.crust.first.or.cut.up.all.the.meat.on.the.plate.in.one.go..
| (e/n), I.always.add.salt.before.tasting.food. (e/n),
| When.I.come.home..I.often.have.no.idea.what.to.have.for.dinner.. (e/n), I.only.eat.when.I.am.hungry.
| (e/n), I.always.need.something.to.drink.with.a.meal. (e/n),
| Eating.snacks.like.chips.straight.out.of.the.packet.is.typical.of.me. (e/n),
| It.feels.odd.not.having.both.a.knife.and.fork.for.eating.meals. (e/n),
| Television.makes.me.particularly.prone.to.uncontrolled.eating. (e/n),
| I.often.find.myself.eating.without.being.aware.of.it. (e/n),
| I.normally.buy.the.same.foods.from.the.same.grocery.store. (e/n),
| Finishing.everything.on.my.plate.is.typical.of.me. (e/n),
| I.often.take.a.snack.while.on.the.go..e.g..when.driving..walking.down.the.street..or.surfing.the.web...
| (e/n), Rout.v.Habit.Reactions.score (e/n)
+ edges from 4e9a602 (vertex names):

[[6]]
IGRAPH 7c52380 DN-- 7 400 -- 
+ attr: name (v/c), I.tend.to.go.to.bed.at.roughly.the.same.time.every.night. (e/n),
| I.cannot.stand.leaving.things.unfinished. (e/n), I.usually.exercise.at.the.same.time.of.day. (e/n),
| I.wake.up.at.roughly.the.same.time.every.day..even.without.the.help.of.an.alarm.clock. (e/n),
| I.tend.to.do.things.in.the.same.order.every.morning..e.g..get.up..go.to.the.toilet..have.a.coffee...
| (e/n),
| I.often.find.myself.running.on..autopilot...and.then.wonder.why.I.ended.up.in.a.particular.place.or.doing.something.that.I.did.not.intend.to.do.
| (e/n), I.always.try.to.get.the.same.seat.in.places.such.as.on.the.bus..in.the.cinema..or.in.church. (e/n),
| I.have.a.nightly.wind.down.routine.that.helps.me.to.fall.asleep.more.easily. (e/n),
| I.get.annoyed.by.people.who.open.a.new.packet.of.food.or.bottle.of.drink..e.g..milk..before.the.old.one.is.finished.
| (e/n), I.have.a.favorite.mug.for.my.tea.coffee. (e/n),
| I.rely.on.what.is.tried.and.tested.rather.than.exploring.something.new. (e/n),
| I.generally.keep.a.spare.set.of.things.such.as.batteries.that.I.can.fall.back.on..if.needed.. (e/n),
| Although.sometimes.tempted.to.go.for.special.offers..I.generally.buy.household.brands.that.I.can.trust..
| (e/n), I.tend.to.like.routine. (e/n), I.hate.it.when.the.grocery.store.rearranges.the.aisles. (e/n),
| If.I.could..I.would.probably.always.pick.the.same.outfit.to.wear.every.day.. (e/n),
| I.am.one.of.those.people.who.get.really.annoyed.by.last.minute.cancellations. (e/n),
| I.haven.t.bothered.to.change.my.hairstyle.for.several.years. (e/n), I.hate.being.late.for.anything. (e/n),
| I.generally.put.my.phone.on.charge.even.when.it.is.more.than.half.full. (e/n),
| I.regularly.tidy.up.my.workspace. (e/n),
| I.tend.to.stick.with.the.version.of.the.software.package.that.I.am.familiar.with.for.as.long.as.I.can.
| (e/n), I.quite.happily.work.within.my.comfort.zone.rather.than.challenging.myself..if.I.don.t.have.to..
| (e/n), If.I.can..I.like.to.give.exact.change.at.the.checkout.. (e/n), I.find.comfort.in.regularity. (e/n),
| I.always.tend.to.visit.the.same.websites.when.browsing.the.internet. (e/n),
| I.like.to.revisit.places.where.I.have.been.before. (e/n), I.am.prone.to.eating.more.when.I.feel.stressed.
| (e/n), I.have.a.preferred.sandwich.that.I.always.pick. (e/n),
| In.a.restaurant..I.tend.to.order.dishes.that.I.am.familiar.with. (e/n),
| I.tend.to.plan.meals.days.in.advance. (e/n),
| I.usually.eat.at.certain.times.of.the.day..even.when.I.am.on.holiday.. (e/n),
| I.like.to.finish.meals.either.with.something.sweet.or.something.savory. (e/n),
| I.always.lick.the.lid.of.a.yogurt. (e/n), I.typically.eat.the.best.part.of.the.meal.at.the.end. (e/n),
| I.often.find.myself.finishing.off.a.packet.of.biscuits.just.because.it.is.lying.there. (e/n),
| I.quickly.get.bored.of.preparing.the.same.dishes.over.and.over.again. (e/n),
| I.often.find.myself.opening.up.the.cabinet.to.take.a.snack. (e/n),
| When.walking.past.a.plate.of.sweets.or.biscuits..I.can.t.resist.taking.one.. (e/n),
| I.tend.to.cook.more.than.I.can.eat. (e/n), I.usually.sit.at.the.same.place.at.the.dinner.table. (e/n),
| I.usually.treat.myself.to.a.snack.at.the.end.of.the.workday. (e/n),
| I.generally.cook.with.the.same.spices.flavorings. (e/n),
| I.always.follow.a.certain.order.when.preparing.a.meal. (e/n),
| Whenever.I.go.into.the.kitchen..I.typically.look.in.the.fridge.. (e/n),
| I.like.to.eat.some.foods.in.a.certain.way..e.g..I.eat.the.pizza.crust.first.or.cut.up.all.the.meat.on.the.plate.in.one.go..
| (e/n), I.always.add.salt.before.tasting.food. (e/n),
| When.I.come.home..I.often.have.no.idea.what.to.have.for.dinner.. (e/n), I.only.eat.when.I.am.hungry.
| (e/n), I.always.need.something.to.drink.with.a.meal. (e/n),
| Eating.snacks.like.chips.straight.out.of.the.packet.is.typical.of.me. (e/n),
| It.feels.odd.not.having.both.a.knife.and.fork.for.eating.meals. (e/n),
| Television.makes.me.particularly.prone.to.uncontrolled.eating. (e/n),
| I.often.find.myself.eating.without.being.aware.of.it. (e/n),
| I.normally.buy.the.same.foods.from.the.same.grocery.store. (e/n),
| Finishing.everything.on.my.plate.is.typical.of.me. (e/n),
| I.often.take.a.snack.while.on.the.go..e.g..when.driving..walking.down.the.street..or.surfing.the.web...
| (e/n), Rout.v.Habit.Reactions.score (e/n)
+ edges from 7c52380 (vertex names):

[[7]]
IGRAPH 30cf8fe DN-- 7 400 -- 
+ attr: name (v/c), I.tend.to.go.to.bed.at.roughly.the.same.time.every.night. (e/n),
| I.cannot.stand.leaving.things.unfinished. (e/n), I.usually.exercise.at.the.same.time.of.day. (e/n),
| I.wake.up.at.roughly.the.same.time.every.day..even.without.the.help.of.an.alarm.clock. (e/n),
| I.tend.to.do.things.in.the.same.order.every.morning..e.g..get.up..go.to.the.toilet..have.a.coffee...
| (e/n),
| I.often.find.myself.running.on..autopilot...and.then.wonder.why.I.ended.up.in.a.particular.place.or.doing.something.that.I.did.not.intend.to.do.
| (e/n), I.always.try.to.get.the.same.seat.in.places.such.as.on.the.bus..in.the.cinema..or.in.church. (e/n),
| I.have.a.nightly.wind.down.routine.that.helps.me.to.fall.asleep.more.easily. (e/n),
| I.get.annoyed.by.people.who.open.a.new.packet.of.food.or.bottle.of.drink..e.g..milk..before.the.old.one.is.finished.
| (e/n), I.have.a.favorite.mug.for.my.tea.coffee. (e/n),
| I.rely.on.what.is.tried.and.tested.rather.than.exploring.something.new. (e/n),
| I.generally.keep.a.spare.set.of.things.such.as.batteries.that.I.can.fall.back.on..if.needed.. (e/n),
| Although.sometimes.tempted.to.go.for.special.offers..I.generally.buy.household.brands.that.I.can.trust..
| (e/n), I.tend.to.like.routine. (e/n), I.hate.it.when.the.grocery.store.rearranges.the.aisles. (e/n),
| If.I.could..I.would.probably.always.pick.the.same.outfit.to.wear.every.day.. (e/n),
| I.am.one.of.those.people.who.get.really.annoyed.by.last.minute.cancellations. (e/n),
| I.haven.t.bothered.to.change.my.hairstyle.for.several.years. (e/n), I.hate.being.late.for.anything. (e/n),
| I.generally.put.my.phone.on.charge.even.when.it.is.more.than.half.full. (e/n),
| I.regularly.tidy.up.my.workspace. (e/n),
| I.tend.to.stick.with.the.version.of.the.software.package.that.I.am.familiar.with.for.as.long.as.I.can.
| (e/n), I.quite.happily.work.within.my.comfort.zone.rather.than.challenging.myself..if.I.don.t.have.to..
| (e/n), If.I.can..I.like.to.give.exact.change.at.the.checkout.. (e/n), I.find.comfort.in.regularity. (e/n),
| I.always.tend.to.visit.the.same.websites.when.browsing.the.internet. (e/n),
| I.like.to.revisit.places.where.I.have.been.before. (e/n), I.am.prone.to.eating.more.when.I.feel.stressed.
| (e/n), I.have.a.preferred.sandwich.that.I.always.pick. (e/n),
| In.a.restaurant..I.tend.to.order.dishes.that.I.am.familiar.with. (e/n),
| I.tend.to.plan.meals.days.in.advance. (e/n),
| I.usually.eat.at.certain.times.of.the.day..even.when.I.am.on.holiday.. (e/n),
| I.like.to.finish.meals.either.with.something.sweet.or.something.savory. (e/n),
| I.always.lick.the.lid.of.a.yogurt. (e/n), I.typically.eat.the.best.part.of.the.meal.at.the.end. (e/n),
| I.often.find.myself.finishing.off.a.packet.of.biscuits.just.because.it.is.lying.there. (e/n),
| I.quickly.get.bored.of.preparing.the.same.dishes.over.and.over.again. (e/n),
| I.often.find.myself.opening.up.the.cabinet.to.take.a.snack. (e/n),
| When.walking.past.a.plate.of.sweets.or.biscuits..I.can.t.resist.taking.one.. (e/n),
| I.tend.to.cook.more.than.I.can.eat. (e/n), I.usually.sit.at.the.same.place.at.the.dinner.table. (e/n),
| I.usually.treat.myself.to.a.snack.at.the.end.of.the.workday. (e/n),
| I.generally.cook.with.the.same.spices.flavorings. (e/n),
| I.always.follow.a.certain.order.when.preparing.a.meal. (e/n),
| Whenever.I.go.into.the.kitchen..I.typically.look.in.the.fridge.. (e/n),
| I.like.to.eat.some.foods.in.a.certain.way..e.g..I.eat.the.pizza.crust.first.or.cut.up.all.the.meat.on.the.plate.in.one.go..
| (e/n), I.always.add.salt.before.tasting.food. (e/n),
| When.I.come.home..I.often.have.no.idea.what.to.have.for.dinner.. (e/n), I.only.eat.when.I.am.hungry.
| (e/n), I.always.need.something.to.drink.with.a.meal. (e/n),
| Eating.snacks.like.chips.straight.out.of.the.packet.is.typical.of.me. (e/n),
| It.feels.odd.not.having.both.a.knife.and.fork.for.eating.meals. (e/n),
| Television.makes.me.particularly.prone.to.uncontrolled.eating. (e/n),
| I.often.find.myself.eating.without.being.aware.of.it. (e/n),
| I.normally.buy.the.same.foods.from.the.same.grocery.store. (e/n),
| Finishing.everything.on.my.plate.is.typical.of.me. (e/n),
| I.often.take.a.snack.while.on.the.go..e.g..when.driving..walking.down.the.street..or.surfing.the.web...
| (e/n), Rout.v.Habit.Reactions.score (e/n)
+ edges from 30cf8fe (vertex names):

Adjacency Matrix

adjacency <- as_adjacency_matrix(network,
    type = c("both", "upper", "lower"),
    attr = NULL,
    edges = FALSE,
    names = TRUE,
    sparse = igraph_opt("sparsematrices"))
print(adjacency)
7 x 7 sparse Matrix of class "dgCMatrix"
   6  4  3  7  5 1  2
6 23 14  9  4 18 4  9
4 26 24 10  3  9 7  9
3  2  5  4  .  2 3  2
7 10  9  3 31 13 6 10
5 22 13 15 11 27 5  8
1  .  3  1  1  . 6  2
2  2  3  1  .  2 3  6

Factor Analysis–7 factor solution

library(psych)

colnames(creatclustRAW) <- c("COHS1","COHS2", "COHS3", "COHS4", "COHS5", "COHS6", "COHS7", "COHS8", "COHS9", "COHS10", "COHS11", "COHS-2", "COHS13", "COHS14", "COHS15", "COHS16", "COHS17", "COHS18", "COHS19", "COHS20", "COHS21", "COHS22", "COHS23", "COHS24", "COHS25", "COHS26", "COHS27", "COHS28", "COHS29", "COHSF1", "COHSF2", "COHSF3", "COHSF4", "COHSF5", "COHSF6", "COHSF7", "COHSF8", "COHSF9", "COHSF10", "COHSF11", "COHSF12", "COHSF13", "COHSF14", "COHSF15", "COHSF16", "COHSF17", "COHSF18", "COHSF19", "COHSF20", "COHSF21", "COHSF22", "COHSF23", "COHSF24", "COHSF25", "COHSF26", "COHSF27", "COHSF28", "COHSF29", "COHSF30")

creatclustRAW_Scaled <- scale(creatclustRAW)
fa <- fa(r = creatclustRAW_Scaled, nfactors = 7, rotate ="Varimax")
Loading required namespace: GPArotation
summary(fa)

Factor analysis with Call: fa(r = creatclustRAW_Scaled, nfactors = 7, rotate = "Varimax")

Test of the hypothesis that 7 factors are sufficient.
The degrees of freedom for the model is 1319  and the objective function was  5.03 
The number of observations was  400  with Chi Square =  1878.89  with prob <  2.1e-22 

The root mean square of the residuals (RMSA) is  0.04 
The df corrected root mean square of the residuals is  0.04 

Tucker Lewis Index of factoring reliability =  0.858
RMSEA index =  0.032  and the 10 % confidence intervals are  0.029 0.036
BIC =  -6023.86
fa$loadings

Loadings:
        MR2    MR1    MR3    MR6    MR4    MR5    MR7   
COHS1           0.249  0.420                            
COHS2           0.193  0.380 -0.114  0.171              
COHS3                  0.636         0.163              
COHS4    0.119  0.192  0.294  0.274         0.233       
COHS5                  0.427                       0.229
COHS6                  0.633                            
COHS7           0.197  0.578  0.175                     
COHS8    0.397         0.244         0.261              
COHS9    0.245  0.104  0.245         0.345  0.127  0.100
COHS10   0.168         0.395                0.236       
COHS11   0.152  0.161  0.311  0.301  0.205              
COHS-2          0.227  0.336  0.109  0.176  0.261       
COHS13   0.101  0.349  0.231         0.396              
COHS14          0.118  0.336  0.319         0.152       
COHS15          0.309  0.228  0.280  0.129  0.205       
COHS16          0.290  0.399  0.245  0.135              
COHS17          0.412  0.237  0.134  0.167        -0.262
COHS18   0.232               -0.102  0.513  0.147       
COHS19   0.184  0.250  0.133  0.222  0.232              
COHS20          0.197         0.173  0.511              
COHS21          0.122  0.162  0.505                0.118
COHS22   0.165  0.125  0.123  0.221  0.191  0.138       
COHS23                 0.352  0.310 -0.112  0.292       
COHS24          0.345  0.213  0.111  0.244  0.124 -0.190
COHS25          0.445                0.388              
COHS26   0.120  0.236         0.123  0.290  0.255       
COHS27          0.410  0.201  0.354  0.139        -0.136
COHS28   0.123  0.392  0.153  0.157  0.254              
COHS29          0.388  0.108  0.259  0.130  0.164  0.160
COHSF1   0.517  0.116                      -0.299       
COHSF2   0.287  0.384  0.134                0.119       
COHSF3   0.109  0.651                                   
COHSF4   0.203  0.114  0.187         0.117  0.419       
COHSF5   0.132  0.280  0.263         0.162  0.265  0.117
COHSF6   0.227  0.297         0.159         0.202  0.144
COHSF7   0.293                0.101                0.344
COHSF8   0.338                       0.133         0.400
COHSF9   0.495                0.110  0.193  0.126  0.220
COHSF10  0.392                0.254               -0.118
COHSF11  0.549  0.204         0.232        -0.135       
COHSF12  0.578  0.346         0.122                     
COHSF13  0.542                              0.141 -0.110
COHSF14  0.122  0.204  0.424  0.140                     
COHSF15  0.420  0.304  0.103  0.133         0.154  0.128
COHSF16  0.196  0.590  0.148                       0.181
COHSF17  0.222  0.341  0.282                0.209  0.183
COHSF18  0.558  0.387         0.103                0.145
COHSF19  0.339  0.254                              0.267
COHSF20  0.448               -0.143         0.354       
COHSF21  0.399  0.129                      -0.130       
COHSF22 -0.157  0.133                       0.489       
COHSF23         0.187         0.368 -0.103              
COHSF24  0.338  0.242         0.287                     
COHSF25  0.279                              0.317 -0.124
COHSF26  0.642               -0.117  0.100              
COHSF27  0.667               -0.172  0.118              
COHSF28  0.193  0.484  0.184                            
COHSF29         0.273         0.218                0.277
COHSF30  0.526  0.109  0.139                0.145  0.139

                 MR2   MR1   MR3   MR6   MR4   MR5   MR7
SS loadings    4.966 3.975 3.498 1.844 1.816 1.586 1.012
Proportion Var 0.084 0.067 0.059 0.031 0.031 0.027 0.017
Cumulative Var 0.084 0.152 0.211 0.242 0.273 0.300 0.317

Different Rotation


fa2 <- fa(r=creatclustRAW_Scaled, nfactors=7, rotate="oblimin")
print(fa2)
Factor Analysis using method =  minres
Call: fa(r = creatclustRAW_Scaled, nfactors = 7, rotate = "oblimin")
Standardized loadings (pattern matrix) based upon correlation matrix

                       MR1  MR2  MR3  MR4  MR6  MR7  MR5
SS loadings           3.79 3.45 3.34 2.39 2.37 1.78 1.57
Proportion Var        0.06 0.06 0.06 0.04 0.04 0.03 0.03
Cumulative Var        0.06 0.12 0.18 0.22 0.26 0.29 0.32
Proportion Explained  0.20 0.18 0.18 0.13 0.13 0.10 0.08
Cumulative Proportion 0.20 0.39 0.57 0.69 0.82 0.92 1.00

 With factor correlations of 
     MR1   MR2  MR3  MR4  MR6  MR7   MR5
MR1 1.00  0.30 0.24 0.34 0.37 0.20  0.07
MR2 0.30  1.00 0.08 0.14 0.10 0.38 -0.06
MR3 0.24  0.08 1.00 0.24 0.24 0.06  0.20
MR4 0.34  0.14 0.24 1.00 0.13 0.06  0.11
MR6 0.37  0.10 0.24 0.13 1.00 0.09  0.06
MR7 0.20  0.38 0.06 0.06 0.09 1.00  0.00
MR5 0.07 -0.06 0.20 0.11 0.06 0.00  1.00

Mean item complexity =  2.4
Test of the hypothesis that 7 factors are sufficient.

df null model =  1711  with the objective function =  18.29 with Chi Square =  6922.95
df of  the model are 1319  and the objective function was  5.03 

The root mean square of the residuals (RMSR) is  0.04 
The df corrected root mean square of the residuals is  0.04 

The harmonic n.obs is  400 with the empirical chi square  1789.61  with prob <  6.8e-17 
The total n.obs was  400  with Likelihood Chi Square =  1878.89  with prob <  2.1e-22 

Tucker Lewis Index of factoring reliability =  0.858
RMSEA index =  0.032  and the 90 % confidence intervals are  0.029 0.036
BIC =  -6023.86
Fit based upon off diagonal values = 0.96
Measures of factor score adequacy             
                                                   MR1  MR2  MR3  MR4  MR6  MR7  MR5
Correlation of (regression) scores with factors   0.91 0.91 0.90 0.86 0.86 0.83 0.83
Multiple R square of scores with factors          0.83 0.83 0.82 0.74 0.74 0.69 0.68
Minimum correlation of possible factor scores     0.66 0.66 0.63 0.49 0.47 0.39 0.37

Mutli-Dimensional Scaling

mds_creatclustRAW <- cmdscale((dist(creatclustRAW[,-c(1,1)])))

 plot(mds_creatclustRAW[, 1], mds_creatclustRAW[, 2], 
             type = "n", xlab = "MDS Dimension 1", 
             ylab = "MDS Dimension 2")

  points(mds_creatclustRAW[, 1], mds_creatclustRAW[, 2], 
                         pch = 21, bg = "lightgray")

labels <- c("COHS1","COHS2", "COHS3", "COHS4", "COHS5", "COHS6", "COHS7", "COHS8", "COHS9", "COHS10", "COHS11", "COHS-2", "COHS13", "COHS14", "COHS15", "COHS16", "COHS17", "COHS18", "COHS19", "COHS20", "COHS21", "COHS22", "COHS23", "COHS24", "COHS25", "COHS26", "COHS27", "COHS28", "COHS29", "COHSF1", "COHSF2", "COHSF3", "COHSF4", "COHSF5", "COHSF6", "COHSF7", "COHSF8", "COHSF9", "COHSF10", "COHSF11", "COHSF12", "COHSF13", "COHSF14", "COHSF15", "COHSF16", "COHSF17", "COHSF18", "COHSF19", "COHSF20", "COHSF21", "COHSF22", "COHSF23", "COHSF24", "COHSF25", "COHSF26", "COHSF27", "COHSF28", "COHSF29", "COHSF30")
  
 text(mds_creatclustRAW[, 1], mds_creatclustRAW[, 2], 
           labels = labels[-1], 
             pos = 3, cex = 0.6)
 
 kmeans_clusters <- kmeans(mds_creatclustRAW, centers=7)$cluster
 
 points(mds_creatclustRAW[, 1], mds_creatclustRAW[, 2], 
        pch = c(21, 22, 23, 24, 25, 3, 8), bg = kmeans_clusters, cex = 1.2)


fa3 <- fa(r=creatclustRAW_Scaled, nfactors=2, rotate="oblimin")
print(fa3)
Factor Analysis using method =  minres
Call: fa(r = creatclustRAW_Scaled, nfactors = 2, rotate = "oblimin")
Standardized loadings (pattern matrix) based upon correlation matrix

                       MR1  MR2
SS loadings           7.04 5.46
Proportion Var        0.12 0.09
Cumulative Var        0.12 0.21
Proportion Explained  0.56 0.44
Cumulative Proportion 0.56 1.00

 With factor correlations of 
     MR1  MR2
MR1 1.00 0.32
MR2 0.32 1.00

Mean item complexity =  1.2
Test of the hypothesis that 2 factors are sufficient.

df null model =  1711  with the objective function =  18.29 with Chi Square =  6922.95
df of  the model are 1594  and the objective function was  8.19 

The root mean square of the residuals (RMSR) is  0.06 
The df corrected root mean square of the residuals is  0.06 

The harmonic n.obs is  400 with the empirical chi square  4596.98  with prob <  2.5e-288 
The total n.obs was  400  with Likelihood Chi Square =  3090.43  with prob <  2.5e-98 

Tucker Lewis Index of factoring reliability =  0.69
RMSEA index =  0.048  and the 90 % confidence intervals are  0.046 0.051
BIC =  -6459.96
Fit based upon off diagonal values = 0.89
Measures of factor score adequacy             
                                                   MR1  MR2
Correlation of (regression) scores with factors   0.95 0.94
Multiple R square of scores with factors          0.90 0.88
Minimum correlation of possible factor scores     0.79 0.76

Functions needed to relate to the column names in the file/dataframe


##model <- ' 
##MR1 ~ park2 + cookspice46 + bed4 + comfortz26 + sameorder8 + seatsame10 + samefood58 + triedtrue14 + eatsame3 + likerout17 + sameorderrest33 + cancelannoy20 + seatsame44 + ordermeal47 

##MR2 ~ eatsweet42 + eatongo60 + snacks54 + fridge48 + finish39 + snacktreat45 + eatunaware57 + autopilot9'



##MR1 <- creatclustRAWscaled_DF$park2 + creatclustRAWscaled_DF$cookspice46 + creatclustRAWscaled_DF$bed4 + creatclustRAWscaled_DF$comfortz26 + creatclustRAWscaled_DF$sameorder8 + creatclustRAWscaled_DF$seatsame10 + creatclustRAWscaled_DF$samefood58 + creatclustRAWscaled_DF$triedtrue14 + creatclustRAWscaled_DF$eatsame3 + creatclustRAWscaled_DF$likerout17 + creatclustRAWscaled_DF$sameorderrest33 + creatclustRAWscaled_DF$cancelannoy20 + creatclustRAWscaled_DF$seatsame44 + creatclustRAWscaled_DF$ordermeal47


##MR2<-creatclustRAWscaled_DF$eatsweet42 + creatclustRAWscaled_DF$eatongo60 + creatclustRAWscaled_DF$snacks54 + creatclustRAWscaled_DF$fridge48 + creatclustRAWscaled_DF$finish39 + creatclustRAWscaled_DF$snacktreat45 + creatclustRAWscaled_DF$eatunaware57 + creatclustRAWscaled_DF$autopilot9

##creatclustRAWscaled_DF$MR1 <- MR1
##creatclustRAWscaled_DF$MR2 <- MR2

Converting column labels to align with the original paper

df_creatclustRAW_Scaled <- as.data.frame(creatclustRAW_Scaled)

Routine <- df_creatclustRAW_Scaled$COHS1 + df_creatclustRAW_Scaled$COHSF16 + df_creatclustRAW_Scaled$COHS3 + df_creatclustRAW_Scaled$COHS25 + df_creatclustRAW_Scaled$COHS7 + df_creatclustRAW_Scaled$COHS9 + df_creatclustRAW_Scaled$COHSF28 + df_creatclustRAW_Scaled$COHS13 + df_creatclustRAW_Scaled$COHS2 + df_creatclustRAW_Scaled$COHS16 + df_creatclustRAW_Scaled$COHSF3 + df_creatclustRAW_Scaled$COHS19 + df_creatclustRAW_Scaled$COHSF14 + df_creatclustRAW_Scaled$COHSF17


Automaticity <- df_creatclustRAW_Scaled$COHSF12 + df_creatclustRAW_Scaled$COHSF30 + df_creatclustRAW_Scaled$COHSF24 + df_creatclustRAW_Scaled$COHSF18 + df_creatclustRAW_Scaled$COHSF9 + df_creatclustRAW_Scaled$COHSF15 + df_creatclustRAW_Scaled$COHSF27 + df_creatclustRAW_Scaled$COHS8

model <- '
Routine ~ COHS1 + COHSF16 + COHS3 + COHS25 + COHS7 + COHS9 + COHSF28 + COHS13 + COHS2 + COHS16 + COHSF3 + COHS19 + COHSF14 + COHSF17

Automaticity ~ COHSF12 + COHSF30 + COHSF24 + COHSF18 + COHSF9 + COHSF15 + COHSF27 + COHS8
'

Creating the SEM diagram. Adding two columns–Routine & Automaticity

library(lavaan)

df_creatclustRAW_Scaled$Routine <- df_creatclustRAW_Scaled$COHS1 + df_creatclustRAW_Scaled$COHSF16 + df_creatclustRAW_Scaled$COHS3 + df_creatclustRAW_Scaled$COHS25 + df_creatclustRAW_Scaled$COHS7 + df_creatclustRAW_Scaled$COHS9 + df_creatclustRAW_Scaled$COHSF28 + df_creatclustRAW_Scaled$COHS13 + df_creatclustRAW_Scaled$COHS2 + df_creatclustRAW_Scaled$COHS16 + df_creatclustRAW_Scaled$COHSF3 + df_creatclustRAW_Scaled$COHS19 + df_creatclustRAW_Scaled$COHSF14 + df_creatclustRAW_Scaled$COHSF17
 
df_creatclustRAW_Scaled$Automaticity <- df_creatclustRAW_Scaled$COHSF12 + df_creatclustRAW_Scaled$COHSF30 + df_creatclustRAW_Scaled$COHSF24 + df_creatclustRAW_Scaled$COHSF18 + df_creatclustRAW_Scaled$COHSF9 + df_creatclustRAW_Scaled$COHSF15 + df_creatclustRAW_Scaled$COHSF27 + df_creatclustRAW_Scaled$COHS8

fit<-cfa(model, data=df_creatclustRAW_Scaled)
Warning: lavaan->lav_samplestats_icov():  
   sample covariance matrix is not positive-definite
Warning: lavaan->lav_lavaan_step11_estoptim():  
   Model estimation FAILED! Returning starting values.
summary(fit, fit.measures = TRUE, standardized=T, rsquare=T)
Warning: lavaan->lav_object_summary():  
   fit measures not available if model did not converge
lavaan 0.6-18 did NOT end normally after 290 iterations
** WARNING ** Estimates below are most likely unreliable

  Estimator                                         ML
  Optimization method                           NLMINB
  Number of model parameters                        25

  Number of observations                           400


Parameter Estimates:

  Standard errors                             Standard
  Information                                 Expected
  Information saturated (h1) model          Structured

Regressions:
                   Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
  Routine ~                                                             
    COHS1             1.000       NA                      1.000    0.136
    COHSF16           1.000       NA                      1.000    0.136
    COHS3             1.000       NA                      1.000    0.136
    COHS25            1.000       NA                      1.000    0.136
    COHS7             1.000       NA                      1.000    0.136
    COHS9             1.000       NA                      1.000    0.136
    COHSF28           1.000       NA                      1.000    0.136
    COHS13            1.000       NA                      1.000    0.136
    COHS2             1.000       NA                      1.000    0.136
    COHS16            1.000       NA                      1.000    0.136
    COHSF3            1.000       NA                      1.000    0.136
    COHS19            1.000       NA                      1.000    0.136
    COHSF14           1.000       NA                      1.000    0.136
    COHSF17           1.000       NA                      1.000    0.136
  Automaticity ~                                                        
    COHSF12           1.027       NA                      1.027    0.199
    COHSF30           1.018       NA                      1.018    0.198
    COHSF24           1.051       NA                      1.051    0.204
    COHSF18           1.035       NA                      1.035    0.201
    COHSF9            1.000       NA                      1.000    0.194
    COHSF15           1.034       NA                      1.034    0.201
    COHSF27           1.033       NA                      1.033    0.201
    COHS8             1.045       NA                      1.045    0.203

Covariances:
                   Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
 .Routine ~~                                                            
   .Automaticity     -0.001       NA                     -0.001   -0.799

Variances:
                   Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
   .Routine           0.000       NA                      0.000    0.000
   .Automaticity      0.791       NA                      0.791    0.030

R-Square:
                   Estimate
    Routine           1.000
    Automaticity      0.970

Another option


library(semPlot)

semPaths(fit, 'std', layout = 'circle2')

Another option


semPaths(fit, 'std', layout = 'circle2', edge.label.cex = 0.8, residuals = FALSE, sizeMAn = 7, intercepts=FALSE, title=FALSE, exoVar = FALSE, exoCov = FALSE, posCol=c("skyblue4", "darkred"))
Warning in qgraph::qgraph(Edgelist, labels = nLab, bidirectional = Bidir,  :
  The following arguments are not documented and likely not arguments of qgraph and thus ignored: sizeMAn

Another option


semPaths(fit, whatLabels="std", title=FALSE, nCharNodes=0, sizeMan = 4, node.width = 1.2, edge.label.cex = 0.75, rotation= 3, style = "ram", mar = c(5, 5, 5, 5), exoVar = FALSE, exoCov = FALSE, layout='circle2', edge.color="darkblue")

Trying to use DiagrameR but having trouble finding the combine_nodes function.

library(magrittr)
library(lavaan)
library(psych)
library(semPlot)
library(dplyr)
library(DiagrammeR)

fit2 %>% parameterestimates %>% sample_n(5)

paths <- fit2 %>%
     parameterestimates %>%
     dplyr::select(lhs, op, rhs, est)

latent <- paths %>%
  filter(op == "=~") %>%
  dplyr::select(nodes = lhs) %>%
  distinct %>%
  dplyr::mutate(shape = "circle")

`%not_in%` <- Negate(`%in%`)
manifest <- paths %>%
  filter(op != "~1", lhs %not_in% latent$nodes) %>%
  dplyr::select(nodes = lhs) %>%
  distinct %>%
  dplyr::mutate(shape = "square")


node_set <- combine_ndfs(latent, manifest)
node_set

all_paths <- paths %>%
  filter(op != "~1") %>%
  mutate(label = round(est, 2)) %>%
  select(-est)

# Factor loadings are the paths in the "=~" lines
loadings <- all_paths %>%
  filter(op == "=~") %>%
  mutate(edge_from = lhs, edge_to = rhs, style = "dashed") %>%
  select(edge_from, edge_to, style, label)

# This is now an edge dataframe
loadings
NA
LS0tCnRpdGxlOiAiQ3JlYXR1cmUgb2YgSGFiaXQgQW5hbHlzaXMiCm91dHB1dDoKICBodG1sX25vdGVib29rOiBkZWZhdWx0CiAgcGRmX2RvY3VtZW50OiBkZWZhdWx0Ci0tLQoKVGhpcyBpcyB0aGUgQ3JlYXR1cmUgb2YgSGFiaXQgQ2x1c3RlciBBbmFseXNpcyBVc2luZyBHcmFwaCBUaGVvcnkKCmBgYHtyIGluY2x1ZGU9RkFMU0V9CmtuaXRyOjpvcHRzX2NodW5rJHNldChtZXNzYWdlID0gRkFMU0UpCmBgYAoKCmBgYHtyfQojbGlicmFyaWVzIG5lZWRlZApsaWJyYXJ5KG1hZ3JpdHRyKQpsaWJyYXJ5KGRwbHlyKQpsaWJyYXJ5KHRpZHlyKQpsaWJyYXJ5KHRpZHl2ZXJzZSkKbGlicmFyeShmYWN0b2V4dHJhKQpsaWJyYXJ5KGdncHVicikKbGlicmFyeShnZ3JlcGVsKQpsaWJyYXJ5KGZwYykKbGlicmFyeShpZ3JhcGgpCmxpYnJhcnkobmV0d29yaykKbGlicmFyeShyYW5kb21OYW1lcykKbGlicmFyeShzdGF0bmV0KQpsaWJyYXJ5KG1va2tlbikKbGlicmFyeShzaXJ0KQpsaWJyYXJ5KHBzeWNoKQpsaWJyYXJ5KGNsdXN0ZXIpCmxpYnJhcnkocHN5Y2gpICMjZmFjdG9yIGFuYWx5c2lzIGFuZCBvdGhlciBmdW5jdGlvbnMKbGlicm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