Title: | Dual Scaling Analysis of Data |
Version: | 1.0.0 |
Description: | Dual Scaling, developed by Professor Shizuhiko Nishisato (1994, ISBN: 0-9691785-3-6), is a fundamental technique in multivariate analysis used for data scaling and correspondence analysis. Its utility lies in its ability to represent multidimensional data in a lower-dimensional space, making it easier to visualize and understand underlying patterns in complex data. This technique has been implemented to handle various types of data, including Contingency and Frequency data (CF), Multiple-Choice data (MC), Sorting data (SO), Paired-Comparison data (PC), and Rank-Order data (RO), providing users with a powerful tool to explore relationships between variables and observations in various fields, from sociology to ecology, enabling deeper and more efficient analysis of multivariate datasets. |
License: | AGPL (≥ 3) |
Encoding: | UTF-8 |
RoxygenNote: | 7.2.3 |
Depends: | R (≥ 3.5.0) |
LazyData: | true |
Imports: | eba, ff, ggplot2, ggrepel, grid, Matrix, matrixcalc, stats, RColorBrewer, glue, utils |
Suggests: | testthat (≥ 3.0.0), vdiffr |
Config/testthat/edition: | 3 |
NeedsCompilation: | no |
Packaged: | 2023-11-08 18:55:20 UTC; Rober |
Author: | Jose G. Clavel |
Maintainer: | Roberto de la Banda <dualScale@gmail.com> |
Repository: | CRAN |
Date/Publication: | 2023-11-09 07:10:10 UTC |
Nishisato and Clavel, artificial set of data
Description
10 observation and 3 variables erroneously coded.
Usage
bad_coded
Format
A data set with 10 observations on the following 3 variables:
V2
Option 1 is omited
V3
Options go from 1 to 8
V4
Option 1 omited, other are not consecutive and there is NA
Details
The data were collected from 23 participants at a workshop in Singapore in 1985
Source
Nishisato, S. and Baba, Y. (1999). On contingency, projection and forced classification of dual scaling. Behaviormetrika, 26, 207–219.
References
Nishisato, S. (2007). Multidimensional Nonlinear Descriptive Analysis. Chapman & Hall/CRC.
Christmas party plans
Description
As a course assignment for Nishisato's class, Ian Wiggins, a student, collected paired comparison data from 14 researchers at a research institute on his eight Christmas party plans.
Usage
christmas
Format
A subset of the original data set of 14 subjects on 15 pairs of 6 plans:
plan1
A pub/restaurant crawl after work
plan2
A reasonably priced lunch in an area restaurant
plan3
Keep to one's self
plan4
An evening banquet at a restaurant
plan5
A pot-luck at someone's home after work
plan6
A ritzy lunch at a good restaurant (tablecloths)
Details
The data were originally collected from 14 participants by 28 pairs
of plans with elements 1 for the choice of the first plan and 2 for the
choice of the second plan. For computations, 2
is converted to -1
.
Source
Nishisato, S. and Nishisato, I.(1994). Dual Scaling in a Nutshell. Toronto: MicroStats.
References
Nishisato, S. (2022). Optimal Quantification and Symmetry. Behaviormetrika, 12, 137.
Curricula and Social classes
Description
Hollingshead (1949) found that the members of a small Middle Western community in the United States divided themselves into 5 social classes. He investigated his prediction that adolescents in the different social classes would enroll in different curricula
Usage
curricula
Format
A data set of 390 subjects on 5 social classes and 3 different curricula:
s.class1
Merged social classes I and II because the frequencies were small
s.class2
Social class III
s.class3
Social class IV
s.class4
Social class V
curricula1
College Prep curriculum
curricula2
General curriculum
curricula3
Commercial curriculum
Details
The data were originally collected from 390 participants in terms of their social classes and actual curriculum enrollments.
Source
Nishisato, S. and Nishisato, I.(1994). Dual Scaling in a Nutshell. Toronto: MicroStats.
References
Hollingshead, A.B. (1949). Elmtown's Youth: The Impact of Social Classes on Adolescents. Wiley.
Contingency and frequency data analysis
Description
Contingency and frequency data analysis
Usage
ds_cf(input, solutions = NULL)
Arguments
input |
A data set with valid data |
solutions |
Optional arguments. A number of intended solutions |
Value
call |
Call with all of the specified arguments are specified by their full names |
orig_data |
Initial data |
item_op_lbl |
Item options labels |
sub_lbl |
Subjects options labels |
tot_row |
Sum of subject values |
tot_row |
Sum of item values |
solutions |
Maximum possible solutions |
out |
Results obtained |
norm_opt |
Normed option weights |
proj_opt |
Projected option weights |
norm_sub |
Normed subject scores |
proj_sub |
Projected subject scores |
appro0 |
Order 0 approximation for initial data |
approx |
Order |
residual0 |
Residual matrix for initial data |
residual |
Residual matrix |
Examples
ds_cf(curricula)
ds_cf(preferences)
Calculate SVD decomposition of the matrix
Description
Calculate SVD decomposition of the matrix
Usage
ds_eigen(obj)
Arguments
obj |
A Matrix |
Value
Result of svd
function
Multiple choice data analysis
Description
Multiple choice data analysis
Usage
ds_mc(input, solutions = NULL, mode = c("rad", "act"))
Arguments
input |
A data set with valid data |
solutions |
Optional argument. A number of intended solutions |
mode |
Optional argument. In case of NA values, the action to be taken. See help("ds_mc_check") for more information. Radical action by default. |
Value
call |
Call with all of the specified arguments are specified by their full names |
orig_data |
Initial data |
item_op_lbl |
Item options labels |
sub_lbl |
Subjects options labels |
solutions |
Maximum possible solutions |
out |
Results obtained |
item_stat |
Item statistics |
info |
Distribution of component |
rij |
Inter item correlation |
proj_opt |
Projected option weights |
proj_sub |
Projected subject scores |
norm_opt |
Normed option weights |
norm_sub |
Normed subject scores |
See Also
Examples
ds_mc(singaporean)
ds_mc(singaporean, solutions = 2)
Function to identify incorrect Multiple Choice input data
Description
Function to identify incorrect Multiple Choice input data
Usage
ds_mc_check(input, mode = c("rad", "act"))
Arguments
input |
The input data to be checked |
mode |
Do you want to use a radical ("rad") correction mode or active ("act") allocations? |
Value
A list with the original input and the converted input
Examples
ds_mc_check(singaporean)
ds_mc_check(bad_coded)
Forced multiple choice data analysis
Description
Forced multiple choice data analysis
Usage
ds_mcf(input, crit, solutions = NULL, mode = c("rad", "act"))
Arguments
input |
A data set with valid data |
crit |
Used to determine a criterion item for forced classification analysis |
solutions |
Optional argument. A number of intended solutions |
mode |
Correction mode to incorrect data. |
Details
There are three types of outputs: Forced classification of the criterion item (type A); dual scaling of non-criterion items by ignoring the criterion item (type B); dual scaling of non-criterion items after eliminating the influence of the criterion item (type C). These three types correspond to, respectively, dual scaling of data projected onto the subspace of the criterion item, dual scaling of non-criterion items, and dual scaling of data in the complementary space of the criterion item.
Value
call |
Call with all of the specified arguments are specified by their full names |
orig_data |
Initial data |
crit_item |
The criterion item for forced classification |
item_op_lbl |
Item options labels |
sub_lbl |
Subjects options labels |
solutions_mcf |
Maximum possible solutions for forced multiple choice |
solutions_mc |
Maximum possible solutions for multiple choice |
info_\emph{x} |
Distribution of component information according to output |
out_\emph{x} |
Results obtained according to output |
item_stat_\emph{x} |
Item statistics according to output (Not type C) |
rij_\emph{x} |
Inter item correlation according to output (Not type C) |
proj_opt_\emph{x} |
Projected option weights according to output |
proj_sub_\emph{x} |
Projected subject scores according to output |
norm_opt_\emph{x} |
Normed option weights according to output |
norm_sub_\emph{x} |
Normed subject scores according to output |
match_missmatch |
Match-mismatch tables |
predict |
Percentage of correct classification |
comp_cont |
Component contamination |
tot_cont |
Total contamination |
See Also
Examples
ds_mcf(singaporean, crit = 1)
Generate the dataframe out
Description
Generate the dataframe out
Usage
ds_out_tbl(inf, eig, op)
Arguments
inf |
List with required row size information |
eig |
List with the information of the values to be displayed |
op |
Function where each output is used: (1) ds_cf (2) ds_mc (3) ds_mc_A (4) ds_mc_C (5) ds_pc / ds_ro |
Value
A dataframe with the eigenvalue's information of the process
Paired comparison data analysis
Description
Paired comparison data analysis
Usage
ds_pc(input, solutions = NULL)
Arguments
input |
A data set with valid data |
solutions |
Optional argument. A number of intended solutions |
Value
call |
Call with all of the specified arguments are specified by their full names |
orig_data |
Initial data |
item_op_lbl |
Item options labels |
sub_lbl |
Subjects options labels |
solutions |
Maximum possible solutions |
out |
Results obtained |
mat_e |
Matrix E |
norm_opt |
Normed option weights |
proj_opt |
Projected option weights |
norm_sub |
Normed subject scores |
proj_sub |
Projected subject scores |
Examples
ds_pc(christmas)
Rank order data analysis
Description
Rank order data analysis
Usage
ds_ro(input, solutions = NULL)
Arguments
input |
A data set with valid data |
solutions |
Optional argument. A number of intended solutions |
Value
call |
Call with all of the specified arguments are specified by their full names |
orig_data |
Initial data |
item_op_lbl |
Item options labels |
sub_lbl |
Subjects options labels |
solutions |
Maximum possible solutions |
out |
Results obtained |
mat_e |
Matrix E |
norm_opt |
Normed option weights |
proj_opt |
Projected option weights |
norm_sub |
Normed subject scores |
proj_sub |
Projected subject scores |
out_rank |
Results obtained by rank analysis |
norm_opt_rank |
Normed option weights by rank analysis |
proj_opt_rank |
Projected option weights by rank analysis |
norm_rank |
Normed rank scores |
proj_rank |
Projected rank scores |
Examples
ds_ro(goverment)
Selection of solutions for analysis
Description
Selection of solutions for analysis
Usage
ds_select_solutions(sols, max)
Arguments
sols |
The number of solutions requested |
max |
Maximum possible data solutions |
Value
Solutions used in further analysis
Goverment services and facilities
Description
A data set collected in Nishisato's scaling class (1982) in which 31 students on 10 municipal services in Toronto.
Usage
goverment
Format
A subset of the original data of 10 subjects on 10 municipal services in Toronto:
A
Public transit system
B
Postal service
C
Medical care, including hospitals and clinics
D
Sports, recreational facilities
E
Police protection
F
public libraries
G
cleaning streets
H
restaurants
I
theatres
J
Overall planning and development
Details
The data were originally collected to ranked the "most satisfactory" service, the "second most satisfactory", and so on until the "least satisfactory".
Source
Nishisato, S. and Nishisato, I.(1994). Dual Scaling in a Nutshell. Toronto: MicroStats.
References
Nishisato, S. and Nishisato, I.(1994). Dual Scaling in a Nutshell. Toronto: MicroStats.
Plot of Dual Scale analysis
Description
Plot of Dual Scale analysis
Usage
## S3 method for class 'dualScale'
plot(x, dim1 = 1, dim2 = 2, type = c("Asy1", "Asy2", "Sub", "Ite"), ...)
Arguments
x |
A Dual Scale object |
dim1 |
Component for the horizontal axis. Default dimension 1 |
dim2 |
Component for the vertical axis. Default dimension 2 |
type |
Graph type
|
... |
Arguments to be passed to methods |
Value
A plot of the available information from the object
See Also
Examples
plot(ds_cf(curricula))
plot(ds_mc(singaporean))
plot(ds_mcf(singaporean, crit = 1))
plot(ds_pc(christmas))
plot(ds_ro(goverment))
Obtain the data used in the graphs
Description
Obtain the data used in the graphs
Usage
plot_data(x, dim1 = 1, dim2 = 2, type = c("Asy1", "Asy2", "Sub", "Ite"), ...)
Arguments
x |
A Dual Scale object |
dim1 |
Component for the horizontal axis. Default dimension 1 |
dim2 |
Component for the vertical axis. Default dimension 2 |
type |
Graph type
|
... |
Arguments to be passed to methods |
Value
A dataframe with the data used
Examples
plot_data(ds_cf(curricula))
plot_data(ds_mc(singaporean))
plot_data(ds_mcf(singaporean, crit = 1))
plot_data(ds_pc(christmas))
plot_data(ds_ro(goverment))
Preferences, artificial set of data
Description
Artificial set of data where 13 people were asked two questions.
Usage
preferences
Format
A data set of contingency responses:
A, B, C
Do you prefer coffee to tea? (Yes, Not always, No)
Y, N
Do you smoke? (Yes, No)
Details
Artificial set of data where 13 people were asked two questions.
Source
Nishisato, S. (1980). Analysis of categorical data: Dual Scaling and its Applications. University of Toronto: Heritage.
References
Nishisato, S. (1980). Analysis of categorical data: Dual Scaling and its Applications. University of Toronto: Heritage.
Print of Dual Scale analysis
Description
print
method for package "dualScale"
Usage
## S3 method for class 'dualScale'
print(x, ...)
Arguments
x |
An dualScale object for which a summary is desired |
... |
Arguments to be passed to methods |
Value
A print of the available information from the object
See Also
Examples
print(ds_cf(curricula))
print(ds_cf(preferences))
print(ds_mc(singaporean))
print(ds_mcf(singaporean, crit = 1))
print(ds_pc(christmas))
print(ds_ro(goverment))
Singaporean children as viewed by adults
Description
A short survey on childrem in Singapore.
Usage
singaporean
Format
A data set of 23 subjects on 4 multiple-choice questions:
A
How old are you? (1 = 20-29, 2 = 30-39, 3 = 40 or over)
B
Children today are not as disciplined as when I was a child (1 = agree, 2 = disagree, 3 = I cannot tell)
C
Children today are not as fortunate as when I was a child (1 = agree, 2 = disagree, 3 = I cannot tell)
D
Religions should be taught at school (1 = agree, 2 = disagree, 3 = Indifferent)
Details
The data were collected from 23 participants at a workshop in Singapore in 1985
Source
Nishisato, S. and Nishisato, I.(1994). Dual Scaling in a Nutshell. Toronto: MicroStats.
References
Nishisato, S. (2007). Multidimensional Nonlinear Descriptive Analysis. Chapman & Hall/CRC.
Summary of Dual Scale analysis
Description
summary
method for class "dualScale"
Usage
## S3 method for class 'dualScale'
summary(object, ...)
Arguments
object |
An dualScale object for which a summary is desired |
... |
Arguments to be passed to methods |
Value
A summary of the available information from the object
See Also
Examples
summary(ds_cf(curricula))
summary(ds_cf(preferences))
summary(ds_mc(singaporean))
summary(ds_mcf(singaporean, crit = 1))
summary(ds_pc(christmas))
summary(ds_ro(goverment))