Skip to contents

This provides a quick introduction. We’ll walk through fitting models to high-dimensional data and a 2-D embedding, and show how to inspect the key outputs.

model <- fit_highd_model(highd_data = scurve, 
                         nldr_data = scurve_umap, 
                         b1 = 4, q = 0.1, 
                         benchmark_highdens = 5)

The output of fit_highd_model() is a named list containing several components. Let’s take a quick look at each:

## 2-D model
glimpse(model$model_2d)
#> Rows: 12
#> Columns: 5
#> $ h   <int> 2, 3, 5, 6, 7, 10, 11, 12, 13, 14, 15, 18
#> $ c_x <dbl> 0.29620130, 0.69240260, 0.09810065, 0.49430195, 0.89050325, 0.2962…
#> $ c_y <dbl> -0.1156801, -0.1156801, 0.2274402, 0.2274402, 0.2274402, 0.5705606…
#> $ n_h <dbl> 30, 14, 75, 137, 132, 12, 132, 37, 140, 176, 67, 44
#> $ w_h <dbl> 0.030, 0.014, 0.075, 0.137, 0.132, 0.012, 0.132, 0.037, 0.140, 0.1…

## high-D model
glimpse(model$model_highd)
#> Rows: 12
#> Columns: 8
#> $ h  <int> 2, 3, 5, 6, 7, 10, 11, 12, 13, 14, 15, 18
#> $ x1 <dbl> 0.6209517, -0.4722570, 0.8739211, -0.1848675, -0.8900024, 0.2785481…
#> $ x2 <dbl> 0.1445716, 1.6006858, 1.0675059, 0.6553456, 1.2914098, 0.7134556, 0…
#> $ x3 <dbl> 1.73384917, 1.87127122, 1.41757699, 1.81615709, 1.03602502, -0.7218…
#> $ x4 <dbl> 0.0008107566, -0.0020441796, -0.0030742350, -0.0015083059, 0.000368…
#> $ x5 <dbl> 0.0012937320, 0.0059149121, 0.0021779674, 0.0013517560, 0.000266451…
#> $ x6 <dbl> -0.014829086, 0.013645828, -0.003704260, 0.001346874, 0.001513801, 
#> $ x7 <dbl> -1.416857e-03, 3.191434e-03, 2.633164e-04, 1.226910e-03, 2.784532e-…

## wireframe data
glimpse(model$trimesh_data)
#> Rows: 23
#> Columns: 8
#> $ from       <int> 3, 3, 2, 4, 4, 6, 6, 7, 7, 9, 10, 1, 1, 2, 4, 6, 5, 7, 10, 
#> $ to         <int> 4, 6, 4, 5, 7, 10, 7, 8, 11, 12, 11, 4, 2, 5, 6, 9, 8, 10, 
#> $ x_from     <dbl> 0.09810065, 0.09810065, 0.69240260, 0.49430195, 0.49430195,
#> $ y_from     <dbl> 0.2274402, 0.2274402, -0.1156801, 0.2274402, 0.2274402, 0.5…
#> $ x_to       <dbl> 0.49430195, 0.29620130, 0.49430195, 0.89050325, 0.69240260,
#> $ y_to       <dbl> 0.2274402, 0.5705606, 0.2274402, 0.2274402, 0.5705606, 0.91…
#> $ from_count <dbl> 75, 75, 14, 137, 137, 12, 12, 132, 132, 140, 176, 30, 30, 1…
#> $ to_count   <dbl> 137, 12, 137, 132, 132, 176, 132, 37, 67, 44, 67, 137, 14, 

## NLDR object
glimpse(model$nldr_obj)
#> List of 3
#>  $ scaled_nldr: tibble [1,000 × 3] (S3: tbl_df/tbl/data.frame)
#>   ..$ emb1: num [1:1000] 0.277 0.697 0.779 0.173 0.218 ...
#>   ..$ emb2: num [1:1000] 0.913 0.538 0.399 0.953 0.983 ...
#>   ..$ ID  : int [1:1000] 1 2 3 4 5 6 7 8 9 10 ...
#>  $ lim1       : num [1:2] -9.15 8.55
#>  $ lim2       : num [1:2] -10.4 10.1

## Hexagonal object
glimpse(model$hb_obj)
#> List of 11
#>  $ a1         : num 0.396
#>  $ a2         : num 0.343
#>  $ bins       : num [1:2] 4 5
#>  $ start_point: num [1:2] -0.1 -0.116
#>  $ centroids  : tibble [20 × 3] (S3: tbl_df/tbl/data.frame)
#>   ..$ h  : int [1:20] 1 2 3 4 5 6 7 8 9 10 ...
#>   ..$ c_x: num [1:20] -0.1 0.2962 0.6924 1.0886 0.0981 ...
#>   ..$ c_y: num [1:20] -0.116 -0.116 -0.116 -0.116 0.227 ...
#>  $ hex_poly   :'data.frame': 120 obs. of  3 variables:
#>   ..$ h: int [1:120] 1 1 1 1 1 1 2 2 2 2 ...
#>   ..$ x: num [1:120] -0.1 -0.2981 -0.2981 -0.1 0.0981 ...
#>   ..$ y: num [1:120] 0.11307 -0.00131 -0.23005 -0.34443 -0.23005 ...
#>  $ data_hb_id : tibble [1,000 × 4] (S3: tbl_df/tbl/data.frame)
#>   ..$ emb1: num [1:1000] 0.277 0.697 0.779 0.173 0.218 ...
#>   ..$ emb2: num [1:1000] 0.913 0.538 0.399 0.953 0.983 ...
#>   ..$ ID  : int [1:1000] 1 2 3 4 5 6 7 8 9 10 ...
#>   ..$ h   : int [1:1000] 13 11 11 13 13 14 5 12 15 7 ...
#>  $ std_cts    : tibble [13 × 3] (S3: tbl_df/tbl/data.frame)
#>   ..$ h  : int [1:13] 2 3 5 6 7 10 11 12 13 14 ...
#>   ..$ n_h: int [1:13] 30 14 75 137 132 12 132 37 140 176 ...
#>   ..$ w_h: num [1:13] 0.03 0.014 0.075 0.137 0.132 0.012 0.132 0.037 0.14 0.176 ...
#>  $ b          : int 20
#>  $ m          : int 13
#>  $ pts_bins   : tibble [13 × 2] (S3: tbl_df/tbl/data.frame)
#>   ..$ h       : int [1:13] 2 3 5 6 7 10 11 12 13 14 ...
#>   ..$ pts_list:List of 13
#>  - attr(*, "class")= chr "hex_bin_obj"