Commands: Run selected chunk: Cmd+Shift+Enter. Insert chunk: Cmd+Option+I.

When you save the notebook, an HTML file containing the code and output will be saved alongside it (click the Preview button or press Cmd+Shift+K to preview the HTML file). #Write cost functions

Load data and compute cost

All points for an 80%-of-max task

## Loading required package: GGally
## Warning: package 'GGally' was built under R version 3.3.2
## Loading required package: ggplot2
## Warning: package 'ggplot2' was built under R version 3.3.2

#View all points as boxplots:

##       FDP               FDS                EIP          
##  Min.   :0.01357   Min.   :0.007762   Min.   :0.001747  
##  1st Qu.:0.14430   1st Qu.:0.069695   1st Qu.:0.260326  
##  Median :0.19247   Median :0.092336   Median :0.500613  
##  Mean   :0.19100   Mean   :0.091863   Mean   :0.504462  
##  3rd Qu.:0.24153   3rd Qu.:0.115783   3rd Qu.:0.758679  
##  Max.   :0.33463   Max.   :0.160963   Max.   :0.999629  
##       EDC                LUM                  DI           
##  Min.   :0.001132   Min.   :0.0003311   Min.   :0.0001764  
##  1st Qu.:0.412881   1st Qu.:0.2209727   1st Qu.:0.1004263  
##  Median :0.601081   Median :0.4262012   Median :0.1799842  
##  Mean   :0.578074   Mean   :0.4469257   Mean   :0.1875894  
##  3rd Qu.:0.758173   3rd Qu.:0.6677409   3rd Qu.:0.2629963  
##  Max.   :0.999588   Max.   :0.9990431   Max.   :0.5156824  
##        PI          
##  Min.   :0.001317  
##  1st Qu.:0.090575  
##  Median :0.151913  
##  Mean   :0.154694  
##  3rd Qu.:0.212580  
##  Max.   :0.387905

what about parcoord axes being parallel (few line crossings between muscle actiavtions)?

cor(points_w_cost$FDP, points_w_cost$FDS)
## [1] 0.9998411

what about many crossings between two muscles?

cor(points_w_cost$LUM, points_w_cost$DI)
## [1] -0.4982628
cor(points_w_cost$EIP, points_w_cost$EDC)
## [1] -0.06642129
library(corrplot)
corrplot(cor(points_w_cost), order = "hclust", addrect=5)

Let’s grab the bottom 10% of L2W cost and see how the muscle activations are distributed

##       FDP               FDS                EIP          
##  Min.   :0.01357   Min.   :0.007762   Min.   :0.001936  
##  1st Qu.:0.06686   1st Qu.:0.032769   1st Qu.:0.099902  
##  Median :0.08922   Median :0.043177   Median :0.191305  
##  Mean   :0.08594   Mean   :0.041834   Mean   :0.205708  
##  3rd Qu.:0.11054   3rd Qu.:0.053781   3rd Qu.:0.308059  
##  Max.   :0.13065   Max.   :0.062602   Max.   :0.499439  
##       EDC                LUM                 DI          
##  Min.   :0.009153   Min.   :0.005913   Min.   :0.002266  
##  1st Qu.:0.180492   1st Qu.:0.129539   1st Qu.:0.036946  
##  Median :0.283373   Median :0.248116   Median :0.059195  
##  Mean   :0.269663   Mean   :0.283379   Mean   :0.074878  
##  3rd Qu.:0.365629   3rd Qu.:0.424265   3rd Qu.:0.117655  
##  Max.   :0.468751   Max.   :0.692210   Max.   :0.190278  
##        PI          
##  Min.   :0.002277  
##  1st Qu.:0.024293  
##  Median :0.051305  
##  Mean   :0.054887  
##  3rd Qu.:0.081641  
##  Max.   :0.133341

Limiting one muscle:

Our dataset can be used to simulate a 40% reduction in activation (due to muscle dysfunction, for example) in the two index finger muscles innervated by the radial nerve (EIP and EDC).

