<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Ł K | Łukasz Komsta</title>
	<atom:link href="https://www.komsta.net/author/lukke/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.komsta.net</link>
	<description></description>
	<lastBuildDate>Fri, 01 Mar 2024 19:24:57 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.7</generator>
	<item>
		<title>Szczyrk abstract book archive</title>
		<link>https://www.komsta.net/szczyrk-abstract-book-archive/</link>
		
		<dc:creator><![CDATA[Ł K]]></dc:creator>
		<pubDate>Tue, 09 Jan 2024 13:18:18 +0000</pubDate>
				<category><![CDATA[Uncategorized]]></category>
		<guid isPermaLink="false">https://www.komsta.net/?p=52</guid>

					<description><![CDATA[This is a backup place for abstract books of Szczyrk conferences &#8220;Chromatographic methods of investigating the organic compounds&#8221;, which were held many years until COVID pandemic. These events are very close to my heart. Below you can download all books in ZIP (PDF+DJVU), as well as browse individual files. 2005 2006 2007 2009 2010 2011 [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p>This is a backup place for abstract books of Szczyrk conferences &#8220;Chromatographic methods of investigating the organic compounds&#8221;, which were held many years until COVID pandemic. These events are very close to my heart. Below you can download all books in ZIP (PDF+DJVU), as well as browse individual files.</p>



<div class="wp-block-file aligncenter"><a id="wp-block-file--media-97947ffa-28f6-4c4f-bc9a-f716ff151890" href="https://www.komsta.net/wp-content/uploads/2024/01/Szczyrk-Abstract-Books-2005-2019.zip">Szczyrk-Abstract-Books-2005-2019</a><a href="https://www.komsta.net/wp-content/uploads/2024/01/Szczyrk-Abstract-Books-2005-2019.zip" class="wp-block-file__button wp-element-button" download aria-describedby="wp-block-file--media-97947ffa-28f6-4c4f-bc9a-f716ff151890">Download</a></div>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<div class="wp-block-group has-global-padding is-layout-constrained wp-block-group-is-layout-constrained">
<h2 class="wp-block-heading">2005</h2>



<div data-wp-interactive="core/file" class="wp-block-file"><object data-wp-bind--hidden="!state.hasPdfPreview"  class="wp-block-file__embed" data="https://www.komsta.net/wp-content/uploads/2024/01/2005.pdf" type="application/pdf" style="width:100%;height:600px" aria-label="Embed of 2005."></object><a id="wp-block-file--media-437031fd-a806-42d6-a9a5-6f9a7c1f9560" href="https://www.komsta.net/wp-content/uploads/2024/01/2005.pdf">2005</a><a href="https://www.komsta.net/wp-content/uploads/2024/01/2005.pdf" class="wp-block-file__button wp-element-button" download aria-describedby="wp-block-file--media-437031fd-a806-42d6-a9a5-6f9a7c1f9560">Download</a></div>
</div>



<div class="wp-block-group has-global-padding is-layout-constrained wp-block-group-is-layout-constrained">
<h2 class="wp-block-heading">2006</h2>



<div data-wp-interactive="core/file" class="wp-block-file"><object data-wp-bind--hidden="!state.hasPdfPreview"  class="wp-block-file__embed" data="https://www.komsta.net/wp-content/uploads/2024/01/2006.pdf" type="application/pdf" style="width:100%;height:600px" aria-label="Embed of 2006."></object><a id="wp-block-file--media-55f5e4ed-e240-4ea2-8d34-47b53045a087" href="https://www.komsta.net/wp-content/uploads/2024/01/2006.pdf">2006</a><a href="https://www.komsta.net/wp-content/uploads/2024/01/2006.pdf" class="wp-block-file__button wp-element-button" download aria-describedby="wp-block-file--media-55f5e4ed-e240-4ea2-8d34-47b53045a087">Download</a></div>
</div>



<div class="wp-block-group has-global-padding is-layout-constrained wp-block-group-is-layout-constrained">
<h2 class="wp-block-heading">2007</h2>



<div data-wp-interactive="core/file" class="wp-block-file"><object data-wp-bind--hidden="!state.hasPdfPreview"  class="wp-block-file__embed" data="https://www.komsta.net/wp-content/uploads/2024/01/2007.pdf" type="application/pdf" style="width:100%;height:600px" aria-label="Embed of 2007."></object><a id="wp-block-file--media-183b1ec1-34ef-4ea1-bff2-8a1f0951a33a" href="https://www.komsta.net/wp-content/uploads/2024/01/2007.pdf">2007</a><a href="https://www.komsta.net/wp-content/uploads/2024/01/2007.pdf" class="wp-block-file__button wp-element-button" download aria-describedby="wp-block-file--media-183b1ec1-34ef-4ea1-bff2-8a1f0951a33a">Download</a></div>
</div>



<div class="wp-block-group has-global-padding is-layout-constrained wp-block-group-is-layout-constrained">
<h2 class="wp-block-heading">2009</h2>



<div data-wp-interactive="core/file" class="wp-block-file"><object data-wp-bind--hidden="!state.hasPdfPreview"  class="wp-block-file__embed" data="https://www.komsta.net/wp-content/uploads/2024/01/2009.pdf" type="application/pdf" style="width:100%;height:600px" aria-label="Embed of 2009."></object><a id="wp-block-file--media-9ff6e5a0-2657-45e8-8f6e-9787a5835aaf" href="https://www.komsta.net/wp-content/uploads/2024/01/2009.pdf">2009</a><a href="https://www.komsta.net/wp-content/uploads/2024/01/2009.pdf" class="wp-block-file__button wp-element-button" download aria-describedby="wp-block-file--media-9ff6e5a0-2657-45e8-8f6e-9787a5835aaf">Download</a></div>
</div>



<div class="wp-block-group has-global-padding is-layout-constrained wp-block-group-is-layout-constrained">
<h2 class="wp-block-heading">2010</h2>



<div data-wp-interactive="core/file" class="wp-block-file"><object data-wp-bind--hidden="!state.hasPdfPreview"  class="wp-block-file__embed" data="https://www.komsta.net/wp-content/uploads/2024/01/2010.pdf" type="application/pdf" style="width:100%;height:600px" aria-label="Embed of 2010."></object><a id="wp-block-file--media-ef394802-2f17-4b23-941f-0b506f44faf8" href="https://www.komsta.net/wp-content/uploads/2024/01/2010.pdf">2010</a><a href="https://www.komsta.net/wp-content/uploads/2024/01/2010.pdf" class="wp-block-file__button wp-element-button" download aria-describedby="wp-block-file--media-ef394802-2f17-4b23-941f-0b506f44faf8">Download</a></div>
</div>



<div class="wp-block-group has-global-padding is-layout-constrained wp-block-group-is-layout-constrained">
<h2 class="wp-block-heading">2011</h2>



<div data-wp-interactive="core/file" class="wp-block-file"><object data-wp-bind--hidden="!state.hasPdfPreview"  class="wp-block-file__embed" data="https://www.komsta.net/wp-content/uploads/2024/01/2011.pdf" type="application/pdf" style="width:100%;height:600px" aria-label="Embed of 2011."></object><a id="wp-block-file--media-6575b68b-8bfc-439c-9b38-5ff56a6101dd" href="https://www.komsta.net/wp-content/uploads/2024/01/2011.pdf">2011</a><a href="https://www.komsta.net/wp-content/uploads/2024/01/2011.pdf" class="wp-block-file__button wp-element-button" download aria-describedby="wp-block-file--media-6575b68b-8bfc-439c-9b38-5ff56a6101dd">Download</a></div>
</div>



<div class="wp-block-group has-global-padding is-layout-constrained wp-block-group-is-layout-constrained">
<h2 class="wp-block-heading">2012</h2>



<div data-wp-interactive="core/file" class="wp-block-file"><object data-wp-bind--hidden="!state.hasPdfPreview"  class="wp-block-file__embed" data="https://www.komsta.net/wp-content/uploads/2024/01/2012.pdf" type="application/pdf" style="width:100%;height:600px" aria-label="Embed of 2012."></object><a id="wp-block-file--media-9af0e39e-964d-4ce0-881b-5ab0bbbd310e" href="https://www.komsta.net/wp-content/uploads/2024/01/2012.pdf">2012</a><a href="https://www.komsta.net/wp-content/uploads/2024/01/2012.pdf" class="wp-block-file__button wp-element-button" download aria-describedby="wp-block-file--media-9af0e39e-964d-4ce0-881b-5ab0bbbd310e">Download</a></div>
</div>



<div class="wp-block-group has-global-padding is-layout-constrained wp-block-group-is-layout-constrained">
<h2 class="wp-block-heading">2013</h2>



<div data-wp-interactive="core/file" class="wp-block-file"><object data-wp-bind--hidden="!state.hasPdfPreview"  class="wp-block-file__embed" data="https://www.komsta.net/wp-content/uploads/2024/01/2013.pdf" type="application/pdf" style="width:100%;height:600px" aria-label="Embed of 2013."></object><a id="wp-block-file--media-f62af4a6-e58d-4449-b07e-c1e45f61bc98" href="https://www.komsta.net/wp-content/uploads/2024/01/2013.pdf">2013</a><a href="https://www.komsta.net/wp-content/uploads/2024/01/2013.pdf" class="wp-block-file__button wp-element-button" download aria-describedby="wp-block-file--media-f62af4a6-e58d-4449-b07e-c1e45f61bc98">Download</a></div>
</div>



<div class="wp-block-group has-global-padding is-layout-constrained wp-block-group-is-layout-constrained">
<h2 class="wp-block-heading">2014</h2>



<div data-wp-interactive="core/file" class="wp-block-file"><object data-wp-bind--hidden="!state.hasPdfPreview"  class="wp-block-file__embed" data="https://www.komsta.net/wp-content/uploads/2024/01/2014.pdf" type="application/pdf" style="width:100%;height:600px" aria-label="Embed of 2014."></object><a id="wp-block-file--media-477e65fd-6e32-45d2-b52b-6419b08dbaf5" href="https://www.komsta.net/wp-content/uploads/2024/01/2014.pdf">2014</a><a href="https://www.komsta.net/wp-content/uploads/2024/01/2014.pdf" class="wp-block-file__button wp-element-button" download aria-describedby="wp-block-file--media-477e65fd-6e32-45d2-b52b-6419b08dbaf5">Download</a></div>
</div>



<div class="wp-block-group has-global-padding is-layout-constrained wp-block-group-is-layout-constrained">
<h2 class="wp-block-heading">2015</h2>



<div data-wp-interactive="core/file" class="wp-block-file"><object data-wp-bind--hidden="!state.hasPdfPreview"  class="wp-block-file__embed" data="https://www.komsta.net/wp-content/uploads/2024/01/2015.pdf" type="application/pdf" style="width:100%;height:600px" aria-label="Embed of 2015."></object><a id="wp-block-file--media-3ffee87f-2e06-431e-8471-c43436c48242" href="https://www.komsta.net/wp-content/uploads/2024/01/2015.pdf">2015</a><a href="https://www.komsta.net/wp-content/uploads/2024/01/2015.pdf" class="wp-block-file__button wp-element-button" download aria-describedby="wp-block-file--media-3ffee87f-2e06-431e-8471-c43436c48242">Download</a></div>
</div>



<div class="wp-block-group has-global-padding is-layout-constrained wp-block-group-is-layout-constrained">
<h2 class="wp-block-heading">2016</h2>



<div data-wp-interactive="core/file" class="wp-block-file"><object data-wp-bind--hidden="!state.hasPdfPreview"  class="wp-block-file__embed" data="https://www.komsta.net/wp-content/uploads/2024/01/2016.pdf" type="application/pdf" style="width:100%;height:600px" aria-label="Embed of 2016."></object><a id="wp-block-file--media-62e54612-a9f0-4a98-ab12-793784551d1a" href="https://www.komsta.net/wp-content/uploads/2024/01/2016.pdf">2016</a><a href="https://www.komsta.net/wp-content/uploads/2024/01/2016.pdf" class="wp-block-file__button wp-element-button" download aria-describedby="wp-block-file--media-62e54612-a9f0-4a98-ab12-793784551d1a">Download</a></div>
</div>



<div class="wp-block-group has-global-padding is-layout-constrained wp-block-group-is-layout-constrained">
<h2 class="wp-block-heading">2017</h2>



<div data-wp-interactive="core/file" class="wp-block-file"><object data-wp-bind--hidden="!state.hasPdfPreview"  class="wp-block-file__embed" data="https://www.komsta.net/wp-content/uploads/2024/01/2017.pdf" type="application/pdf" style="width:100%;height:600px" aria-label="Embed of 2017."></object><a id="wp-block-file--media-328c1205-e096-4989-a408-dc5906410a9b" href="https://www.komsta.net/wp-content/uploads/2024/01/2017.pdf">2017</a><a href="https://www.komsta.net/wp-content/uploads/2024/01/2017.pdf" class="wp-block-file__button wp-element-button" download aria-describedby="wp-block-file--media-328c1205-e096-4989-a408-dc5906410a9b">Download</a></div>
</div>



<div class="wp-block-group has-global-padding is-layout-constrained wp-block-group-is-layout-constrained">
<h2 class="wp-block-heading">2018</h2>



<div data-wp-interactive="core/file" class="wp-block-file"><object data-wp-bind--hidden="!state.hasPdfPreview"  class="wp-block-file__embed" data="https://www.komsta.net/wp-content/uploads/2024/01/2018.pdf" type="application/pdf" style="width:100%;height:600px" aria-label="Embed of 2018."></object><a id="wp-block-file--media-8dd8dcf3-d905-4780-8b37-d3f9808de6db" href="https://www.komsta.net/wp-content/uploads/2024/01/2018.pdf">2018</a><a href="https://www.komsta.net/wp-content/uploads/2024/01/2018.pdf" class="wp-block-file__button wp-element-button" download aria-describedby="wp-block-file--media-8dd8dcf3-d905-4780-8b37-d3f9808de6db">Download</a></div>
</div>



<div class="wp-block-group has-global-padding is-layout-constrained wp-block-group-is-layout-constrained">
<h2 class="wp-block-heading">2019</h2>



<div data-wp-interactive="core/file" class="wp-block-file"><object data-wp-bind--hidden="!state.hasPdfPreview"  class="wp-block-file__embed" data="https://www.komsta.net/wp-content/uploads/2024/01/2019.pdf" type="application/pdf" style="width:100%;height:600px" aria-label="Embed of 2019."></object><a id="wp-block-file--media-b681c7c5-35ec-4e82-b1f0-be8d87fe5497" href="https://www.komsta.net/wp-content/uploads/2024/01/2019.pdf">2019</a><a href="https://www.komsta.net/wp-content/uploads/2024/01/2019.pdf" class="wp-block-file__button wp-element-button" download aria-describedby="wp-block-file--media-b681c7c5-35ec-4e82-b1f0-be8d87fe5497">Download</a></div>
</div>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Système binaire d’unités</title>
		<link>https://www.komsta.net/systeme-binaire-dunites/</link>
		
		<dc:creator><![CDATA[Ł K]]></dc:creator>
		<pubDate>Tue, 09 Jan 2024 10:48:53 +0000</pubDate>
				<category><![CDATA[Uncategorized]]></category>
		<guid isPermaLink="false">https://www.komsta.net/?p=49</guid>

					<description><![CDATA[An unit system based on binary multipliers and parameters of the universe Revision I &#8211; created on 1st October 2017 The creation of the SBI system has no serious aim. It is a result of a long spare time mental&#160; entertainment. SBI can be used by programmers for fun (yes, it is binary!) or studied [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p><strong><em>An unit system based on binary multipliers and parameters of the universe</em></strong></p>



<p>Revision I &#8211; created on 1st October 2017</p>



<p>The creation of the SBI system has no serious aim. It is a result of a long spare time mental&nbsp; entertainment. SBI can be used by programmers for fun (yes, it is binary!) or studied together with the SI system in comparative way (to enhance the understanding and knowledge about the physical relationships). Last, but not least, it is a good candidate to an official system of a science-fiction book or movie. However, it is restricted to our universe and will be quite meaningless if the physical constants are different in a parallel spacetime. In short, it can be treated as an alternative to the International System of Units (SI &#8211; Systeme international d&#8217;unites), but it is not intended to be another natural unit system, but rather funny binary alternative to SI.</p>



<p><strong>In the beginning, please see <a href="http://www.komsta.net/systeme-binaire/sbi-en.html">ENGLISH </a>or <a href="http://www.komsta.net/systeme-binaire/sbi-pl.html">POLISH </a>HTML introduction.</strong></p>



<ul class="wp-block-list">
<li><a href="http://www.komsta.net/systeme-binaire/sbi-paper.pdf">PAPER</a> with its <a href="http://www.komsta.net/systeme-binaire/sbi-paper.pdf.asc">GPG SIGNATURE</a></li>



<li><a href="http://www.komsta.net/systeme-binaire/sbi-poster.pdf">POSTER</a> (quick reference) with its <a href="http://www.komsta.net/systeme-binaire/sbi-poster.pdf.asc">GPG SIGNATURE</a></li>



<li><a href="http://www.komsta.net/systeme-binaire/sbi-timestamps.zip">TIME STAMPS </a>for both PDF files</li>



<li><a href="http://www.komsta.net/systeme-binaire/sbi-ezunits.mac">MAXIMA EZUNITS MODULE</a></li>
</ul>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Equal spreading in TLC</title>
		<link>https://www.komsta.net/equal-spreading-in-tlc/</link>
		
		<dc:creator><![CDATA[Ł K]]></dc:creator>
		<pubDate>Tue, 09 Jan 2024 10:45:14 +0000</pubDate>
				<category><![CDATA[Uncategorized]]></category>
		<guid isPermaLink="false">https://www.komsta.net/?p=47</guid>

					<description><![CDATA[Investigating a number of the TLC chromatographic systems, full separation often occurs in several cases. A question appears here: which system should be considered to be the best, if selectivity is similar? The intuitive answer is to choose the system in which the spots are most equally spaced between themselves (for example RF = 0.25, [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p>Investigating a number of the TLC chromatographic systems, full separation often occurs in several cases. A question appears here: which system should be considered to be the best, if selectivity is similar? The intuitive answer is to choose the system in which the spots are most equally spaced between themselves (for example RF = 0.25, 0.50, 0.75 for 3 compounds).</p>



<p>The objective mathematical evaluation of equal-spreading can be done by calculating various CRFs (chromatographic response functions). Two of them &#8211; retention uniformity (RU) and retention distance (RD) were recently proposed as better alternative to earlier approaches.</p>



<p>Their main properties are:</p>



<ul class="wp-block-list">
<li>They are a number in range 0 &#8211; 1. 0 means no separation, 1 means perfect equal-spreading.</li>



<li>They have similar distribution as a random variable regardless of number of investigated compounds.</li>



<li>RU is insensitive to non-separation of two compounds (equal RF values) or RF values equal to 0 or 1. RD is sensitive and equal to 0 in such cases. For example the Rf values (0,0.2,0.2,0.3) (two compounds not separated at 0.2 and one at the start ) result in RD equal to 0, but RU equal to 0.3609. When some distance from 0 and spots occurs, the value is larger, for example Rf values (0.1,0.2,0.25,0.3) give RD = 0.4835, RU = 0.4066.</li>
</ul>



<p>If we denote a number of compounds separated as n, Rf values sorted in non-decreasing order as Rf (1…n), Rf0 = 0 and Rf(n+1) = 1, then RU is calculated from the following formula:</p>



<p>$$R_{U} = 1 &#8211; \sqrt{\frac{6(n+1)}{n(2n+1)}\sum_{i=1}^{n}{\left(R_{Fi}-\frac{i}{n+1}\right)^2}}$$</p>



<p>and the formula for RD is presented below:</p>



<p>$$R_D = \Bigg[(n+1)^{(n+1)} \prod^n_{i=0}{(R_{F(i+1)}-R_{Fi})\Bigg]^{\frac{1}{n}}}$$</p>



<p>How to compute them easily?</p>



<p>The computation in spreadsheets is not easy, it is better to compute them in numerical environments. In R and S-plus, following functions computes the criteria for one system from a vector of Rf values:</p>



<pre class="wp-block-code has-small-font-size"><code>rd = function (x)
{
        x = sort(x)
        n = length(x)
        d = diff(c(0,x,1));
        pd = prod(d);
        rd = ((n+1)^(n+1)*pd)^(1/n);
        return(rd);
}
ru = function (x)
{
        x = sort(x)
        n = length(x)
        i = (1:n)/(n+1)
        s = sum((x-i)^2)
        ru = 1-sqrt( (6*(n+1)) / (n*(2*n+1)) * s );
        return(ru);

}</code></pre>



<p>We can use then apply() to compute more values from a matrix.</p>



<p>Analogous functions for MATLAB/Octave can be written:</p>



<pre class="wp-block-code has-small-font-size"><code>function res = rd(x)
        x = sort(x);
        n = length(x);
        d = diff(&#91;0 x 1]);
        pd = prod(d);
        res = ((n+1).^(n+1).*pd).^(1./n);
endfunction
function res = ru(x)
        x = sort(x);
        n = length(x);
        i = (1:n)./(n+1);
        s = sum((x-i).^2);
        res = 1-sqrt((6.*(n+1))./(n.*(2.*n+1)).*s);
endfunction</code></pre>



<p>More information and discussion can be found in following paper: <a href="https://doi.org/10.1556/JPC.20.2007.1.4">10.1556/JPC.20.2007.1.4</a></p>



<p>The further investigation led to introduce 2D version of these criteria, useful in ranking of 2D TLC separations.</p>



<p>If we treat a chromatographic plane as an unit square, and the Rf values as x and y coordinates, the distance between two spots can be calculated in following way:</p>



<p>$$D_{i,j}=\sqrt{(x_i-x_j)^2+(y_i-y_j)^2}$$</p>



<p>Now, we denote the distance to nearest spot (or a border, if nearer), as B:</p>



<p>$$B_i = \min\left[ D_{i,1} ,\dots, D_{i,n} , x_i , (1-x_i) , y_i , (1-y_i) \right]$$</p>



<p>If we compute such values for all spots, the 2D RU and RD criteria can be computed in following way:</p>



<p>$$R_D = \varphi\sqrt{n}\left(\prod_{i=1}^nB_i\right)^{\frac{1}{n}}$$</p>



<p>$$R_U = \frac{\varphi \sqrt{n}}{n}\sum_{i=1}^nB_i = \frac{\varphi}{\sqrt{n}}\sum_{i=1}^nB_i$$</p>



<p>where phi means the golden ratio value (1.618).</p>



<p>We can use following functions for R/S-plus and Octave/MATLAB to combine TLC systems into pairs and evaluate the separation performance:</p>



<pre class="wp-block-code has-small-font-size"><code>tlc2d = function (rf)
{
    n = nrow(rf)
    p = ncol(rf)
    ru = matrix(0, p, p)
    rd = matrix(0, p, p)
    for (i in 1:p) {
        for (j in i:p) {
            X = rf&#91;, c(i, j)]
            dist = as.matrix(dist(X))
            diag(dist) = 1
            dist = rbind(dist, t(X))
            dist = rbind(dist, t(1 - X))
            mins = apply(dist, 2, min)
            rd&#91;i, j] = prod(mins)^(1/n) * sqrt(n) * (1 + sqrt(5))/2
            ru&#91;i, j] = sum(mins) * (1 + sqrt(5))/(2 * sqrt(n))
            ru&#91;j, i] = ru&#91;i, j]
            rd&#91;j, i] = rd&#91;i, j]
        }
    }
    return(list(rd = rd, ru = ru))
}
&#91;</code></pre>



<pre class="wp-block-code has-small-font-size"><code>function &#91;rd,ru] = tlc2d(rf)

&#91;n,p] = size(rf);
ru = zeros(p,p);
rd = zeros(p,p);

for i = 1:p
 for j = i:p
	X = rf(:,&#91;i j]);
	first = reshape(X,1,n,2);
        second = reshape(X,n,1,2);
	dists = sqrt(sum((first(ones(n,1),:,:) - second(:,ones(n,1),:)).^2,3));
	for k = 1:n
		dists(k,k) = 1;
	end
	dists = &#91;dists ; X'];
	dists = &#91;dists ; 1.-X'];
	mins = min(dists);
	rd(i,j) = sqrt(n).*(1+sqrt(5))./2 .* prod(mins).^(1/n);
	ru(i,j) = (1+sqrt(5))./(2.*sqrt(n)) .* sum(mins);
	rd(j,i) = rd(i,j); ru(j,i) = ru(i,j);
  end
end

end
</code></pre>



<p>The argument of the function is a matrix of RF values (rows corresponds to compounds, columns to systems). Two distance-like matrices are computed, one for RU values, another for RD, for all combinations between the systems.</p>



<p>If you use these criteria, cite following paper: <a href="https://dx.doi.org/10.1556/AChrom.20.2008.3.2">10.1556/AChrom.20.2008.3.2</a></p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Directional median analysis</title>
		<link>https://www.komsta.net/directional-median-analysis/</link>
		
		<dc:creator><![CDATA[Ł K]]></dc:creator>
		<pubDate>Tue, 09 Jan 2024 10:28:50 +0000</pubDate>
				<category><![CDATA[Uncategorized]]></category>
		<guid isPermaLink="false">https://www.komsta.net/?p=43</guid>

					<description><![CDATA[Below you can find R and Matlab code snippets for DMA. It is a new unsupervised data exploration method concept, fitting directions by explaining structure of the majority of data objects, regardless of the distribution and variance of whole data set. Theory and algorithm is explained in (10.1016/j.chemolab.2016.03.005). R snippet centers data with l1median_BFGS, so [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p>Below you can find R and Matlab code snippets for DMA.</p>



<p>It is a new unsupervised data exploration method concept, fitting directions by explaining structure of the majority of data objects, regardless of the distribution and variance of whole data set. Theory and algorithm is explained in (<a href="https://doi.org/10.1016/j.chemolab.2016.03.005">10.1016/j.chemolab.2016.03.005</a>).</p>



<p>R snippet centers data with l1median_BFGS, so it requires pcaPP package to be loaded. The returned object is analogous to prcomp() result, therefore standard commands such as summary(), biplot() etc. can be used.</p>



<pre class="wp-block-code has-small-font-size"><code>dma &lt;- function(x, center = l1median_BFGS(x)$par, scale = FALSE,
                tol = 1e-06, maxiter = 200) {
    x &lt;- as.matrix(x)
    x &lt;- scale(x, center = center, scale = scale)
    cen &lt;- attr(x, "scaled:center")
    sc &lt;- attr(x, "scaled:scale")
    k &lt;- min(dim(x))
    X &lt;- x
    P &lt;- matrix(NA, ncol(x), k)
    for (i in 1:nrow(x)) {
        cp &lt;- sqrt(crossprod(x&#91;i, ]))
        if (cp != 0)
            x&#91;i, ] &lt;- x&#91;i, ]/cp
    }
    for (i in 1:k) {
        w &lt;- rep(1, nrow(x))
        t &lt;- 10
        it &lt;- 0
        while ((t &gt; tol) &amp;&amp; (it &lt; maxiter)) {
            s &lt;- svd(diag(w) %*% x)
            r &lt;- sqrt(apply((x %*% s$v&#91;, -1])^2, 1, sum))
            r&#91;r &lt; 0.01] &lt;- 0.01
            r&#91;r &gt; 0.98] &lt;- 0.98
            ow &lt;- w
            w &lt;- r * sqrt(1 - r^2)
            w &lt;- 1/w
            w &lt;- w/sqrt(crossprod(w))
            t &lt;- sum((ow - w)^2)
            it &lt;- it + 1
        }
        P&#91;, i] = s$v&#91;, 1]
        x &lt;- x - x %*% tcrossprod(P&#91;, i])
    }
    dimnames(P) &lt;- list(colnames(x), paste0("DM", seq_len(ncol(P))))
    T &lt;- X %*% P
    r &lt;- list(x = T, sdev = apply(T, 2, sd), rotation = P,
              center = if (is.null(cen)) FALSE else cen,
              scale = if (is.null(sc)) FALSE else sc)
    class(r) &lt;- "prcomp"
    return(r)
}</code></pre>



<p>The MATLAB snippet below does not center the data, so user must manually compute L1Median and center the data before calling this function. Scores are returned as T, loadings as P and S contain standard deviations.</p>



<pre class="wp-block-code has-small-font-size"><code>function &#91;T,P,S] = dma(x,tol,maxiter)
    if nargin&lt;3
        maxiter = 100;
    end
    if nargin&lt;2
        tol = 1e-6;
    end
    k = min(size(x));
    X = x;
    P = repmat(NaN, size(x,2), k);
    for i=1:size(x,1)
        cp = sqrt(x(i,:)*x(i,:)');
        if (cp ~= 0)
            x(i,:) = x(i,:)./cp;
        end
    end
    for i=1:k
        w = repmat(1, 1, size(x,1));
        t = 10;
        it = 0;
        while ((t &gt; tol) &amp;&amp; (it &lt; maxiter))
            &#91;U,S,V] = svd(diag(w)*x);
            r = sqrt(sum((x*V(:,2:end)).^2,2));
            r(r &lt; 0.01) = 0.01;
            r(r &gt; 0.98) = 0.98;
            ow = w;
            w = r .* sqrt(1 - r.^2);
            w = (1./w)';
            w = w./sqrt(w*w');
            t = sum((ow - w).^2);
            it = it + 1;
        end
        P(:,i) = V(:,1);
        x = x - x*P(:,i)*P(:,i)';
    end
    T = X*P;
    S = std(P);
end</code></pre>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>