(Dis)similarity based brand maps (MDS)

mds(dataset, id1, id2, dis, method = "metric", nr_dim = 2,
  seed = 1234, data_filter = "", envir = parent.frame())

Arguments

dataset

Dataset

id1

A character variable or factor with unique entries

id2

A character variable or factor with unique entries

dis

A numeric measure of brand dissimilarity

method

Apply metric or non-metric MDS

nr_dim

Number of dimensions

seed

Random seed

data_filter

Expression entered in, e.g., Data > View to filter the dataset in Radiant. The expression should be a string (e.g., "price > 10000")

envir

Environment to extract data from

Value

A list of all variables defined in the function as an object of class mds

Details

See https://radiant-rstats.github.io/docs/multivariate/mds.html for an example in Radiant

See also

summary.mds to summarize results

plot.mds to plot results

Examples

mds(city, "from", "to", "distance") %>% str()
#> List of 19 #> $ res :List of 2 #> ..$ points: num [1:9, 1:2] -1349 -1199 -1077 -1227 -428 ... #> .. ..- attr(*, "dimnames")=List of 2 #> .. .. ..$ : chr [1:9] "Boston" "NY" "DC" "Miami" ... #> .. .. ..$ : NULL #> ..$ stress: num 0.0197 #> $ mds_dis_mat: 'dist' num [1:36] 206 429 1504 963 2976 ... #> ..- attr(*, "Labels")= chr [1:9] "Boston" "NY" "DC" "Miami" ... #> ..- attr(*, "Size")= int 9 #> ..- attr(*, "call")= language as.dist.default(m = .) #> ..- attr(*, "Diag")= logi FALSE #> ..- attr(*, "Upper")= logi FALSE #> $ nrObs : int 45 #> $ lower : num 36 #> $ nrLev : int 9 #> $ lab : chr [1:9] "Boston" "NY" "DC" "Miami" ... #> $ id2_dat : chr [1:45] "Boston" "NY" "DC" "Miami" ... #> $ id1_dat : chr [1:45] "Boston" "Boston" "Boston" "Boston" ... #> $ d : int [1:45] 0 206 429 1504 963 2976 3095 2979 1949 0 ... #> $ nr_na : int 0 #> $ init_row : int 45 #> $ df_name : chr "city" #> $ id1 : chr "from" #> $ id2 : chr "to" #> $ dis : chr "distance" #> $ method : chr "metric" #> $ nr_dim : num 2 #> $ seed : num 1234 #> $ data_filter: chr "" #> - attr(*, "class")= chr [1:2] "mds" "list"
mds(diamonds, "clarity", "cut", "price") %>% str()
#> 'mds' chr "Number of observations and unique IDs for the brand variable do not match.\nPlease choose other ID variables or"| __truncated__