##       FDP               FDS                EIP          
##  Min.   :0.01357   Min.   :0.007762   Min.   :0.001936  
##  1st Qu.:0.10158   1st Qu.:0.048847   1st Qu.:0.150776  
##  Median :0.13908   Median :0.067052   Median :0.299853  
##  Mean   :0.13068   Mean   :0.063065   Mean   :0.300343  
##  3rd Qu.:0.16418   3rd Qu.:0.078859   3rd Qu.:0.455278  
##  Max.   :0.19852   Max.   :0.095062   Max.   :0.594677  
##       EDC                LUM                 DI          
##  Min.   :0.009153   Min.   :0.005913   Min.   :0.001012  
##  1st Qu.:0.309293   1st Qu.:0.170160   1st Qu.:0.053976  
##  Median :0.443477   Median :0.325978   Median :0.112468  
##  Mean   :0.408749   Mean   :0.370912   Mean   :0.116461  
##  3rd Qu.:0.530161   3rd Qu.:0.545670   3rd Qu.:0.171332  
##  Max.   :0.598835   Max.   :0.962193   Max.   :0.309409  
##        PI          
##  Min.   :0.002277  
##  1st Qu.:0.054151  
##  Median :0.092123  
##  Mean   :0.094562  
##  3rd Qu.:0.132383  
##  Max.   :0.221263

When flexor digitorum profundus has resting tonicity of 0.2:

##       FDP              FDS               EIP                EDC        
##  Min.   :0.2001   Min.   :0.09564   Min.   :0.009423   Min.   :0.5008  
##  1st Qu.:0.2193   1st Qu.:0.10493   1st Qu.:0.332995   1st Qu.:0.6909  
##  Median :0.2442   Median :0.11709   Median :0.567915   Median :0.7637  
##  Mean   :0.2492   Mean   :0.11946   Mean   :0.553988   Mean   :0.7777  
##  3rd Qu.:0.2753   3rd Qu.:0.13190   3rd Qu.:0.794048   3rd Qu.:0.8786  
##  Max.   :0.3346   Max.   :0.16096   Max.   :0.999629   Max.   :0.9996  
##       LUM                 DI                PI        
##  Min.   :0.004486   Min.   :0.04966   Min.   :0.0932  
##  1st Qu.:0.256842   1st Qu.:0.18648   1st Qu.:0.1711  
##  Median :0.504870   Median :0.25665   Median :0.2142  
##  Mean   :0.496704   Mean   :0.25766   Mean   :0.2171  
##  3rd Qu.:0.730647   3rd Qu.:0.32410   3rd Qu.:0.2576  
##  Max.   :0.999043   Max.   :0.51568   Max.   :0.3879

Manual observations on the effects upon other muscles when FDP activation is kept above 0.2: - FDS becomes constrained between .09 and 0.16, with middle 50% of solutions in a range spanning only .02697 (between .13190 and .10493) - EDC goes from being redundant (with bounds of 0 and 1), to being only in the upper half (0.5 to 0.88)

Which muscle, when hypotonic, slices the FAS more—PI or DI?

Let’s limit each to 20% of maximal distal fingertip force.

##       FDP               FDS                EIP          
##  Min.   :0.01357   Min.   :0.007762   Min.   :0.001747  
##  1st Qu.:0.12208   1st Qu.:0.059204   1st Qu.:0.220062  
##  Median :0.16583   Median :0.079812   Median :0.440370  
##  Mean   :0.16200   Mean   :0.078000   Mean   :0.469318  
##  3rd Qu.:0.20481   3rd Qu.:0.098008   3rd Qu.:0.725786  
##  Max.   :0.29395   Max.   :0.140646   Max.   :0.999629  
##       EDC                LUM                  DI           
##  Min.   :0.001132   Min.   :0.0003311   Min.   :0.0001764  
##  1st Qu.:0.333529   1st Qu.:0.2754155   1st Qu.:0.0717440  
##  Median :0.496606   Median :0.5083091   Median :0.1300251  
##  Mean   :0.480370   Mean   :0.4957852   Mean   :0.1308368  
##  3rd Qu.:0.632880   3rd Qu.:0.7043622   3rd Qu.:0.1864969  
##  Max.   :0.956826   Max.   :0.9990431   Max.   :0.2855284  
##        PI          
##  Min.   :0.001317  
##  1st Qu.:0.067947  
##  Median :0.116917  
##  Mean   :0.111577  
##  3rd Qu.:0.157552  
##  Max.   :0.199896

