Rangreihe: Rangreihe

Description Usage Arguments Details Value Examples

View source: R/ranking.R

Description

Rangordnungen von Objekten koennen durch eine Transformation der Rangreihen in Intervallskalierte Merkmale ueberfuehrt werden. Die Grundidee dieser Methode geht auf Thurstone (1927) nach dem "Law of Categorical Judgement" zurueck.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
Rangreihe(
  ...,
  caption = "Rangreihe",
  note = "Law of Categorical Judgement",
  output = stp25output::which_output(),
  na.action = na.pass,
  include.percent = TRUE,
  include.freq = TRUE,
  include.mean = TRUE,
  include.z = TRUE,
  include.na = TRUE,
  groups = NULL,
  order = TRUE,
  decreasing = TRUE,
  digits.mean = 2
)

Rangreihe_default(
  items,
  caption = "",
  note = "",
  output = stp25output::which_output(),
  include.percent = TRUE,
  include.freq = TRUE,
  include.mean = TRUE,
  include.z = TRUE,
  include.na = TRUE,
  groups = NULL,
  order = TRUE,
  decreasing = TRUE,
  digits.mean = 2,
  input = NULL,
  pattern = "____"
)

Arguments

...

Weitere Argumente

caption, note, output

an stp25output

include.percent, include.freq, include.mean, include.z, include.na

was soll ausgewertet werden

groups

gruppen

digits.mean, order, decreasing

sortierung

items

data.frame

input

Format der Items c("ranking", "ordering"),

pattern

intern gruppen

Details

Dabei werden die kumulierten Haeufigkeiten in Normalverteilte z-Werte uebergefuehrt und aus diesen die Intervallskalierten Markmalsauspraegungen gebildet.

Literatur: Bortz, J. & Doering, N. (2006). Forschungsmethoden und Evaluation fuer Human-und Sozialwissenschaftler (4. Auflage). Berlin: Springer. Seite 155

Value

Vector

Examples

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
require(stpvers)
library(PlackettLuce)

nlv <- 5
n <- 2 * 3 * nlv * 1
set.seed(n)

DF <-
  data.frame(
    Geschlecht = gl(2, n / 2, labels = c("Maennlich", "Weiblich")),
    Alter = gl(4, n / 4,   labels = c("20-29", "30-39", "40-49", "50-59")),
    Landwirtschaft = gl(2, n / 2, labels = c("konventionell", "biologisch"))
  )

Attribute <-
  as.data.frame(t(apply(matrix(NA, ncol = n, nrow = 5), 2,
                        function(x)
                          sample.int(5))))

Attribute[1, ] <- c(5, 1, 4, 2, 3)
Attribute[2, ] <- c(5, 1, 4, 2, 3)
Attribute[3, ] <- c(5, 2, 4, 3, 1)
Attribute[4, ] <- c(5, 1, 4, 3, 2)
Attribute[5, ] <- c(5, 1, 4, 3, 2)

Attribute[21, ] <- c(1, 2, 5, 4, 3)
Attribute[22, ] <- c(1, 4, 5, 3, 2)
Attribute[23, ] <- c(2, 5, 1, 4, 3)
Attribute[24, ] <- c(1, 4, 2, 5, 3)
Attribute[25, ] <- c(1, 4, 3, 5, 2)

attribute  <- c("Verfuegbarkeit",
                "Vielfalt",
                "Qualitaet",
                "Geschmack",
                "Preis")

Attribute<- dapply2(Attribute, function(x) factor(x, 1:5, attribute))

DF <- cbind(DF, Attribute)

head(DF)

res <-
  Rangreihe( ~ V1+V2+V3+V4+V5,
             DF, include.percent=FALSE, order=FALSE, include.na=FALSE,
             caption="Produkte aus konventioneller und biologischer  Landwirtschaft")

res$input
names(res)
x<- res$res





R <- as.rankings(res$items, res$input)

mod <- PlackettLuce( R )
coef(mod)


summary(mod)
x$pc <-  round(coef(mod, log = FALSE) ,2)
x$log.pc <- round(coef(mod, log = TRUE) ,2)
x[order(x$pc,decreasing=TRUE),] 



DF1 <-  data.frame(
  A = c(1, 1, 1, 2, 3, 1),
  B = c(2, 2, 2, 3, 2, 3),
  C = c(3, 3, 3, 1, 1, NA),
  D = c(NA, NA, NA, NA, NA, 2)
)
DF2 <-   data.frame(
  R1 = factor(c("A", "A", "A", "C", "C", "A"),   c("A", "B", "C", "D")),
  R2 = factor(c("B", "B", "B", "A", "B", "D"),   c("A", "B", "C", "D")),
  R3 = factor(c("C", "C", "C", "B", "A", "B"),   c("A", "B", "C", "D"))
)


Rangreihe(DF1)$mean
Rangreihe(DF2)$mean

dat_bortz<-
  as.table(matrix(c(
    2,8,10,13,17,
    5,10,15,18,2,
    10,12,20,5,3,
    15,20,10,3,2,
    22,18,7,2,1)
    , nrow = 5, ncol=5, byrow=TRUE,
    dimnames = list(c("A", "B", "C", "D", "E"),1:5)))  

Rangreihe(dat_bortz)



# dat_table <-
#   as.table(matrix(c(
#     50,0,0,0,0,
#     0,50,0,0,0,
#     0,0,50,0,0,
#     0,0,0,50,0,
#     0,0,0,0,50
#      )
#     , nrow = 5, ncol=5, byrow=TRUE,
#     dimnames = list(c("A", "B", "C", "D", "E"),1:5)))
#  # Calc_Rank(dat_table)



n <- 2 * 3 * 4 * 1

set.seed(n)
kaffee <- c("Guatemala", "Vietnam", "Honduras", "Äthiopien")
sex<- c("male", "female")
age<- c("20-29", "30-39", "40-49", "50-59")
kaffe<- c("Espresso", "Filterkaffee", "Milchkaffee")

DF <-
  data.frame(
    sex = factor("male",sex),
    Alter = factor("20-29",age ),
    Kaffeeform = factor("Espresso", kaffe),
    R1 = factor(kaffee[1], kaffee),
    R2 = factor(kaffee[2], kaffee),
    R3 = factor(kaffee[3], kaffee),
    R4 = factor(kaffee[4], kaffee)
  )

DF<- rbind(DF,DF,DF,DF,DF,DF,DF,DF,DF,DF,DF,DF,DF,DF,DF,DF,DF)

for(i in 1:n){
  DF<- rbind(DF,
             c(sample(sex)[1],
               sample(age)[1],
               sample(kaffe)[1],
               sample(kaffee)
             ))
}

x <- DF[4:7]
Rangreihe(x, include.percent=FALSE, groups=DF$sex)
x<-Rangreihe(R1 + R2 +R3 ~sex, DF, include.percent=FALSE, output=FALSE)


names( x)
x$mean

#' 
#lattice::dotplot( reorder(Items, mean)~ mean|"Kaffee", 
                  x$mean, groups=group , xlab="",
#                  xlim=range(x$mean$mean)*1.10 , auto.key=list(), cex=1)
 

stp4/stp25stat documentation built on Sept. 17, 2021, 2:03 p.m.