Dear Rhelp,
I did a daisy on 5 lifestyle variables, 3 of which were nominal and 2 were
ordinal and assigned types “nominal” and “ordinal” for the variables,
respectively. I got an output indicating their types as “I” for interval(?).
Doing it on the Rdata example “flower” gave the same types in the output as the
types they were assigned to. Why is this so? Below are the codes and outputs.
sfq is a nominal variable with 5 categories pertaining to
smoking frequency and consumption (1=none, 2=≤10
sticks/day somedays, 3=>10 sticks/day somedays, 4=≤10
sticks/day daily, 5=>10 sticks/day daily)
afq is a nominal variable with 5 categories pertaining to
alcohol frequency and consumption
pafd is a nominal variable with 5 categories pertaining to
physical activity frequency and duration
dietp1 is an ordinal variable with 3 categories pertaining low,
medium, high consumption of Western diet
dietp3 is an ordinal variable with 3 categories pertaining to
low, medium, high consumption of prudent diet
>head(lsclusjt3)
sfq afq pafd dietp1 dietp3
1 1 1 3 1 2
2 1 1 3 3 3
3 1 1 1 2 1
4 1 1 1 2 2
5 1 2 3 3 3
6 1 1 1 2 2
>dm=daisy(lsclusjt3,metric="gower",
stand=FALSE,type=list(nominal=c(1,2,3), ordinal=c(4,5)))
>summary(dm)
38434528 dissimilarities, summarized :
Min. 1st Qu. Median Mean 3rd Qu. Max.
0.00000 0.25000 0.35000 0.36599 0.50000 1.00000
Metric : mixed ; Types = I, I, I, I, I
Number of objects : 8768
>dfl=daisy(flower,type=list(asymm=1:3,nominal=4,ordinal=5:6,interval=7:8))
> summary(dfl)
153 dissimilarities, summarized :
Min. 1st Qu. Median Mean 3rd Qu. Max.
0.15915 0.43576 0.53408 0.53473 0.62908 0.89099
Metric : mixed ; Types = A, A, A, N, O, O, I, I
Number of objects : 18
Penny
[[alternative HTML version deleted]]