##       FDP               FDS                EIP          
##  Min.   :0.01357   Min.   :0.007762   Min.   :0.001747  
##  1st Qu.:0.11548   1st Qu.:0.055890   1st Qu.:0.195862  
##  Median :0.15946   Median :0.076669   Median :0.398982  
##  Mean   :0.15664   Mean   :0.075365   Mean   :0.448702  
##  3rd Qu.:0.20042   3rd Qu.:0.096050   3rd Qu.:0.702340  
##  Max.   :0.29395   Max.   :0.140646   Max.   :0.999629  
##       EDC                LUM                 DI           
##  Min.   :0.001132   Min.   :0.005877   Min.   :0.0001764  
##  1st Qu.:0.300929   1st Qu.:0.336927   1st Qu.:0.0601682  
##  Median :0.479448   Median :0.558418   Median :0.1115024  
##  Mean   :0.465338   Mean   :0.543292   Mean   :0.1086178  
##  3rd Qu.:0.626037   3rd Qu.:0.746026   3rd Qu.:0.1559808  
##  Max.   :0.981464   Max.   :0.999043   Max.   :0.1997135  
##        PI          
##  Min.   :0.001317  
##  1st Qu.:0.059449  
##  Median :0.101185  
##  Mean   :0.097346  
##  3rd Qu.:0.134199  
##  Max.   :0.205729
## No id variables; using all as measure variables
## No id variables; using all as measure variables

##       FDP               FDS                EIP          
##  Min.   :0.01357   Min.   :0.007762   Min.   :0.001747  
##  1st Qu.:0.11548   1st Qu.:0.055890   1st Qu.:0.195862  
##  Median :0.15946   Median :0.076669   Median :0.398982  
##  Mean   :0.15664   Mean   :0.075365   Mean   :0.448702  
##  3rd Qu.:0.20042   3rd Qu.:0.096050   3rd Qu.:0.702340  
##  Max.   :0.29395   Max.   :0.140646   Max.   :0.999629  
##       EDC                LUM                 DI           
##  Min.   :0.001132   Min.   :0.005877   Min.   :0.0001764  
##  1st Qu.:0.300929   1st Qu.:0.336927   1st Qu.:0.0601682  
##  Median :0.479448   Median :0.558418   Median :0.1115024  
##  Mean   :0.465338   Mean   :0.543292   Mean   :0.1086178  
##  3rd Qu.:0.626037   3rd Qu.:0.746026   3rd Qu.:0.1559808  
##  Max.   :0.981464   Max.   :0.999043   Max.   :0.1997135  
##        PI          
##  Min.   :0.001317  
##  1st Qu.:0.059449  
##  Median :0.101185  
##  Mean   :0.097346  
##  3rd Qu.:0.134199  
##  Max.   :0.205729

showing the wide bounds with small IQR for a muscle at higher force (not 80%)

high_force_points <- read.csv("finger_forcevector_25.379547626496084_1484881649920.csv")
par(mfrow=c(3,3))
lapply(1:7, 
       function(x) {
        hist(high_force_points[,x], xlim=c(0,1)) 
        summary(high_force_points[,x])  
        }
       )
## [[1]]
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
## 0.06631 0.13230 0.16320 0.15970 0.19010 0.25230 
## 
## [[2]]
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
## 0.06907 0.10000 0.11430 0.11270 0.12690 0.15680 
## 
## [[3]]
##      Min.   1st Qu.    Median      Mean   3rd Qu.      Max. 
## 0.0004144 0.2560000 0.4773000 0.4917000 0.7363000 0.9996000 
## 
## [[4]]
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##  0.3448  0.6543  0.7756  0.7600  0.8826  0.9996 
## 
## [[5]]
##     Min.  1st Qu.   Median     Mean  3rd Qu.     Max. 
## 0.007945 0.371700 0.559700 0.553000 0.757300 0.996100 
## 
## [[6]]
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##  0.8785  0.9350  0.9594  0.9552  0.9791  1.0000 
## 
## [[7]]
##      Min.   1st Qu.    Median      Mean   3rd Qu.      Max. 
## 2.949e-05 1.344e-02 2.624e-02 2.844e-02 4.074e-02 8.130e-02