Thesis: “Reflexions methodologies autour du Napping: vers une integration du comportement du sujet dans l’analyse des donnees de Napping”
Chapter 4 - Illustration of functions cpdm(), plotcpdm(), traject(), and dimtracking()
Author: Tam Minh LE
Supervisor : Francois Husson & Sebastien Le
R version: 3.2.1 - Updated: 17.08.2015
rm(list=ls())
options(max.print=5.5E5) # max print
Require package ———————————————————
library(FactoMineR)
library(SensoMineR)
library(ggplot2)
library(reshape2)
library(stringr)
library(holos)
library(car)
library(cluster)
library(grDevices)
library(knitr)
Import data ————————————————————-
data(cards.fico) # final configuration
Functions: cpdm & plotcpdm ———————————————-
cards.cpdm <- cpdm(cards.fico, nb.step=3)
# names(cards.cpdm)
# cards.cpdm$Steps.of.all.subjects
plotcpdm(cards.cpdm, subject=1)
# plotcpdm(cards.cpdm, subject=1, axes=c(1,2)) # s1: 40 subjects
# plotcpdm(cards.cpdm, subject=41, axes=c(1,2)) # s2: 30 subjects
# plotcpdm(cards.cpdm, subject=71, axes=c(1,2)) # s3: 5 subjects
# plotcpdm(cards.cpdm, subject=76, axes=c(1,2)) # s4: 5 subjects
# plotcpdm(cards.cpdm, subject=81, axes=c(1,2)) # s5: 30 subjects
Temporal data is the cards data
# #' Require package ---------------------------------------------------------
# library(FactoMineR)
# library(SensoMineR)
# library(ggplot2)
# library(reshape2)
# library(stringr)
# library(car)
# library(cluster)
# library(grDevices)
Load data —————————————————————
data(cards.tempo)
cards.tempo[1:32,] # structure of temporal data
## subject step stimulus time coordX coordY
## 1 1 0 M 16:32:28 0 0
## 2 1 0 K 16:32:28 0 80
## 3 1 0 P 16:32:28 0 160
## 4 1 0 D 16:32:28 0 240
## 5 1 0 H 16:32:28 0 320
## 6 1 0 A 16:32:28 0 400
## 7 1 0 G 16:32:28 0 480
## 8 1 0 O 16:32:28 0 560
## 9 1 0 L 16:32:28 80 0
## 10 1 0 N 16:32:28 80 80
## 11 1 0 I 16:32:28 80 160
## 12 1 0 E 16:32:28 80 240
## 13 1 0 J 16:32:28 80 320
## 14 1 0 F 16:32:28 80 400
## 15 1 0 C 16:32:28 80 480
## 16 1 0 B 16:32:28 80 560
## 17 1 1 B 16:32:35 887 326
## 18 1 2 C 16:32:38 847 302
## 19 1 3 J 16:32:42 897 249
## 20 1 4 L 16:32:45 940 317
## 21 1 5 A 16:32:47 818 381
## 22 1 6 D 16:32:50 793 234
## 23 1 7 G 16:32:52 757 329
## 24 1 8 P 16:32:55 865 179
## 25 1 9 O 16:33:00 122 323
## 26 1 10 F 16:33:01 122 424
## 27 1 11 H 16:33:02 55 373
## 28 1 12 E 16:33:03 0 303
## 29 1 13 I 16:33:04 65 268
## 30 1 14 N 16:33:06 124 242
## 31 1 15 K 16:33:09 58 190
## 32 1 16 M 16:33:11 196 301
Function traject() ——————————————————
corr.j1 <- traject(cards.tempo, juge=1, axes=c(1,2))
corr.j1[,1:3]
## Dim.1 Dim.2 Dim.3
## Step0 0.0029 0.0618 0.0057
## Step1 0.0834 0.0663 0.0449
## Step2 0.1587 0.0891 0.0017
## Step3 0.0533 0.1998 0.0162
## Step4 0.1290 0.2859 0.0696
## Step5 0.2450 0.3446 0.0110
## Step6 0.1506 0.4919 0.0013
## Step7 0.0806 0.6530 0.0380
## Step8 0.0357 0.9509 0.0073
## Step9 0.0428 0.9426 0.0030
## Step10 0.0406 0.9447 0.0026
## Step11 0.0383 0.9489 0.0027
## Step12 0.0442 0.9480 0.0018
## Step13 0.0483 0.9480 0.0009
## Step14 0.0485 0.9436 0.0008
## Step15 0.0515 0.9387 0.0017
## Step16 0.0660 0.9336 0.0012
names(corr.j1)
## NULL
Function dimtracking() ————————————————–
dimtracking(corr.j1, num.dim=1:3)
## Using id as id variables
dimtracking() with learning phase
corr.j1 <- traject(cards.tempo,juge=1, axes=c(1,2), plot.graph=FALSE)
res.sum <- suminfo(cards.tempo)
j1.learning <- res.sum$Step.Time$Step.learning[1]
p <- dimtracking(corr.j1, num.dim=1:3)
## Using id as id variables
p + geom_vline(xintercept = j1.learning, colour="magenta", linetype="longdash")
******************************** End *************************************