ex3 <- read.sym.table(file = 'tsym1.csv', header=TRUE, sep=';',dec='.', row.names=1)
ex3
#> # A tibble: 7 × 7
#> F1 F2 F3 F4 F5 F6 F7
#> <dbl> <symblc_n> <symbl> <dbl> <symblc_> <symblc_n> <symblc_n>
#> 1 2.8 [1.00 : 2.00] <hist> 6 {a,d} [0.00 : 90.00] [9.00 : 24.00]
#> 2 1.4 [3.00 : 9.00] <hist> 8 {b,c,d} [-90.00 : 98.00] [-9.00 : 9.00]
#> 3 3.2 [-1.00 : 4.00] <hist> -7 {a,b} [65.00 : 90.00] [65.00 : 70.00]
#> 4 -2.1 [0.00 : 2.00] <hist> 0 {a,b,c,d} [45.00 : 89.00] [25.00 : 67.00]
#> 5 -3 [-4.00 : -2.00] <hist> -9.5 {b} [20.00 : 40.00] [9.00 : 40.00]
#> 6 0.1 [10.00 : 21.00] <hist> -1 {a,d} [5.00 : 8.00] [5.00 : 8.00]
#> 7 9 [4.00 : 21.00] <hist> 0.5 {a} [3.14 : 6.76] [4.00 : 6.00]##How to save a Symbolic Table in a CSV file with RSDA?
data(example3)
example3
#> # A tibble: 7 × 7
#> F1 F2 F3 F4 F5 F6
#> <dbl> <symblc_n> <symblc_m> <dbl> <symblc_> <symblc_n>
#> 1 2.8 [1.00 : 2.00] M1:0.10 M2:0.70 M3:0.20 6 {e,g,i,k} [0.00 : 90.00]
#> 2 1.4 [3.00 : 9.00] M1:0.60 M2:0.30 M3:0.10 8 {a,b,c,d} [-90.00 : 98.00]
#> 3 3.2 [-1.00 : 4.00] M1:0.20 M2:0.20 M3:0.60 -7 {2,b,1,c} [65.00 : 90.00]
#> 4 -2.1 [0.00 : 2.00] M1:0.90 M2:0.00 M3:0.10 0 {a,3,4,c} [45.00 : 89.00]
#> 5 -3 [-4.00 : -2.00] M1:0.60 M2:0.00 M3:0.40 -9.5 {e,g,i,k} [20.00 : 40.00]
#> 6 0.1 [10.00 : 21.00] M1:0.00 M2:0.70 M3:0.30 -1 {e,1,i} [5.00 : 8.00]
#> 7 9 [4.00 : 21.00] M1:0.20 M2:0.20 M3:0.60 0.5 {e,a,2} [3.14 : 6.76]
#> # ℹ 1 more variable: F7 <symblc_n>example3[2,]
#> # A tibble: 1 × 7
#> F1 F2 F3 F4 F5 F6
#> <dbl> <symblc_n> <symblc_m> <dbl> <symblc_s> <symblc_n>
#> 1 1.4 [3.00 : 9.00] M1:0.60 M2:0.30 M3:0.10 8 {a,b,c,d} [-90.00 : 98.00]
#> # ℹ 1 more variable: F7 <symblc_n>
example3[,3]
#> # A tibble: 7 × 1
#> F3
#> <symblc_m>
#> 1 M1:0.10 M2:0.70 M3:0.20
#> 2 M1:0.60 M2:0.30 M3:0.10
#> 3 M1:0.20 M2:0.20 M3:0.60
#> 4 M1:0.90 M2:0.00 M3:0.10
#> 5 M1:0.60 M2:0.00 M3:0.40
#> 6 M1:0.00 M2:0.70 M3:0.30
#> 7 M1:0.20 M2:0.20 M3:0.60
example3[2:3,5]
#> # A tibble: 2 × 1
#> F5
#> <symblc_s>
#> 1 {a,b,c,d}
#> 2 {2,b,1,c}
example3$F1
#> [1] 2.8 1.4 3.2 -2.1 -3.0 0.1 9.0data(ex1_db2so)
ex1_db2so
#> state sex county group age
#> 1 Florida M 2 6 3
#> 2 California F 4 3 4
#> 3 Texas M 12 3 4
#> 4 Florida F 2 3 4
#> 5 Texas M 4 6 4
#> 6 Texas F 2 3 3
#> 7 Florida M 6 3 4
#> 8 Florida F 2 6 4
#> 9 California M 2 3 6
#> 10 California F 21 3 4
#> 11 California M 2 3 4
#> 12 California M 2 6 7
#> 13 Texas F 23 3 4
#> 14 Florida M 2 3 4
#> 15 Florida F 12 7 4
#> 16 Texas M 2 3 8
#> 17 California F 3 7 9
#> 18 California M 2 3 11
#> 19 California M 1 3 11The classic.to.sym function allows to convert a
traditional table into a symbolic one, to this we must indicate the
following parameters.
x = a data.frameconcept = variables to be used as a conceptvariables = variables to be used, conceptible with
tidyselect optionsdefault.numeric = function that will be used by default
for numerical values (sym.interval)default.categorical = functions to be used by default
for categorical values (sym.model)result <- classic.to.sym(x = ex1_db2so,
concept = c(state, sex),
variables = c(county, group, age))
result
#> # A tibble: 6 × 3
#> county group age
#> <symblc_n> <symblc_n> <symblc_n>
#> 1 [3.00 : 21.00] [3.00 : 7.00] [4.00 : 9.00]
#> 2 [1.00 : 2.00] [3.00 : 6.00] [4.00 : 11.00]
#> 3 [2.00 : 12.00] [3.00 : 7.00] [4.00 : 4.00]
#> 4 [2.00 : 6.00] [3.00 : 6.00] [3.00 : 4.00]
#> 5 [2.00 : 23.00] [3.00 : 3.00] [3.00 : 4.00]
#> 6 [2.00 : 12.00] [3.00 : 6.00] [4.00 : 8.00]We can add new variables indicating the type we want them to be.
result <- classic.to.sym(x = ex1_db2so,
concept = c("state", "sex"),
variables = c(county, group, age),
age_hist = sym.histogram(age, breaks = pretty(ex1_db2so$age, 5)))
result
#> # A tibble: 6 × 4
#> age_hist county group age
#> <symblc_h> <symblc_n> <symblc_n> <symblc_n>
#> 1 <hist> [3.00 : 21.00] [3.00 : 7.00] [4.00 : 9.00]
#> 2 <hist> [1.00 : 2.00] [3.00 : 6.00] [4.00 : 11.00]
#> 3 <hist> [2.00 : 12.00] [3.00 : 7.00] [4.00 : 4.00]
#> 4 <hist> [2.00 : 6.00] [3.00 : 6.00] [3.00 : 4.00]
#> 5 <hist> [2.00 : 23.00] [3.00 : 3.00] [3.00 : 4.00]
#> 6 <hist> [2.00 : 12.00] [3.00 : 6.00] [4.00 : 8.00]data(USCrime)
head(USCrime)
#> state fold population householdsize racepctblack racePctWhite racePctAsian
#> 1 8 1 0.19 0.33 0.02 0.90 0.12
#> 2 53 1 0.00 0.16 0.12 0.74 0.45
#> 3 24 1 0.00 0.42 0.49 0.56 0.17
#> 4 34 1 0.04 0.77 1.00 0.08 0.12
#> 5 42 1 0.01 0.55 0.02 0.95 0.09
#> 6 6 1 0.02 0.28 0.06 0.54 1.00
#> racePctHisp agePct12t21 agePct12t29 agePct16t24 agePct65up numbUrban pctUrban
#> 1 0.17 0.34 0.47 0.29 0.32 0.20 1.0
#> 2 0.07 0.26 0.59 0.35 0.27 0.02 1.0
#> 3 0.04 0.39 0.47 0.28 0.32 0.00 0.0
#> 4 0.10 0.51 0.50 0.34 0.21 0.06 1.0
#> 5 0.05 0.38 0.38 0.23 0.36 0.02 0.9
#> 6 0.25 0.31 0.48 0.27 0.37 0.04 1.0
#> medIncome pctWWage pctWFarmSelf pctWInvInc pctWSocSec pctWPubAsst pctWRetire
#> 1 0.37 0.72 0.34 0.60 0.29 0.15 0.43
#> 2 0.31 0.72 0.11 0.45 0.25 0.29 0.39
#> 3 0.30 0.58 0.19 0.39 0.38 0.40 0.84
#> 4 0.58 0.89 0.21 0.43 0.36 0.20 0.82
#> 5 0.50 0.72 0.16 0.68 0.44 0.11 0.71
#> 6 0.52 0.68 0.20 0.61 0.28 0.15 0.25
#> medFamInc perCapInc whitePerCap blackPerCap indianPerCap AsianPerCap
#> 1 0.39 0.40 0.39 0.32 0.27 0.27
#> 2 0.29 0.37 0.38 0.33 0.16 0.30
#> 3 0.28 0.27 0.29 0.27 0.07 0.29
#> 4 0.51 0.36 0.40 0.39 0.16 0.25
#> 5 0.46 0.43 0.41 0.28 0.00 0.74
#> 6 0.62 0.72 0.76 0.77 0.28 0.52
#> OtherPerCap HispPerCap NumUnderPov PctPopUnderPov PctLess9thGrade
#> 1 0.36 0.41 0.08 0.19 0.10
#> 2 0.22 0.35 0.01 0.24 0.14
#> 3 0.28 0.39 0.01 0.27 0.27
#> 4 0.36 0.44 0.01 0.10 0.09
#> 5 0.51 0.48 0.00 0.06 0.25
#> 6 0.48 0.60 0.01 0.12 0.13
#> PctNotHSGrad PctBSorMore PctUnemployed PctEmploy PctEmplManu PctEmplProfServ
#> 1 0.18 0.48 0.27 0.68 0.23 0.41
#> 2 0.24 0.30 0.27 0.73 0.57 0.15
#> 3 0.43 0.19 0.36 0.58 0.32 0.29
#> 4 0.25 0.31 0.33 0.71 0.36 0.45
#> 5 0.30 0.33 0.12 0.65 0.67 0.38
#> 6 0.12 0.80 0.10 0.65 0.19 0.77
#> PctOccupManu PctOccupMgmtProf MalePctDivorce MalePctNevMarr FemalePctDiv
#> 1 0.25 0.52 0.68 0.40 0.75
#> 2 0.42 0.36 1.00 0.63 0.91
#> 3 0.49 0.32 0.63 0.41 0.71
#> 4 0.37 0.39 0.34 0.45 0.49
#> 5 0.42 0.46 0.22 0.27 0.20
#> 6 0.06 0.91 0.49 0.57 0.61
#> TotalPctDiv PersPerFam PctFam2Par PctKids2Par PctYoungKids2Par PctTeen2Par
#> 1 0.75 0.35 0.55 0.59 0.61 0.56
#> 2 1.00 0.29 0.43 0.47 0.60 0.39
#> 3 0.70 0.45 0.42 0.44 0.43 0.43
#> 4 0.44 0.75 0.65 0.54 0.83 0.65
#> 5 0.21 0.51 0.91 0.91 0.89 0.85
#> 6 0.58 0.44 0.62 0.69 0.87 0.53
#> PctWorkMomYoungKids PctWorkMom NumIlleg PctIlleg NumImmig PctImmigRecent
#> 1 0.74 0.76 0.04 0.14 0.03 0.24
#> 2 0.46 0.53 0.00 0.24 0.01 0.52
#> 3 0.71 0.67 0.01 0.46 0.00 0.07
#> 4 0.85 0.86 0.03 0.33 0.02 0.11
#> 5 0.40 0.60 0.00 0.06 0.00 0.03
#> 6 0.30 0.43 0.00 0.11 0.04 0.30
#> PctImmigRec5 PctImmigRec8 PctImmigRec10 PctRecentImmig PctRecImmig5
#> 1 0.27 0.37 0.39 0.07 0.07
#> 2 0.62 0.64 0.63 0.25 0.27
#> 3 0.06 0.15 0.19 0.02 0.02
#> 4 0.20 0.30 0.31 0.05 0.08
#> 5 0.07 0.20 0.27 0.01 0.02
#> 6 0.35 0.43 0.47 0.50 0.50
#> PctRecImmig8 PctRecImmig10 PctSpeakEnglOnly PctNotSpeakEnglWell
#> 1 0.08 0.08 0.89 0.06
#> 2 0.25 0.23 0.84 0.10
#> 3 0.04 0.05 0.88 0.04
#> 4 0.11 0.11 0.81 0.08
#> 5 0.04 0.05 0.88 0.05
#> 6 0.56 0.57 0.45 0.28
#> PctLargHouseFam PctLargHouseOccup PersPerOccupHous PersPerOwnOccHous
#> 1 0.14 0.13 0.33 0.39
#> 2 0.16 0.10 0.17 0.29
#> 3 0.20 0.20 0.46 0.52
#> 4 0.56 0.62 0.85 0.77
#> 5 0.16 0.19 0.59 0.60
#> 6 0.25 0.19 0.29 0.53
#> PersPerRentOccHous PctPersOwnOccup PctPersDenseHous PctHousLess3BR MedNumBR
#> 1 0.28 0.55 0.09 0.51 0.5
#> 2 0.17 0.26 0.20 0.82 0.0
#> 3 0.43 0.42 0.15 0.51 0.5
#> 4 1.00 0.94 0.12 0.01 0.5
#> 5 0.37 0.89 0.02 0.19 0.5
#> 6 0.18 0.39 0.26 0.73 0.0
#> HousVacant PctHousOccup PctHousOwnOcc PctVacantBoarded PctVacMore6Mos
#> 1 0.21 0.71 0.52 0.05 0.26
#> 2 0.02 0.79 0.24 0.02 0.25
#> 3 0.01 0.86 0.41 0.29 0.30
#> 4 0.01 0.97 0.96 0.60 0.47
#> 5 0.01 0.89 0.87 0.04 0.55
#> 6 0.02 0.84 0.30 0.16 0.28
#> MedYrHousBuilt PctHousNoPhone PctWOFullPlumb OwnOccLowQuart OwnOccMedVal
#> 1 0.65 0.14 0.06 0.22 0.19
#> 2 0.65 0.16 0.00 0.21 0.20
#> 3 0.52 0.47 0.45 0.18 0.17
#> 4 0.52 0.11 0.11 0.24 0.21
#> 5 0.73 0.05 0.14 0.31 0.31
#> 6 0.25 0.02 0.05 0.94 1.00
#> OwnOccHiQuart RentLowQ RentMedian RentHighQ MedRent MedRentPctHousInc
#> 1 0.18 0.36 0.35 0.38 0.34 0.38
#> 2 0.21 0.42 0.38 0.40 0.37 0.29
#> 3 0.16 0.27 0.29 0.27 0.31 0.48
#> 4 0.19 0.75 0.70 0.77 0.89 0.63
#> 5 0.30 0.40 0.36 0.38 0.38 0.22
#> 6 1.00 0.67 0.63 0.68 0.62 0.47
#> MedOwnCostPctInc MedOwnCostPctIncNoMtg NumInShelters NumStreet PctForeignBorn
#> 1 0.46 0.25 0.04 0 0.12
#> 2 0.32 0.18 0.00 0 0.21
#> 3 0.39 0.28 0.00 0 0.14
#> 4 0.51 0.47 0.00 0 0.19
#> 5 0.51 0.21 0.00 0 0.11
#> 6 0.59 0.11 0.00 0 0.70
#> PctBornSameState PctSameHouse85 PctSameCity85 PctSameState85 LandArea PopDens
#> 1 0.42 0.50 0.51 0.64 0.12 0.26
#> 2 0.50 0.34 0.60 0.52 0.02 0.12
#> 3 0.49 0.54 0.67 0.56 0.01 0.21
#> 4 0.30 0.73 0.64 0.65 0.02 0.39
#> 5 0.72 0.64 0.61 0.53 0.04 0.09
#> 6 0.42 0.49 0.73 0.64 0.01 0.58
#> PctUsePubTrans LemasPctOfficDrugUn ViolentCrimesPerPop
#> 1 0.20 0.32 0.20
#> 2 0.45 0.00 0.67
#> 3 0.02 0.00 0.43
#> 4 0.28 0.00 0.12
#> 5 0.02 0.00 0.03
#> 6 0.10 0.00 0.14result <- classic.to.sym(x = USCrime,
concept = state,
variables= c(NumInShelters,
NumImmig,
ViolentCrimesPerPop),
ViolentCrimesPerPop_hist = sym.histogram(ViolentCrimesPerPop,
breaks = pretty(USCrime$ViolentCrimesPerPop,5)))
result
#> # A tibble: 46 × 4
#> ViolentCrimesPerPop_hist NumInShelters NumImmig ViolentCrimesPerPop
#> <symblc_h> <symblc_n> <symblc_n> <symblc_n>
#> 1 <hist> [0.00 : 0.32] [0.00 : 0.04] [0.01 : 1.00]
#> 2 <hist> [0.01 : 0.18] [0.01 : 0.09] [0.05 : 0.36]
#> 3 <hist> [0.00 : 1.00] [0.00 : 0.57] [0.05 : 0.57]
#> 4 <hist> [0.00 : 0.08] [0.00 : 0.02] [0.02 : 1.00]
#> 5 <hist> [0.00 : 1.00] [0.00 : 1.00] [0.01 : 1.00]
#> 6 <hist> [0.00 : 0.68] [0.00 : 0.23] [0.07 : 0.75]
#> 7 <hist> [0.00 : 0.79] [0.00 : 0.14] [0.00 : 0.94]
#> 8 <hist> [0.01 : 0.01] [0.01 : 0.01] [0.37 : 0.37]
#> 9 <hist> [1.00 : 1.00] [0.39 : 0.39] [1.00 : 1.00]
#> 10 <hist> [0.00 : 0.52] [0.00 : 1.00] [0.06 : 1.00]
#> # ℹ 36 more rowsdata("ex_mcfa1")
head(ex_mcfa1)
#> suspect age hair eyes region
#> 1 1 42 h_red e_brown Bronx
#> 2 2 20 h_black e_green Bronx
#> 3 3 64 h_brown e_brown Brooklyn
#> 4 4 55 h_blonde e_brown Bronx
#> 5 5 4 h_brown e_green Manhattan
#> 6 6 61 h_blonde e_green Bronxsym.table <- classic.to.sym(x = ex_mcfa1,
concept = suspect,
variables=c(hair,
eyes,
region),
default.categorical = sym.set)
sym.table
#> # A tibble: 100 × 3
#> hair eyes region
#> <symblc_s> <symblc_s> <symblc_s>
#> 1 {h_red} {e_brown,e_black} {Bronx}
#> 2 {h_black,h_blonde} {e_green,e_black} {Bronx,Manhattan}
#> 3 {h_brown,h_white} {e_brown,e_green} {Brooklyn,Queens}
#> 4 {h_blonde} {e_brown,e_black} {Bronx,Manhattan}
#> 5 {h_brown,h_red} {e_green} {Manhattan,Bronx}
#> 6 {h_blonde,h_white} {e_green,e_blue} {Bronx,Queens}
#> 7 {h_white,h_red} {e_black,e_blue} {Queens,Bronx}
#> 8 {h_blonde,h_white} {e_brown,e_black} {Manhattan,Brooklyn}
#> 9 {h_blonde,h_white} {e_black,e_brown} {Brooklyn,Bronx}
#> 10 {h_brown,h_black} {e_brown,e_green} {Manhattan,Bronx}
#> # ℹ 90 more rowsWe can modify the function that will be applied by default to the categorical variables
sym.table <- classic.to.sym(x = ex_mcfa1,
concept = suspect,
default.categorical = sym.set)
sym.table
#> # A tibble: 100 × 4
#> age hair eyes region
#> <symblc_n> <symblc_s> <symblc_s> <symblc_s>
#> 1 [22.00 : 42.00] {h_red} {e_brown,e_black} {Bronx}
#> 2 [20.00 : 57.00] {h_black,h_blonde} {e_green,e_black} {Bronx,Manhattan}
#> 3 [29.00 : 64.00] {h_brown,h_white} {e_brown,e_green} {Brooklyn,Queens}
#> 4 [14.00 : 55.00] {h_blonde} {e_brown,e_black} {Bronx,Manhattan}
#> 5 [4.00 : 47.00] {h_brown,h_red} {e_green} {Manhattan,Bronx}
#> 6 [32.00 : 61.00] {h_blonde,h_white} {e_green,e_blue} {Bronx,Queens}
#> 7 [49.00 : 61.00] {h_white,h_red} {e_black,e_blue} {Queens,Bronx}
#> 8 [8.00 : 32.00] {h_blonde,h_white} {e_brown,e_black} {Manhattan,Brooklyn}
#> 9 [39.00 : 67.00] {h_blonde,h_white} {e_black,e_brown} {Brooklyn,Bronx}
#> 10 [50.00 : 68.00] {h_brown,h_black} {e_brown,e_green} {Manhattan,Bronx}
#> # ℹ 90 more rowshani3101 <- SDS.to.RSDA(file.path = "hani3101.sds")
#> Preprocessing file
#> Converting data to JSON format
#> Processing variable 1: R3101
#> Processing variable 2: RNINO12
#> Processing variable 3: RNINO3
#> Processing variable 4: RNINO4
#> Processing variable 5: RNINO34
#> Processing variable 6: RSOI
hani3101
#> # A tibble: 32 × 6
#> R3101 RNINO12
#> <symblc_m> <symblc_m>
#> 1 X2:0.21 X4:0.18 X3:0.15 X5:... X1:0.17 X2:0.83 X3:0.00
#> 2 X2:0.30 X4:0.14 X3:0.19 X5:... X1:0.00 X2:0.25 X3:0.75
#> 3 X2:0.16 X4:0.12 X3:0.20 X5:... X1:0.67 X2:0.33 X3:0.00
#> 4 X2:0.13 X4:0.15 X3:0.22 X5:... X1:0.17 X2:0.83 X3:0.00
#> 5 X2:0.14 X4:0.14 X3:0.18 X5:... X1:0.42 X2:0.58 X3:0.00
#> 6 X2:0.26 X4:0.06 X3:0.23 X5:... X1:0.00 X2:0.67 X3:0.33
#> 7 X2:0.28 X4:0.14 X3:0.10 X5:... X1:0.00 X2:1.00 X3:0.00
#> 8 X2:0.25 X4:0.15 X3:0.19 X5:... X1:0.00 X2:1.00 X3:0.00
#> 9 X2:0.20 X4:0.15 X3:0.19 X5:... X1:0.00 X2:1.00 X3:0.00
#> 10 X2:0.21 X4:0.16 X3:0.31 X5:... X1:0.08 X2:0.92 X3:0.00
#> # ℹ 22 more rows
#> # ℹ 4 more variables: RNINO3 <symblc_m>, RNINO4 <symblc_m>, RNINO34 <symblc_m>,
#> # RSOI <symblc_m>abalone <- SODAS.to.RSDA("abalone.xml")
#> Processing variable 1: LENGTH
#> Processing variable 2: DIAMETER
#> Processing variable 3: HEIGHT
#> Processing variable 4: WHOLE_WEIGHT
#> Processing variable 5: SHUCKED_WEIGHT
#> Processing variable 6: VISCERA_WEIGHT
#> Processing variable 7: SHELL_WEIGHT
abalone
#> # A tibble: 24 × 7
#> LENGTH DIAMETER HEIGHT WHOLE_WEIGHT SHUCKED_WEIGHT
#> <symblc_n> <symblc_n> <symblc_n> <symblc_n> <symblc_n>
#> 1 [0.28 : 0.66] [0.20 : 0.48] [0.07 : 0.18] [0.08 : 1.37] [0.03 : 0.64]
#> 2 [0.30 : 0.74] [0.22 : 0.58] [0.02 : 1.13] [0.15 : 2.25] [0.06 : 1.16]
#> 3 [0.34 : 0.78] [0.26 : 0.63] [0.06 : 0.23] [0.20 : 2.66] [0.07 : 1.49]
#> 4 [0.39 : 0.82] [0.30 : 0.65] [0.10 : 0.25] [0.26 : 2.51] [0.11 : 1.23]
#> 5 [0.40 : 0.74] [0.32 : 0.60] [0.10 : 0.24] [0.35 : 2.20] [0.12 : 0.84]
#> 6 [0.45 : 0.80] [0.38 : 0.63] [0.14 : 0.22] [0.64 : 2.53] [0.16 : 0.93]
#> 7 [0.49 : 0.72] [0.36 : 0.58] [0.12 : 0.21] [0.68 : 2.12] [0.16 : 0.82]
#> 8 [0.55 : 0.70] [0.46 : 0.58] [0.18 : 0.22] [1.21 : 1.81] [0.32 : 0.71]
#> 9 [0.08 : 0.24] [0.06 : 0.18] [0.01 : 0.06] [0.00 : 0.07] [0.00 : 0.03]
#> 10 [0.13 : 0.58] [0.10 : 0.45] [0.00 : 0.15] [0.01 : 0.89] [0.00 : 0.50]
#> # ℹ 14 more rows
#> # ℹ 2 more variables: VISCERA_WEIGHT <symblc_n>, SHELL_WEIGHT <symblc_n>var(example3[,1])
#> [1] 15.98238
var(example3[,2])
#> [1] 90.66667
var(example3$F6)
#> [1] 1872.358
var(example3$F6, method = 'interval')
#> <symbolic_interval[1]>
#> [1] [2,408.97 : 1,670.51]
var(example3$F6, method = 'billard')
#> [1] 1355.143
sd(example3$F1)
#> [1] 3.997797
sd(example3$F2)
#> [1] 6.733003
sd(example3$F6)
#> [1] 30.59704
sd(example3$F6, method = 'interval')
#> <symbolic_interval[1]>
#> [1] [49.08 : 40.87]
sd(example3$F6, method = 'billard')
#> [1] 36.81226library(ggpolypath)
#> Loading required package: ggplot2
data(oils)
oils <- RSDA:::to.v3(RSDA:::to.v2(oils))
sym.radar.plot(oils[2:3,])
#> Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
#> the caller; using TRUE
#> Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
#> the caller; using TRUE
#> Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
#> the caller; using TRUE
#> Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
#> the caller; using TRUE
#> Warning: The `size` argument of `element_line()` is deprecated as of ggplot2 3.4.0.
#> ℹ Please use the `linewidth` argument instead.
#> ℹ The deprecated feature was likely used in the RSDA package.
#> Please report the issue to the authors.
#> This warning is displayed once per session.
#> Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
#> generated.
#> Warning in ggplot2::geom_text(ggplot2::aes(x = 0.5, y = 0, label = round(min(real.value), : All aesthetics have length 1, but the data has 20 rows.
#> ℹ Please consider using `annotate()` or provide this layer with data containing
#> a single row.
#> Warning in ggplot2::geom_text(ggplot2::aes(x = 0.5, y = 0.25, label = inverse.rescale(0.25, : All aesthetics have length 1, but the data has 20 rows.
#> ℹ Please consider using `annotate()` or provide this layer with data containing
#> a single row.
#> Warning in ggplot2::geom_text(ggplot2::aes(x = 0.5, y = 0.5, label = inverse.rescale(0.5, : All aesthetics have length 1, but the data has 20 rows.
#> ℹ Please consider using `annotate()` or provide this layer with data containing
#> a single row.
#> Warning in ggplot2::geom_text(ggplot2::aes(x = 0.5, y = 0.75, label = inverse.rescale(0.75, : All aesthetics have length 1, but the data has 20 rows.
#> ℹ Please consider using `annotate()` or provide this layer with data containing
#> a single row.
#> Warning in ggplot2::geom_text(ggplot2::aes(x = 0.5, y = 1, label = round(max(real.value), : All aesthetics have length 1, but the data has 20 rows.
#> ℹ Please consider using `annotate()` or provide this layer with data containing
#> a single row.sym.radar.plot(oils[2:5,])
#> Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
#> the caller; using TRUE
#> Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
#> the caller; using TRUE
#> Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
#> the caller; using TRUE
#> Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
#> the caller; using TRUE
#> Warning in ggplot2::geom_text(ggplot2::aes(x = 0.5, y = 0, label = round(min(real.value), : All aesthetics have length 1, but the data has 40 rows.
#> ℹ Please consider using `annotate()` or provide this layer with data containing
#> a single row.
#> Warning in ggplot2::geom_text(ggplot2::aes(x = 0.5, y = 0.25, label = inverse.rescale(0.25, : All aesthetics have length 1, but the data has 40 rows.
#> ℹ Please consider using `annotate()` or provide this layer with data containing
#> a single row.
#> Warning in ggplot2::geom_text(ggplot2::aes(x = 0.5, y = 0.5, label = inverse.rescale(0.5, : All aesthetics have length 1, but the data has 40 rows.
#> ℹ Please consider using `annotate()` or provide this layer with data containing
#> a single row.
#> Warning in ggplot2::geom_text(ggplot2::aes(x = 0.5, y = 0.75, label = inverse.rescale(0.75, : All aesthetics have length 1, but the data has 40 rows.
#> ℹ Please consider using `annotate()` or provide this layer with data containing
#> a single row.
#> Warning in ggplot2::geom_text(ggplot2::aes(x = 0.5, y = 1, label = round(max(real.value), : All aesthetics have length 1, but the data has 40 rows.
#> ℹ Please consider using `annotate()` or provide this layer with data containing
#> a single row.res
#> $frequency
#> [1] 25 49 1 25
#>
#> $histogram
#> [,1]
#> [1,] 0.7
#> [2,] 1.9
#> [3,] 3.1
#> [4,] 4.3
res <- interval.histogram.plot(oils[,3],
n.bins = 3,
main = "Histogram",
col = c(2, 3, 4))data("oils")
DM <- sym.dist.interval(sym.data = oils[,1:4],
method = "Gowda.Diday")
model <- hclust(DM)
plot(model, hang = -1)data(int_prost_train)
data(int_prost_test)
res.cm <- sym.lm(formula = lpsa~., sym.data = int_prost_train, method = 'cm')
res.cm
#>
#> Call:
#> stats::lm(formula = formula, data = centers)
#>
#> Coefficients:
#> (Intercept) lcavol lweight age lbph svi
#> 0.411537 0.579327 0.614128 -0.018659 0.143918 0.730937
#> lcp gleason pgg45
#> -0.205536 -0.030924 0.009507RMSE.L(int_prost_test$lpsa, pred.cm$Fitted)
#> [1] 0.7229999
RMSE.U(int_prost_test$lpsa, pred.cm$Fitted)
#> [1] 0.7192467
R2.L(int_prost_test$lpsa, pred.cm$Fitted)
#> [1] 0.501419
R2.U(int_prost_test$lpsa, pred.cm$Fitted)
#> [1] 0.5058389
deter.coefficient(int_prost_test$lpsa, pred.cm$Fitted)
#> [1] 0.4962964RMSE.L(int_prost_test$lpsa,pred.cm.lasso)
#> [1] 0.706699
RMSE.U(int_prost_test$lpsa,pred.cm.lasso)
#> [1] 0.7033206
R2.L(int_prost_test$lpsa,pred.cm.lasso)
#> [1] 0.5236074
R2.U(int_prost_test$lpsa,pred.cm.lasso)
#> [1] 0.5276086
deter.coefficient(int_prost_test$lpsa, pred.cm.lasso)
#> [1] 0.4929714RMSE.L(int_prost_test$lpsa, pred.cm.ridge)
#> [1] 0.703543
RMSE.U(int_prost_test$lpsa, pred.cm.ridge)
#> [1] 0.7004145
R2.L(int_prost_test$lpsa, pred.cm.ridge)
#> [1] 0.5286114
R2.U(int_prost_test$lpsa, pred.cm.ridge)
#> [1] 0.5322683
deter.coefficient(int_prost_test$lpsa, pred.cm.ridge)
#> [1] 0.4808652data("ex_mcfa1")
ex_mcfa1
#> suspect age hair eyes region
#> 1 1 42 h_red e_brown Bronx
#> 2 2 20 h_black e_green Bronx
#> 3 3 64 h_brown e_brown Brooklyn
#> 4 4 55 h_blonde e_brown Bronx
#> 5 5 4 h_brown e_green Manhattan
#> 6 6 61 h_blonde e_green Bronx
#> 7 7 61 h_white e_black Queens
#> 8 8 32 h_blonde e_brown Manhattan
#> 9 9 39 h_blonde e_black Brooklyn
#> 10 10 50 h_brown e_brown Manhattan
#> 11 11 41 h_red e_blue Manhattan
#> 12 12 35 h_blonde e_green Brooklyn
#> 13 13 56 h_blonde e_brown Bronx
#> 14 14 52 h_red e_brown Queens
#> 15 15 55 h_red e_green Brooklyn
#> 16 16 25 h_brown e_brown Queens
#> 17 17 52 h_blonde e_brown Brooklyn
#> 18 18 28 h_red e_brown Manhattan
#> 19 19 21 h_white e_blue Manhattan
#> 20 20 66 h_black e_black Brooklyn
#> 21 21 67 h_blonde e_brown Queens
#> 22 22 13 h_white e_blue Brooklyn
#> 23 23 39 h_brown e_green Manhattan
#> 24 24 47 h_black e_green Brooklyn
#> 25 25 54 h_blonde e_brown Bronx
#> 26 26 75 h_brown e_blue Brooklyn
#> 27 27 3 h_white e_green Manhattan
#> 28 28 40 h_white e_green Manhattan
#> 29 29 58 h_red e_blue Queens
#> 30 30 41 h_brown e_green Bronx
#> 31 31 25 h_white e_black Brooklyn
#> 32 32 75 h_blonde e_blue Manhattan
#> 33 33 58 h_white e_brown Bronx
#> 34 34 61 h_white e_brown Manhattan
#> 35 35 52 h_white e_blue Bronx
#> 36 36 19 h_red e_black Queens
#> 37 37 58 h_red e_black Bronx
#> 38 38 46 h_black e_green Manhattan
#> 39 39 74 h_brown e_black Manhattan
#> 40 40 26 h_blonde e_brown Brooklyn
#> 41 41 63 h_blonde e_blue Queens
#> 42 42 40 h_brown e_black Queens
#> 43 43 65 h_black e_brown Brooklyn
#> 44 44 51 h_blonde e_brown Brooklyn
#> 45 45 15 h_white e_black Brooklyn
#> 46 46 32 h_blonde e_brown Bronx
#> 47 47 68 h_white e_black Manhattan
#> 48 48 51 h_white e_black Queens
#> 49 49 14 h_red e_green Queens
#> 50 50 72 h_white e_brown Brooklyn
#> 51 51 7 h_red e_blue Brooklyn
#> 52 52 22 h_red e_brown Bronx
#> 53 53 52 h_red e_brown Brooklyn
#> 54 54 62 h_brown e_green Bronx
#> 55 55 41 h_black e_brown Queens
#> 56 56 32 h_black e_black Manhattan
#> 57 57 58 h_brown e_brown Queens
#> 58 58 25 h_black e_brown Queens
#> 59 59 70 h_blonde e_green Brooklyn
#> 60 60 64 h_brown e_blue Queens
#> 61 61 25 h_white e_blue Bronx
#> 62 62 42 h_black e_black Brooklyn
#> 63 63 56 h_red e_black Brooklyn
#> 64 64 41 h_blonde e_black Brooklyn
#> 65 65 8 h_white e_black Manhattan
#> 66 66 7 h_black e_green Brooklyn
#> 67 67 42 h_white e_brown Queens
#> 68 68 10 h_white e_blue Manhattan
#> 69 69 60 h_brown e_black Bronx
#> 70 70 52 h_blonde e_brown Brooklyn
#> 71 71 39 h_brown e_blue Manhattan
#> 72 72 69 h_brown e_green Queens
#> 73 73 67 h_blonde e_green Manhattan
#> 74 74 46 h_red e_black Brooklyn
#> 75 75 72 h_black e_black Queens
#> 76 76 66 h_red e_blue Queens
#> 77 77 4 h_black e_blue Manhattan
#> 78 78 62 h_black e_green Brooklyn
#> 79 79 10 h_blonde e_blue Bronx
#> 80 80 16 h_blonde e_black Manhattan
#> 81 81 59 h_blonde e_brown Bronx
#> 82 82 63 h_blonde e_blue Manhattan
#> 83 83 54 h_red e_blue Queens
#> 84 84 14 h_brown e_blue Brooklyn
#> 85 85 48 h_black e_green Manhattan
#> 86 86 59 h_blonde e_black Bronx
#> 87 87 73 h_blonde e_black Bronx
#> 88 88 51 h_brown e_brown Bronx
#> 89 89 14 h_white e_black Bronx
#> 90 90 58 h_blonde e_black Queens
#> 91 91 56 h_red e_green Manhattan
#> 92 92 26 h_red e_blue Brooklyn
#> 93 93 59 h_brown e_black Manhattan
#> 94 94 27 h_white e_green Manhattan
#> 95 95 38 h_black e_green Manhattan
#> 96 96 5 h_blonde e_green Bronx
#> 97 97 14 h_black e_blue Queens
#> 98 98 13 h_black e_brown Manhattan
#> 99 99 54 h_white e_blue Brooklyn
#> 100 100 66 h_white e_green Manhattan
#> 101 1 22 h_red e_black Bronx
#> 102 2 57 h_blonde e_black Manhattan
#> 103 3 29 h_white e_green Queens
#> 104 4 14 h_blonde e_black Manhattan
#> 105 5 47 h_red e_green Bronx
#> 106 6 32 h_white e_blue Queens
#> 107 7 49 h_red e_blue Bronx
#> 108 8 8 h_white e_black Brooklyn
#> 109 9 67 h_white e_brown Bronx
#> 110 10 68 h_black e_green Bronx
#> 111 11 15 h_black e_brown Manhattan
#> 112 12 46 h_white e_brown Bronx
#> 113 13 68 h_white e_black Manhattan
#> 114 14 55 h_blonde e_blue Manhattan
#> 115 15 7 h_white e_green Bronx
#> 116 16 10 h_black e_brown Brooklyn
#> 117 17 49 h_red e_blue Manhattan
#> 118 18 12 h_brown e_blue Brooklyn
#> 119 19 41 h_white e_blue Bronx
#> 120 20 10 h_brown e_blue Bronx
#> 121 21 12 h_white e_green Manhattan
#> 122 22 53 h_white e_blue Manhattan
#> 123 23 5 h_black e_black Manhattan
#> 124 24 46 h_brown e_black Queens
#> 125 25 14 h_brown e_black Queens
#> 126 26 55 h_white e_green Brooklyn
#> 127 27 53 h_red e_brown Manhattan
#> 128 28 31 h_black e_brown Manhattan
#> 129 29 31 h_blonde e_brown Queens
#> 130 30 55 h_brown e_black Brooklynsym.table <- classic.to.sym(x = ex_mcfa1,
concept = suspect,
default.categorical = sym.set)
sym.table
#> # A tibble: 100 × 4
#> age hair eyes region
#> <symblc_n> <symblc_s> <symblc_s> <symblc_s>
#> 1 [22.00 : 42.00] {h_red} {e_brown,e_black} {Bronx}
#> 2 [20.00 : 57.00] {h_black,h_blonde} {e_green,e_black} {Bronx,Manhattan}
#> 3 [29.00 : 64.00] {h_brown,h_white} {e_brown,e_green} {Brooklyn,Queens}
#> 4 [14.00 : 55.00] {h_blonde} {e_brown,e_black} {Bronx,Manhattan}
#> 5 [4.00 : 47.00] {h_brown,h_red} {e_green} {Manhattan,Bronx}
#> 6 [32.00 : 61.00] {h_blonde,h_white} {e_green,e_blue} {Bronx,Queens}
#> 7 [49.00 : 61.00] {h_white,h_red} {e_black,e_blue} {Queens,Bronx}
#> 8 [8.00 : 32.00] {h_blonde,h_white} {e_brown,e_black} {Manhattan,Brooklyn}
#> 9 [39.00 : 67.00] {h_blonde,h_white} {e_black,e_brown} {Brooklyn,Bronx}
#> 10 [50.00 : 68.00] {h_brown,h_black} {e_brown,e_green} {Manhattan,Bronx}
#> # ℹ 90 more rowsres <- sym.mcfa(sym.table, c(2,3))
mcfa.scatterplot(res[,2], res[,3], sym.data = sym.table, pos.var = c(2,3))
#> Warning: Using `size` aesthetic for lines was deprecated in ggplot2 3.4.0.
#> ℹ Please use `linewidth` instead.
#> ℹ The deprecated feature was likely used in the RSDA package.
#> Please report the issue to the authors.
#> This warning is displayed once per session.
#> Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
#> generated.res <- sym.mcfa(sym.table, c(2,3,4))
mcfa.scatterplot(res[,2], res[,3], sym.data = sym.table, pos.var = c(2,3,4))datos <- oils
datos
#> # A tibble: 8 × 4
#> GRA FRE IOD SAP
#> * <symblc_n> <symblc_n> <symblc_n> <symblc_n>
#> 1 [0.93 : 0.94] [-27.00 : -18.00] [170.00 : 204.00] [118.00 : 196.00]
#> 2 [0.93 : 0.94] [-5.00 : -4.00] [192.00 : 208.00] [188.00 : 197.00]
#> 3 [0.92 : 0.92] [-6.00 : -1.00] [99.00 : 113.00] [189.00 : 198.00]
#> 4 [0.92 : 0.93] [-6.00 : -4.00] [104.00 : 116.00] [187.00 : 193.00]
#> 5 [0.92 : 0.92] [-25.00 : -15.00] [80.00 : 82.00] [189.00 : 193.00]
#> 6 [0.91 : 0.92] [0.00 : 6.00] [79.00 : 90.00] [187.00 : 196.00]
#> 7 [0.86 : 0.87] [30.00 : 38.00] [40.00 : 48.00] [190.00 : 199.00]
#> 8 [0.86 : 0.86] [22.00 : 32.00] [53.00 : 77.00] [190.00 : 202.00]x <- sym.umap(datos)
x
#> V1 V2 V3 V4
#> 1 -8.751782 1.542271 17.467042 1.0669278
#> 2 -8.876359 1.666844 17.591624 1.1915015
#> 3 -8.836783 1.627269 17.552026 1.1519324
#> 4 -8.889486 1.679969 17.604756 1.2046265
#> 5 -9.048654 1.839133 17.763930 1.3637953
#> 6 -8.781267 1.571749 17.496557 1.0963996
#> 7 -8.852698 1.643181 17.568000 1.1678273
#> 8 -8.919906 1.710391 17.635228 1.2350235
#> 9 -7.895246 -1.223372 -6.141848 -11.0056725
#> 10 -7.845486 -1.230216 -6.117850 -10.9482121
#> 11 -7.632528 -1.316397 -6.140101 -10.8154638
#> 12 -7.813311 -1.181311 -5.993657 -11.0062708
#> 13 -7.847129 -1.314129 -6.326795 -10.9468382
#> 14 -7.810412 -1.332573 -6.263608 -10.9052233
#> 15 -7.740685 -1.210059 -6.445559 -10.8333723
#> 16 -7.649179 -1.285735 -6.310016 -10.7946802
#> 17 -6.747090 -1.269944 -5.442957 -10.4203548
#> 18 -6.853203 -1.394123 -5.448552 -10.7152331
#> 19 -6.737892 -1.209002 -5.538849 -10.6056379
#> 20 -6.820077 -1.247323 -5.555833 -10.8417644
#> 21 -6.856257 -1.311292 -5.373602 -10.3686997
#> 22 -6.788466 -1.548474 -5.175546 -10.7125476
#> 23 -6.818458 -1.464941 -5.250845 -10.4178597
#> 24 -6.815853 -1.487267 -5.208363 -10.6850082
#> 25 -6.984177 -1.606477 -5.912224 -10.4688255
#> 26 -6.999631 -1.456382 -5.882553 -10.7314111
#> 27 -7.137231 -1.665714 -5.906868 -10.7106675
#> 28 -6.971808 -1.538396 -5.907013 -10.5928186
#> 29 -6.926436 -1.695704 -5.918763 -10.3117762
#> 30 -7.015673 -1.707712 -5.678913 -10.5642059
#> 31 -7.120305 -1.855901 -5.710221 -10.4582141
#> 32 -6.979787 -1.635059 -5.783295 -10.6564666
#> 33 -6.320929 -2.970591 -2.085541 4.5122275
#> 34 -6.108755 -2.883444 -2.176504 4.3961702
#> 35 -6.563359 -2.890386 -2.389702 4.5672949
#> 36 -6.702159 -2.845809 -2.489467 4.7105573
#> 37 -6.324717 -2.695711 -2.055113 4.1039177
#> 38 -6.288335 -2.859521 -1.855825 4.0881159
#> 39 -6.516862 -2.907214 -2.203314 4.1674376
#> 40 -6.464658 -2.802779 -2.233992 4.0310933
#> 41 -6.470048 -4.166557 -1.498485 4.8553226
#> 42 -6.519364 -4.105927 -1.534632 4.8704241
#> 43 -6.847962 -4.534973 -1.552251 5.0687519
#> 44 -6.743412 -4.510905 -1.465301 4.9628599
#> 45 -6.370709 -3.963201 -1.386941 4.5764810
#> 46 -6.463178 -4.020305 -1.548929 4.6873656
#> 47 -6.542112 -4.331505 -1.348544 4.7492957
#> 48 -6.459033 -4.358838 -1.326586 4.7025968
#> 49 -6.073720 -2.633541 -2.146965 4.2341838
#> 50 -5.679502 -2.612223 -1.979371 4.1903874
#> 51 -6.141427 -2.538452 -2.105790 4.3079295
#> 52 -5.832802 -2.516264 -2.067729 4.0623738
#> 53 -6.003227 -2.485534 -2.156889 4.0089366
#> 54 -5.542549 -2.548007 -1.903504 4.1458171
#> 55 -6.111621 -2.489870 -2.180607 3.9987595
#> 56 -5.835532 -2.426018 -1.932348 3.9389188
#> 57 -6.118695 -3.486360 -1.566519 4.4646624
#> 58 -5.798201 -3.174120 -1.638946 4.3632586
#> 59 -6.251453 -3.419744 -1.690882 4.4014909
#> 60 -5.913769 -3.380131 -1.691552 4.4945277
#> 61 -6.299715 -3.289693 -1.475837 4.1196083
#> 62 -5.940416 -3.299309 -1.492855 4.2556020
#> 63 -6.340232 -3.322430 -1.539279 4.1113729
#> 64 -5.846221 -3.014977 -1.432879 4.2251243
#> 65 -5.260852 21.968467 -3.922210 4.0391410
#> 66 -5.317288 21.861030 -3.984951 4.2048707
#> 67 -1.992734 19.826474 -1.460436 3.1881259
#> 68 -1.971937 19.764362 -1.401845 3.1492190
#> 69 -5.273747 21.748905 -3.942888 4.2349548
#> 70 -5.261143 21.727640 -3.928986 4.1384721
#> 71 -2.045628 19.755442 -1.437947 3.0800957
#> 72 -1.981140 19.774349 -1.410182 3.1465449
#> 73 -5.309372 21.805043 -3.977657 4.1674083
#> 74 -5.431585 21.992833 -4.097479 3.9522986
#> 75 -1.716192 19.610436 -1.176831 3.3647018
#> 76 -1.751374 19.628354 -1.211124 3.3219035
#> 77 -5.404732 21.859755 -4.071782 4.1558350
#> 78 -5.496131 21.967022 -4.163119 4.0862677
#> 79 -1.760428 19.612134 -1.207222 3.3112960
#> 80 -1.745577 19.614497 -1.202703 3.3337037
#> 81 -7.051500 -2.814557 -2.741371 5.0551906
#> 82 -6.986028 -2.548489 -2.478077 4.9114553
#> 83 -7.265445 -2.913871 -2.789791 5.2825855
#> 84 -7.385342 -2.639851 -2.539757 5.0021825
#> 85 -6.893139 -2.849210 -2.502504 4.8214562
#> 86 -6.933222 -2.815704 -2.652712 4.9565286
#> 87 -7.375529 -2.715402 -2.633306 5.2187940
#> 88 -7.157356 -2.662687 -2.688888 5.1027727
#> 89 -7.143289 -4.597201 -1.746234 5.2421818
#> 90 -7.110849 -4.706593 -1.699727 5.3345570
#> 91 -7.423139 -4.622670 -2.011654 5.2845224
#> 92 -7.397332 -4.697799 -2.077434 5.3727614
#> 93 -7.024290 -4.714465 -1.609017 5.1754788
#> 94 -7.047315 -4.850999 -1.546777 5.1377209
#> 95 -7.526900 -4.550474 -2.159472 5.2855988
#> 96 -7.290935 -4.726532 -1.965158 5.4437823
#> 97 19.154123 -5.124758 4.492905 -0.8605014
#> 98 18.885086 -4.980157 4.656682 -1.0115521
#> 99 18.916943 -4.755275 4.201635 -0.6955943
#> 100 18.833832 -4.734767 4.406856 -0.6989614
#> 101 19.165891 -5.117910 4.427364 -0.8554581
#> 102 19.052753 -5.040318 4.410331 -0.7594558
#> 103 18.785005 -4.730920 4.343386 -0.5887482
#> 104 18.851369 -4.798983 4.161439 -0.7313434
#> 105 19.250124 -4.312417 4.064269 -1.2637498
#> 106 18.949577 -4.065875 4.347362 -1.0236215
#> 107 19.066624 -4.283539 4.062480 -0.7454229
#> 108 18.808082 -4.358376 4.209598 -0.6583631
#> 109 19.327719 -4.210920 4.101452 -1.1037221
#> 110 19.126349 -4.018993 4.168679 -1.2014061
#> 111 19.024972 -4.301780 4.140644 -0.9112113
#> 112 18.874250 -4.195374 4.159320 -0.8019671
#> 113 19.464506 -5.176127 4.379967 -1.1590661
#> 114 19.261564 -5.147549 4.593014 -1.2543710
#> 115 19.383260 -5.262012 4.191984 -0.8893935
#> 116 19.061351 -5.123262 4.319432 -0.7194803
#> 117 19.749100 -5.233351 4.450023 -1.2585900
#> 118 19.719388 -5.144176 4.380805 -1.3933926
#> 119 19.502232 -5.228368 4.069784 -1.2375152
#> 120 19.477468 -5.230625 4.099205 -1.2510938
#> 121 19.529862 -4.441928 4.204416 -1.4710439
#> 122 19.495354 -4.343642 4.275032 -1.4316139
#> 123 19.429878 -4.167175 3.930329 -1.0886388
#> 124 19.152271 -3.974316 4.026430 -1.3062212
#> 125 19.755297 -4.463411 4.105291 -1.6456498
#> 126 19.610532 -4.341429 4.168914 -1.6215156
#> 127 19.665547 -4.250999 3.865166 -1.5105826
#> 128 19.599091 -4.140470 3.932791 -1.6868362datos <- Cardiological
datos
#> # A tibble: 11 × 3
#> Pulse Syst Diast
#> <symblc_n> <symblc_n> <symblc_n>
#> 1 [44.00 : 68.00] [90.00 : 100.00] [50.00 : 70.00]
#> 2 [60.00 : 72.00] [90.00 : 130.00] [70.00 : 90.00]
#> 3 [56.00 : 90.00] [140.00 : 180.00] [90.00 : 100.00]
#> 4 [70.00 : 112.00] [110.00 : 142.00] [80.00 : 108.00]
#> 5 [54.00 : 72.00] [90.00 : 100.00] [50.00 : 70.00]
#> 6 [70.00 : 100.00] [130.00 : 160.00] [80.00 : 110.00]
#> 7 [63.00 : 75.00] [60.00 : 100.00] [140.00 : 150.00]
#> 8 [72.00 : 100.00] [130.00 : 160.00] [76.00 : 90.00]
#> 9 [76.00 : 98.00] [110.00 : 190.00] [70.00 : 110.00]
#> 10 [86.00 : 96.00] [138.00 : 180.00] [90.00 : 110.00]
#> 11 [86.00 : 100.00] [110.00 : 150.00] [78.00 : 100.00]x <- sym.umap(datos)
x
#> V1 V2 V3
#> 1 1.147277491 -0.70451506 4.45431612
#> 2 0.628651291 -0.48420703 3.82710525
#> 3 1.255336305 -0.80916792 4.49392152
#> 4 0.548418840 -0.52635409 3.68140307
#> 5 1.309883094 -1.02151663 4.37140340
#> 6 0.668196959 -0.86658126 3.10303364
#> 7 1.346702190 -0.98384151 4.16882565
#> 8 0.528777636 -0.80892369 2.89466586
#> 9 0.974561364 -1.01776650 3.66931768
#> 10 0.540664355 -0.88992043 2.87080904
#> 11 1.542661008 -0.63039785 1.03953320
#> 12 1.161917686 -0.55077999 1.20123286
#> 13 0.991917549 -0.88844751 3.10300265
#> 14 0.751346725 -0.66850511 2.67662420
#> 15 1.102785672 -0.33243008 0.30252967
#> 16 0.928398292 -0.29152615 0.52230960
#> 17 1.185719089 -0.62802816 0.06019322
#> 18 -0.875123271 0.14989842 -2.03579113
#> 19 1.209039952 -0.47944471 -0.49918624
#> 20 -0.069957331 0.69298918 -3.16498531
#> 21 0.884631799 -0.42604960 -0.02828057
#> 22 -0.868807189 0.53163309 -1.95171478
#> 23 1.106310804 -0.33835038 -0.53909091
#> 24 0.318973462 0.85893389 -2.98825680
#> 25 0.831438820 -0.66890659 2.26046324
#> 26 -2.054486660 0.16622141 -2.18332580
#> 27 1.485944792 -0.67992858 0.38828965
#> 28 -1.557361988 0.18301603 -2.76366817
#> 29 -0.003969682 0.26745911 0.25701962
#> 30 -1.611269404 0.77615578 -1.69768678
#> 31 0.560669613 -0.07761276 -0.14181239
#> 32 -1.163502467 1.03978714 -2.17344470
#> 33 1.117753270 -0.48930111 4.44408684
#> 34 0.641738077 -0.52462783 3.77395520
#> 35 0.957470881 -0.54169958 4.27317610
#> 36 0.640120038 -0.42994366 3.75340322
#> 37 1.199298332 -1.12822233 3.93816165
#> 38 0.450027286 -1.06593858 3.14437490
#> 39 1.391694585 -1.24255257 3.84811560
#> 40 0.514003844 -1.07646691 2.58394822
#> 41 1.584946047 -0.52259649 0.86057630
#> 42 -1.765419676 0.06290919 -2.36569665
#> 43 1.565998849 -0.70076033 -0.44637675
#> 44 -0.938099784 0.37436449 -3.12122151
#> 45 0.304947383 0.15798885 0.08605191
#> 46 -1.252673460 0.95151068 -1.79715174
#> 47 0.623483199 0.01897130 -0.61314302
#> 48 -0.429319022 1.10133083 -2.50257210
#> 49 -1.081520425 1.11600649 0.81784576
#> 50 -0.986970661 0.99371308 0.69289532
#> 51 -0.962125024 1.09435663 1.14433616
#> 52 -0.821119354 0.87778674 0.81286740
#> 53 -1.080701601 1.22142689 1.15167335
#> 54 -1.175726820 1.14842266 0.73940058
#> 55 -0.930108094 1.01394508 1.01200024
#> 56 -0.718449079 0.80874090 0.98150496
#> 57 1.315695051 -0.77859534 0.99876981
#> 58 -1.752242050 -0.04643223 -2.40946022
#> 59 1.475546859 -0.85926038 -0.26367719
#> 60 -1.116557916 0.24171291 -3.02597922
#> 61 1.179799472 -0.36267136 0.72367412
#> 62 -1.536939707 0.31762090 -2.20622552
#> 63 1.208750244 -0.81601033 -0.64951663
#> 64 -0.805893336 0.58630328 -2.98601983
#> 65 0.687611740 -0.79657835 2.19503023
#> 66 -2.024319696 -0.13020170 -1.92357495
#> 67 1.339285611 -0.53293439 -1.20045505
#> 68 -0.498128425 0.33826020 -3.16500906
#> 69 -0.292360267 0.37576675 0.02432687
#> 70 -1.321904143 0.67480208 -1.40634201
#> 71 0.652615074 0.81299783 -2.73882225
#> 72 0.416046534 1.01032551 -3.09827960
#> 73 -0.795976885 0.07743693 -1.86714054
#> 74 -1.222188362 0.08909839 -2.27654668
#> 75 0.222136617 0.55188728 -3.02596822
#> 76 -0.175072291 0.48908427 -3.25153803
#> 77 -0.606963470 0.62919581 -1.59474661
#> 78 -0.857947536 0.89498431 -1.88767633
#> 79 0.548880515 0.89093598 -2.99403954
#> 80 0.367754165 1.16643562 -2.96666463
#> 81 -1.712382932 -0.24162734 -1.25927681
#> 82 -2.146700394 0.02318171 -2.09673395
#> 83 -0.624890514 -0.24786895 -2.12432309
#> 84 -1.439558600 0.16104173 -2.95127782
#> 85 -1.189207830 0.45084247 -0.97233651
#> 86 -1.500248481 0.63229104 -1.78000755
#> 87 -0.557087973 0.38976412 -1.86823675
#> 88 -0.892546659 0.89595437 -2.34289394data("hardwoodBrito")
Hardwood.histogram<-hardwoodBrito
Hardwood.cols<-colnames(Hardwood.histogram)
Hardwood.names<-row.names(Hardwood.histogram)
Hardwood.histogram
#> # A tibble: 5 × 4
#> ANNT JULT ANNP MITM
#> * <symblc_h> <symblc_h> <symblc_h> <symblc_h>
#> 1 <hist> <hist> <hist> <hist>
#> 2 <hist> <hist> <hist> <hist>
#> 3 <hist> <hist> <hist> <hist>
#> 4 <hist> <hist> <hist> <hist>
#> 5 <hist> <hist> <hist> <hist>
Hardwood.histogram[[1]][[1]]
#> $breaks
#> [1] -3.9 4.2 10.3 20.6
#>
#> $props
#> [1] 0.5 0.4 0.1pca.hist<-sym.histogram.pca(Hardwood.histogram,BIN.Matrix)
#> Warning: Setting row names on a tibble is deprecated.
#> Setting row names on a tibble is deprecated.
#> Setting row names on a tibble is deprecated.
#> Setting row names on a tibble is deprecated.
pca.hist$classic.PCA
#> **Results for the Principal Component Analysis (PCA)**
#> The analysis was performed on 85 individuals, described by 4 variables
#> *The results are available in the following objects:
#>
#> name description
#> 1 "$eig" "eigenvalues"
#> 2 "$var" "results for the variables"
#> 3 "$var$coord" "coord. for the variables"
#> 4 "$var$cor" "correlations variables - dimensions"
#> 5 "$var$cos2" "cos2 for the variables"
#> 6 "$var$contrib" "contributions of the variables"
#> 7 "$ind" "results for the individuals"
#> 8 "$ind$coord" "coord. for the individuals"
#> 9 "$ind$cos2" "cos2 for the individuals"
#> 10 "$ind$contrib" "contributions of the individuals"
#> 11 "$ind.sup" "results for the supplementary individuals"
#> 12 "$ind.sup$coord" "coord. for the supplementary individuals"
#> 13 "$ind.sup$cos2" "cos2 for the supplementary individuals"
#> 14 "$call" "summary statistics"
#> 15 "$call$centre" "mean of the variables"
#> 16 "$call$ecart.type" "standard error of the variables"
#> 17 "$call$row.w" "weights for the individuals"
#> 18 "$call$col.w" "weights for the variables"
pca.hist$sym.hist.matrix.PCA
#> # A tibble: 5 × 4
#> PC.1 PC.2 PC.3 PC.4
#> * <symblc_h> <symblc_h> <symblc_h> <symblc_h>
#> 1 <hist> <hist> <hist> <hist>
#> 2 <hist> <hist> <hist> <hist>
#> 3 <hist> <hist> <hist> <hist>
#> 4 <hist> <hist> <hist> <hist>
#> 5 <hist> <hist> <hist> <hist>ACER.p1<-Sym.PCA.Hist.PCA.k.plot(data.sym.df = pca.hist$Bins.df,
title.graph = " ",
concepts.name = c("ACER"),
title.x = "First Principal Component (84.83%)",
title.y = "Frequency",
pca.axes = 1)
ACER.p1ALL.p1<-Sym.PCA.Hist.PCA.k.plot(data.sym.df = pca.hist$Bins.df,
title.graph = " ",
concepts.name = unique(pca.hist$Bins.df$Object.Name),
title.x = "First Principal Component (84.83%)",
title.y = "Frequency",
pca.axes = 1)
ALL.p1Hardwood.quantiles.PCA<-quantiles.RSDA(pca.hist$sym.hist.matrix.PCA,3)
#> Warning: Setting row names on a tibble is deprecated.
label.name<-"Hard Wood"
Title<-"First Principal Plane"
axes.x.label<- "First Principal Component (84.83%)"
axes.y.label<- "Second Principal Component (9.70%)"
concept.names<-c("ACER")
var.names<-c("PC.1","PC.2")
quantile.ACER.plot<-Percentil.Arrow.plot(Hardwood.quantiles.PCA,
concept.names,
var.names,
Title,
axes.x.label,
axes.y.label,
label.name
)
quantile.ACER.plotlabel.name<-"Hard Wood"
Title<-"First Principal Plane"
axes.x.label<- "First Principal Component (84.83%)"
axes.y.label<- "Second Principal Component (9.70%)"
concept.names<-row.names(Hardwood.quantiles.PCA)
var.names<-c("PC.1","PC.2")
quantile.plot<-Percentil.Arrow.plot(Hardwood.quantiles.PCA,
concept.names,
var.names,
Title,
axes.x.label,
axes.y.label,
label.name
)
quantile.plotlabel.name<-"Hard Wood"
Title<-"First Principal Plane"
axes.x.label<- "PC 1 (84.83%)"
axes.y.label<- "PC 2 (9.70%)"
concept.names<-c("ACER")
var.names<-c("PC.1","PC.2")
plot.3D.HW<-sym.quantiles.PCA.plot(Hardwood.quantiles.PCA,
concept.names,
var.names,
Title,
axes.x.label,
axes.y.label,
label.name)
plot.3D.HWHardwood.quantiles.PCA.2<-quantiles.RSDA.KS(pca.hist$sym.hist.matrix.PCA,100)
#> Warning: Setting row names on a tibble is deprecated.
h<-Hardwood.quantiles.PCA.2[[1]][[1]]
tmp<-HistRSDAToEcdf(h)
h2<-Hardwood.quantiles.PCA.2[[1]][[2]]
tmp2<-HistRSDAToEcdf(h2)
h3<-Hardwood.quantiles.PCA.2[[1]][[3]]
tmp3<-HistRSDAToEcdf(h3)
h4<-Hardwood.quantiles.PCA.2[[1]][[4]]
tmp4<-HistRSDAToEcdf(h4)
h5<-Hardwood.quantiles.PCA.2[[1]][[5]]
tmp5<-HistRSDAToEcdf(h5)
breaks.unique<-unique(c(h$breaks,h2$breaks,h3$breaks,h4$breaks,h5$breaks))
tmp.unique<-breaks.unique[order(breaks.unique)]
tmp<-tmp(v = tmp.unique)
tmp2<-tmp2(v = tmp.unique)
tmp3<-tmp3(v = tmp.unique)
tmp4<-tmp4(v = tmp.unique)
tmp5<-tmp5(v = tmp.unique)
abs_dif <- abs(tmp2 - tmp)
# La distancia Kolmogorov–Smirnov es el máximo de las distancias absolutas.
distancia_ks <- max(abs_dif)
distancia_ks
#> [1] 0.05857869library(tidyr)
# Se unen los valores calculados en un dataframe.
df.HW <- data.frame(
PC.1 = tmp.unique,
ACER = tmp,
ALNUS = tmp2,
FRAXINUS = tmp3,
JUGLANS = tmp4,
QUERCUS = tmp5
) %>%
pivot_longer(
cols = c(ACER, ALNUS,FRAXINUS,JUGLANS,QUERCUS),
names_to = "HardWood",
values_to = "ecdf"
)
grafico_ecdf <- ggplot(data = df.HW,
aes(x = PC.1, y = ecdf, color = HardWood)) +
geom_line(size = 1) +
labs(
color = "Hardwood",
y = "Empirical Cumulative Distribution "
) +
theme_bw() +
theme(legend.position = "bottom",
plot.title = element_text(size = 12))+geom_line()
grafico_ecdf