<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wikidot="http://www.wikidot.com/rss-namespace">

	<channel>
		<title>%%CATEGORY%%:rss</title>
		<link>https://ccckmit.wikidot.com</link>
		<description>陳鍾誠的首頁 -- 金門大學 資訊工程系</description>
				<copyright></copyright>
		<lastBuildDate>Sun, 08 Nov 2026 20:58:06 +0000</lastBuildDate>
		
					<item>
				<guid>http://ccckmit.wikidot.com/r:logic</guid>
				<title>邏輯推論</title>
				<link>https://ccckmit.wikidot.com/r:logic</link>
				<description>

&lt;ol&gt;
&lt;li&gt;Generalized and Customizable Sets in R
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://cran.r-project.org/web/packages/sets/vignettes/sets.pdf&quot;&gt;http://cran.r-project.org/web/packages/sets/vignettes/sets.pdf&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://cran.r-project.org/web/packages/sets/&quot;&gt;http://cran.r-project.org/web/packages/sets/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://stackoverflow.com/questions/15197613/fuzzy-logic-function-in-r-as-in-matlab&quot;&gt;http://stackoverflow.com/questions/15197613/fuzzy-logic-function-in-r-as-in-matlab&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;FuzzyToolkitUoN : Type 1 Fuzzy Logic Toolkit
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://cran.r-project.org/web/packages/FuzzyToolkitUoN/index.html&quot;&gt;http://cran.r-project.org/web/packages/FuzzyToolkitUoN/index.html&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h1&gt;&lt;span&gt;非 R 的資源&lt;/span&gt;&lt;/h1&gt;
&lt;ul&gt;
&lt;li&gt;電子書：Learn Prolog Now! &amp;#8212; &lt;a href=&quot;http://www.learnprolognow.org/lpnpage.php?pageid=online&quot;&gt;http://www.learnprolognow.org/lpnpage.php?pageid=online&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.swi-prolog.org/&quot;&gt;http://www.swi-prolog.org/&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://www.swi-prolog.org/pldoc/package/R.html&quot;&gt;http://www.swi-prolog.org/pldoc/package/R.html&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;電子書：&lt;a href=&quot;http://en.wikibooks.org/wiki/Prolog&quot;&gt;http://en.wikibooks.org/wiki/Prolog&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.cs.ox.ac.uk/activities/machlearn/Aleph/aleph.html&quot;&gt;http://www.cs.ox.ac.uk/activities/machlearn/Aleph/aleph.html&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;A Learning Engine for Proposing Hypotheses (Aleph)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;B-Prolog &amp;#8212; &lt;a href=&quot;http://www.probp.com/&quot;&gt;http://www.probp.com/&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h1&gt;&lt;span&gt;文章&lt;/span&gt;&lt;/h1&gt;
&lt;ul&gt;
&lt;li&gt;Prolog 入門 (作者： KuoE0) &amp;#8212; &lt;a href=&quot;http://programmermagazine.github.io/201308/htm/article3.html&quot;&gt;http://programmermagazine.github.io/201308/htm/article3.html&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;R 與 Prolog 連接 &amp;#8212; &lt;a href=&quot;https://github.com/lamby/pkg-swi-prolog/blob/master/packages/R/R.pl&quot;&gt;https://github.com/lamby/pkg-swi-prolog/blob/master/packages/R/R.pl&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;by &lt;span class=&quot;printuser avatarhover&quot;&gt;&lt;a href=&quot;https://www.wikidot.com/user:info/ccckmit&quot;  &gt;&lt;img class=&quot;small&quot; src=&quot;https://www.wikidot.com/avatar.php?userid=296763&amp;amp;amp;size=small&amp;amp;amp;timestamp=1794171486&quot; alt=&quot;ccckmit&quot; style=&quot;background-image:url(https://www.wikidot.com/userkarma.php?u=296763)&quot; /&gt;&lt;/a&gt;&lt;a href=&quot;https://www.wikidot.com/user:info/ccckmit&quot;  &gt;ccckmit&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
</description>
				<pubDate>Mon, 20 Jan 2014 06:33:29 +0000</pubDate>
												<content:encoded>
					<![CDATA[
						 <ol> <li>Generalized and Customizable Sets in R <ul> <li><a href="http://cran.r-project.org/web/packages/sets/vignettes/sets.pdf">http://cran.r-project.org/web/packages/sets/vignettes/sets.pdf</a></li> <li><a href="http://cran.r-project.org/web/packages/sets/">http://cran.r-project.org/web/packages/sets/</a></li> <li><a href="http://stackoverflow.com/questions/15197613/fuzzy-logic-function-in-r-as-in-matlab">http://stackoverflow.com/questions/15197613/fuzzy-logic-function-in-r-as-in-matlab</a></li> </ul> </li> <li>FuzzyToolkitUoN : Type 1 Fuzzy Logic Toolkit <ul> <li><a href="http://cran.r-project.org/web/packages/FuzzyToolkitUoN/index.html">http://cran.r-project.org/web/packages/FuzzyToolkitUoN/index.html</a></li> </ul> </li> </ol> <h1><span>非 R 的資源</span></h1> <ul> <li>電子書：Learn Prolog Now! &#8212; <a href="http://www.learnprolognow.org/lpnpage.php?pageid=online">http://www.learnprolognow.org/lpnpage.php?pageid=online</a></li> <li><a href="http://www.swi-prolog.org/">http://www.swi-prolog.org/</a> <ul> <li><a href="http://www.swi-prolog.org/pldoc/package/R.html">http://www.swi-prolog.org/pldoc/package/R.html</a></li> </ul> </li> <li>電子書：<a href="http://en.wikibooks.org/wiki/Prolog">http://en.wikibooks.org/wiki/Prolog</a></li> <li><a href="http://www.cs.ox.ac.uk/activities/machlearn/Aleph/aleph.html">http://www.cs.ox.ac.uk/activities/machlearn/Aleph/aleph.html</a> <ul> <li>A Learning Engine for Proposing Hypotheses (Aleph)</li> </ul> </li> <li>B-Prolog &#8212; <a href="http://www.probp.com/">http://www.probp.com/</a></li> </ul> <h1><span>文章</span></h1> <ul> <li>Prolog 入門 (作者： KuoE0) &#8212; <a href="http://programmermagazine.github.io/201308/htm/article3.html">http://programmermagazine.github.io/201308/htm/article3.html</a></li> <li>R 與 Prolog 連接 &#8212; <a href="https://github.com/lamby/pkg-swi-prolog/blob/master/packages/R/R.pl">https://github.com/lamby/pkg-swi-prolog/blob/master/packages/R/R.pl</a></li> </ul> <p>by <span class="printuser avatarhover"><a href="https://www.wikidot.com/user:info/ccckmit" ><img class="small" src="https://www.wikidot.com/avatar.php?userid=296763&amp;amp;size=small&amp;amp;timestamp=1794171486" alt="ccckmit" style="background-image:url(https://www.wikidot.com/userkarma.php?u=296763)" /></a><a href="https://www.wikidot.com/user:info/ccckmit" >ccckmit</a></span></p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://ccckmit.wikidot.com/r:ai</guid>
				<title>R 軟體與人工智慧</title>
				<link>https://ccckmit.wikidot.com/r:ai</link>
				<description>

&lt;ul&gt;
&lt;li&gt;Artificial Intelligence: foundations of computational agents &amp;#8212; 這本 Online 的 AI 書好棒 ！
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://artint.info/online.html&quot;&gt;http://artint.info/online.html&lt;/a&gt; (包含程式碼)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ol&gt;
&lt;li&gt;&lt;a href=&quot;https://ccckmit.wikidot.com/r:optimize&quot;&gt;優化&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://ccckmit.wikidot.com/r:mle&quot;&gt;最大似然估計&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class=&quot;newpage&quot; href=&quot;https://ccckmit.wikidot.com/r:lagrange&quot;&gt;拉格朗日乘數&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://ccckmit.wikidot.com/r:decisiontree&quot;&gt;決策樹&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class=&quot;newpage&quot; href=&quot;https://ccckmit.wikidot.com/r:kelmanfiltering&quot;&gt;卡爾曼率波&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://ccckmit.wikidot.com/r:clustering&quot;&gt;分群&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class=&quot;newpage&quot; href=&quot;https://ccckmit.wikidot.com/r:classification&quot;&gt;分類&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://ccckmit.wikidot.com/r:svm&quot;&gt;SVM 向量機&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://ccckmit.wikidot.com/r:nerual&quot;&gt;神經網路&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://ccckmit.wikidot.com/r:ga&quot;&gt;遺傳演算法&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://ccckmit.wikidot.com/r:datamining&quot;&gt;資料採礦&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://ccckmit.wikidot.com/r:image&quot;&gt;影像處理&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://ccckmit.wikidot.com/r:voice&quot;&gt;語音處理&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://ccckmit.wikidot.com/r:nlp&quot;&gt;自然語言&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://ccckmit.wikidot.com/r:learning&quot;&gt;機器學習&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class=&quot;newpage&quot; href=&quot;https://ccckmit.wikidot.com/r:robotics&quot;&gt;機器人&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;by &lt;span class=&quot;printuser avatarhover&quot;&gt;&lt;a href=&quot;https://www.wikidot.com/user:info/ccckmit&quot;  &gt;&lt;img class=&quot;small&quot; src=&quot;https://www.wikidot.com/avatar.php?userid=296763&amp;amp;amp;size=small&amp;amp;amp;timestamp=1794171486&quot; alt=&quot;ccckmit&quot; style=&quot;background-image:url(https://www.wikidot.com/userkarma.php?u=296763)&quot; /&gt;&lt;/a&gt;&lt;a href=&quot;https://www.wikidot.com/user:info/ccckmit&quot;  &gt;ccckmit&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
</description>
				<pubDate>Wed, 26 Oct 2011 05:12:33 +0000</pubDate>
												<content:encoded>
					<![CDATA[
						 <ul> <li>Artificial Intelligence: foundations of computational agents &#8212; 這本 Online 的 AI 書好棒 ！ <ul> <li><a href="http://artint.info/online.html">http://artint.info/online.html</a> (包含程式碼)</li> </ul> </li> </ul> <ol> <li><a href="https://ccckmit.wikidot.com/r:optimize">優化</a></li> <li><a href="https://ccckmit.wikidot.com/r:mle">最大似然估計</a></li> <li><a class="newpage" href="https://ccckmit.wikidot.com/r:lagrange">拉格朗日乘數</a></li> <li><a href="https://ccckmit.wikidot.com/r:decisiontree">決策樹</a></li> <li><a class="newpage" href="https://ccckmit.wikidot.com/r:kelmanfiltering">卡爾曼率波</a></li> <li><a href="https://ccckmit.wikidot.com/r:clustering">分群</a></li> <li><a class="newpage" href="https://ccckmit.wikidot.com/r:classification">分類</a></li> <li><a href="https://ccckmit.wikidot.com/r:svm">SVM 向量機</a></li> <li><a href="https://ccckmit.wikidot.com/r:nerual">神經網路</a></li> <li><a href="https://ccckmit.wikidot.com/r:ga">遺傳演算法</a></li> <li><a href="https://ccckmit.wikidot.com/r:datamining">資料採礦</a></li> <li><a href="https://ccckmit.wikidot.com/r:image">影像處理</a></li> <li><a href="https://ccckmit.wikidot.com/r:voice">語音處理</a></li> <li><a href="https://ccckmit.wikidot.com/r:nlp">自然語言</a></li> <li><a href="https://ccckmit.wikidot.com/r:learning">機器學習</a></li> <li><a class="newpage" href="https://ccckmit.wikidot.com/r:robotics">機器人</a></li> </ol> <p>by <span class="printuser avatarhover"><a href="https://www.wikidot.com/user:info/ccckmit" ><img class="small" src="https://www.wikidot.com/avatar.php?userid=296763&amp;amp;size=small&amp;amp;timestamp=1794171486" alt="ccckmit" style="background-image:url(https://www.wikidot.com/userkarma.php?u=296763)" /></a><a href="https://www.wikidot.com/user:info/ccckmit" >ccckmit</a></span></p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://ccckmit.wikidot.com/r:prob-logic</guid>
				<title>機率式邏輯推論</title>
				<link>https://ccckmit.wikidot.com/r:prob-logic</link>
				<description>

&lt;h1&gt;&lt;span&gt;非 R 的資源&lt;/span&gt;&lt;/h1&gt;
&lt;ul&gt;
&lt;li&gt;PRISM : programming language intended for symbolic-statistical modeling
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://sato-www.cs.titech.ac.jp/prism/download/prism-intro.pdf&quot;&gt;http://sato-www.cs.titech.ac.jp/prism/download/prism-intro.pdf&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Probabilistic logic programs are logic programs in which some of the facts are annotated with probabilities.
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://dtai.cs.kuleuven.be/problog/&quot;&gt;http://dtai.cs.kuleuven.be/problog/&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;by &lt;span class=&quot;printuser avatarhover&quot;&gt;&lt;a href=&quot;https://www.wikidot.com/user:info/ccckmit&quot;  &gt;&lt;img class=&quot;small&quot; src=&quot;https://www.wikidot.com/avatar.php?userid=296763&amp;amp;amp;size=small&amp;amp;amp;timestamp=1794171486&quot; alt=&quot;ccckmit&quot; style=&quot;background-image:url(https://www.wikidot.com/userkarma.php?u=296763)&quot; /&gt;&lt;/a&gt;&lt;a href=&quot;https://www.wikidot.com/user:info/ccckmit&quot;  &gt;ccckmit&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
</description>
				<pubDate>Mon, 20 Jan 2014 06:57:18 +0000</pubDate>
												<content:encoded>
					<![CDATA[
						 <h1><span>非 R 的資源</span></h1> <ul> <li>PRISM : programming language intended for symbolic-statistical modeling <ul> <li><a href="http://sato-www.cs.titech.ac.jp/prism/download/prism-intro.pdf">http://sato-www.cs.titech.ac.jp/prism/download/prism-intro.pdf</a></li> </ul> </li> <li>Probabilistic logic programs are logic programs in which some of the facts are annotated with probabilities. <ul> <li><a href="http://dtai.cs.kuleuven.be/problog/">http://dtai.cs.kuleuven.be/problog/</a></li> </ul> </li> </ul> <p>by <span class="printuser avatarhover"><a href="https://www.wikidot.com/user:info/ccckmit" ><img class="small" src="https://www.wikidot.com/avatar.php?userid=296763&amp;amp;size=small&amp;amp;timestamp=1794171486" alt="ccckmit" style="background-image:url(https://www.wikidot.com/userkarma.php?u=296763)" /></a><a href="https://www.wikidot.com/user:info/ccckmit" >ccckmit</a></span></p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://ccckmit.wikidot.com/r:fuzzy</guid>
				<title>Fuzzy</title>
				<link>https://ccckmit.wikidot.com/r:fuzzy</link>
				<description>

&lt;ol&gt;
&lt;li&gt;Generalized and Customizable Sets in R
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://cran.r-project.org/web/packages/sets/vignettes/sets.pdf&quot;&gt;http://cran.r-project.org/web/packages/sets/vignettes/sets.pdf&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://cran.r-project.org/web/packages/sets/&quot;&gt;http://cran.r-project.org/web/packages/sets/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://stackoverflow.com/questions/15197613/fuzzy-logic-function-in-r-as-in-matlab&quot;&gt;http://stackoverflow.com/questions/15197613/fuzzy-logic-function-in-r-as-in-matlab&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;FuzzyToolkitUoN : Type 1 Fuzzy Logic Toolkit
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://cran.r-project.org/web/packages/FuzzyToolkitUoN/index.html&quot;&gt;http://cran.r-project.org/web/packages/FuzzyToolkitUoN/index.html&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;by &lt;span class=&quot;printuser avatarhover&quot;&gt;&lt;a href=&quot;https://www.wikidot.com/user:info/ccckmit&quot;  &gt;&lt;img class=&quot;small&quot; src=&quot;https://www.wikidot.com/avatar.php?userid=296763&amp;amp;amp;size=small&amp;amp;amp;timestamp=1794171486&quot; alt=&quot;ccckmit&quot; style=&quot;background-image:url(https://www.wikidot.com/userkarma.php?u=296763)&quot; /&gt;&lt;/a&gt;&lt;a href=&quot;https://www.wikidot.com/user:info/ccckmit&quot;  &gt;ccckmit&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
</description>
				<pubDate>Mon, 20 Jan 2014 06:54:32 +0000</pubDate>
												<content:encoded>
					<![CDATA[
						 <ol> <li>Generalized and Customizable Sets in R <ul> <li><a href="http://cran.r-project.org/web/packages/sets/vignettes/sets.pdf">http://cran.r-project.org/web/packages/sets/vignettes/sets.pdf</a></li> <li><a href="http://cran.r-project.org/web/packages/sets/">http://cran.r-project.org/web/packages/sets/</a></li> <li><a href="http://stackoverflow.com/questions/15197613/fuzzy-logic-function-in-r-as-in-matlab">http://stackoverflow.com/questions/15197613/fuzzy-logic-function-in-r-as-in-matlab</a></li> </ul> </li> <li>FuzzyToolkitUoN : Type 1 Fuzzy Logic Toolkit <ul> <li><a href="http://cran.r-project.org/web/packages/FuzzyToolkitUoN/index.html">http://cran.r-project.org/web/packages/FuzzyToolkitUoN/index.html</a></li> </ul> </li> </ol> <p>by <span class="printuser avatarhover"><a href="https://www.wikidot.com/user:info/ccckmit" ><img class="small" src="https://www.wikidot.com/avatar.php?userid=296763&amp;amp;size=small&amp;amp;timestamp=1794171486" alt="ccckmit" style="background-image:url(https://www.wikidot.com/userkarma.php?u=296763)" /></a><a href="https://www.wikidot.com/user:info/ccckmit" >ccckmit</a></span></p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://ccckmit.wikidot.com/r:bayesnet</guid>
				<title>貝氏網路</title>
				<link>https://ccckmit.wikidot.com/r:bayesnet</link>
				<description>

&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://cran.r-project.org/web/views/Bayesian.html&quot;&gt;http://cran.r-project.org/web/views/Bayesian.html&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://cran.r-project.org/web/packages/LearnBayes/index.html&quot;&gt;http://cran.r-project.org/web/packages/LearnBayes/index.html&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://cran.r-project.org/web/packages/LearnBayes/LearnBayes.pdf&quot;&gt;http://cran.r-project.org/web/packages/LearnBayes/LearnBayes.pdf&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.jstatsoft.org/v35/i03/paper&quot;&gt;http://www.jstatsoft.org/v35/i03/paper&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://cran.r-project.org/web/packages/G1DBN/index.html&quot;&gt;http://cran.r-project.org/web/packages/G1DBN/index.html&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.bnlearn.com/&quot;&gt;http://www.bnlearn.com/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://bms.zeugner.eu/&quot;&gt;http://bms.zeugner.eu/&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://www.youtube.com/watch?v=acvKaC5vgII&quot;&gt;http://www.youtube.com/watch?v=acvKaC5vgII&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://blog.revolutionanalytics.com/2013/11/r-and-bayesian-statistics.html&quot;&gt;http://blog.revolutionanalytics.com/2013/11/r-and-bayesian-statistics.html&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.r-inla.org/&quot;&gt;http://www.r-inla.org/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Naive Bayes with R &amp;#8212; &lt;a href=&quot;http://www-users.cs.york.ac.uk/~jc/teaching/arin/R_practical/&quot;&gt;http://www-users.cs.york.ac.uk/~jc/teaching/arin/R_practical/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://en.wikibooks.org/wiki/Data_Mining_Algorithms_In_R/Classification/Na%C3%AFve_Bayes&quot;&gt;http://en.wikibooks.org/wiki/Data_Mining_Algorithms_In_R/Classification/Na%C3%AFve_Bayes&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://en.wikibooks.org/wiki/Data_Mining_Algorithms_In_R&quot;&gt;http://en.wikibooks.org/wiki/Data_Mining_Algorithms_In_R&lt;/a&gt; (讚！)&lt;/li&gt;
&lt;li&gt;MCMC : &lt;a href=&quot;http://cran.r-project.org/web/packages/mcmc/vignettes/demo.pdf&quot;&gt;http://cran.r-project.org/web/packages/mcmc/vignettes/demo.pdf&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h1&gt;&lt;span&gt;簡單貝氏分類器 (Naive Bayes Classifier)&lt;/span&gt;&lt;/h1&gt;
&lt;p&gt;&lt;a href=&quot;http://cran.r-project.org/web/packages/e1071/e1071.pdf&quot;&gt;http://cran.r-project.org/web/packages/e1071/e1071.pdf&lt;/a&gt;&lt;/p&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;pre&gt;&lt;code&gt;install.packages(&#039;e1071&#039;)
## Categorical data only:
data(HouseVotes84, package = &amp;quot;mlbench&amp;quot;)
model &amp;lt;- naiveBayes(Class ~ ., data = HouseVotes84)
predict(model, HouseVotes84[1:10,])
predict(model, HouseVotes84[1:10,], type = &amp;quot;raw&amp;quot;)
pred &amp;lt;- predict(model, HouseVotes84)
table(pred, HouseVotes84$Class)
## using laplace smoothing:
model &amp;lt;- naiveBayes(Class ~ ., data = HouseVotes84, laplace = 3)
pred &amp;lt;- predict(model, HouseVotes84[,-1])
table(pred, HouseVotes84$Class)
## Example of using a contingency table:
data(Titanic)
m &amp;lt;- naiveBayes(Survived ~ ., data = Titanic)
m
predict(m, as.data.frame(Titanic))
## Example with metric predictors:
data(iris)
m &amp;lt;- naiveBayes(Species ~ ., data = iris)
## alternatively:
m &amp;lt;- naiveBayes(iris[,-5], iris[,5])
m
table(predict(m, iris), iris[,5])&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;by &lt;span class=&quot;printuser avatarhover&quot;&gt;&lt;a href=&quot;https://www.wikidot.com/user:info/ccckmit&quot;  &gt;&lt;img class=&quot;small&quot; src=&quot;https://www.wikidot.com/avatar.php?userid=296763&amp;amp;amp;size=small&amp;amp;amp;timestamp=1794171486&quot; alt=&quot;ccckmit&quot; style=&quot;background-image:url(https://www.wikidot.com/userkarma.php?u=296763)&quot; /&gt;&lt;/a&gt;&lt;a href=&quot;https://www.wikidot.com/user:info/ccckmit&quot;  &gt;ccckmit&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
</description>
				<pubDate>Fri, 20 Dec 2013 09:23:09 +0000</pubDate>
												<content:encoded>
					<![CDATA[
						 <ul> <li><a href="http://cran.r-project.org/web/views/Bayesian.html">http://cran.r-project.org/web/views/Bayesian.html</a> <ul> <li><a href="http://cran.r-project.org/web/packages/LearnBayes/index.html">http://cran.r-project.org/web/packages/LearnBayes/index.html</a></li> <li><a href="http://cran.r-project.org/web/packages/LearnBayes/LearnBayes.pdf">http://cran.r-project.org/web/packages/LearnBayes/LearnBayes.pdf</a></li> <li><a href="http://www.jstatsoft.org/v35/i03/paper">http://www.jstatsoft.org/v35/i03/paper</a></li> <li><a href="http://cran.r-project.org/web/packages/G1DBN/index.html">http://cran.r-project.org/web/packages/G1DBN/index.html</a></li> <li><a href="http://www.bnlearn.com/">http://www.bnlearn.com/</a></li> <li><a href="http://bms.zeugner.eu/">http://bms.zeugner.eu/</a> <ul> <li><a href="http://www.youtube.com/watch?v=acvKaC5vgII">http://www.youtube.com/watch?v=acvKaC5vgII</a></li> </ul> </li> <li><a href="http://blog.revolutionanalytics.com/2013/11/r-and-bayesian-statistics.html">http://blog.revolutionanalytics.com/2013/11/r-and-bayesian-statistics.html</a></li> <li><a href="http://www.r-inla.org/">http://www.r-inla.org/</a></li> <li>Naive Bayes with R &#8212; <a href="http://www-users.cs.york.ac.uk/~jc/teaching/arin/R_practical/">http://www-users.cs.york.ac.uk/~jc/teaching/arin/R_practical/</a></li> <li><a href="http://en.wikibooks.org/wiki/Data_Mining_Algorithms_In_R/Classification/Na%C3%AFve_Bayes">http://en.wikibooks.org/wiki/Data_Mining_Algorithms_In_R/Classification/Na%C3%AFve_Bayes</a></li> <li><a href="http://en.wikibooks.org/wiki/Data_Mining_Algorithms_In_R">http://en.wikibooks.org/wiki/Data_Mining_Algorithms_In_R</a> (讚！)</li> <li>MCMC : <a href="http://cran.r-project.org/web/packages/mcmc/vignettes/demo.pdf">http://cran.r-project.org/web/packages/mcmc/vignettes/demo.pdf</a></li> </ul> </li> </ul> <h1><span>簡單貝氏分類器 (Naive Bayes Classifier)</span></h1> <p><a href="http://cran.r-project.org/web/packages/e1071/e1071.pdf">http://cran.r-project.org/web/packages/e1071/e1071.pdf</a></p> <div class="code"> <pre><code>install.packages('e1071') ## Categorical data only: data(HouseVotes84, package = &quot;mlbench&quot;) model &lt;- naiveBayes(Class ~ ., data = HouseVotes84) predict(model, HouseVotes84[1:10,]) predict(model, HouseVotes84[1:10,], type = &quot;raw&quot;) pred &lt;- predict(model, HouseVotes84) table(pred, HouseVotes84$Class) ## using laplace smoothing: model &lt;- naiveBayes(Class ~ ., data = HouseVotes84, laplace = 3) pred &lt;- predict(model, HouseVotes84[,-1]) table(pred, HouseVotes84$Class) ## Example of using a contingency table: data(Titanic) m &lt;- naiveBayes(Survived ~ ., data = Titanic) m predict(m, as.data.frame(Titanic)) ## Example with metric predictors: data(iris) m &lt;- naiveBayes(Species ~ ., data = iris) ## alternatively: m &lt;- naiveBayes(iris[,-5], iris[,5]) m table(predict(m, iris), iris[,5])</code></pre></div> <p>by <span class="printuser avatarhover"><a href="https://www.wikidot.com/user:info/ccckmit" ><img class="small" src="https://www.wikidot.com/avatar.php?userid=296763&amp;amp;size=small&amp;amp;timestamp=1794171486" alt="ccckmit" style="background-image:url(https://www.wikidot.com/userkarma.php?u=296763)" /></a><a href="https://www.wikidot.com/user:info/ccckmit" >ccckmit</a></span></p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://ccckmit.wikidot.com/r:set</guid>
				<title>集合</title>
				<link>https://ccckmit.wikidot.com/r:set</link>
				<description>

&lt;ol&gt;
&lt;li&gt;Generalized and Customizable Sets in R
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://cran.r-project.org/web/packages/sets/vignettes/sets.pdf&quot;&gt;http://cran.r-project.org/web/packages/sets/vignettes/sets.pdf&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://cran.r-project.org/web/packages/sets/&quot;&gt;http://cran.r-project.org/web/packages/sets/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://stackoverflow.com/questions/15197613/fuzzy-logic-function-in-r-as-in-matlab&quot;&gt;http://stackoverflow.com/questions/15197613/fuzzy-logic-function-in-r-as-in-matlab&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;by &lt;span class=&quot;printuser avatarhover&quot;&gt;&lt;a href=&quot;https://www.wikidot.com/user:info/ccckmit&quot;  &gt;&lt;img class=&quot;small&quot; src=&quot;https://www.wikidot.com/avatar.php?userid=296763&amp;amp;amp;size=small&amp;amp;amp;timestamp=1794171486&quot; alt=&quot;ccckmit&quot; style=&quot;background-image:url(https://www.wikidot.com/userkarma.php?u=296763)&quot; /&gt;&lt;/a&gt;&lt;a href=&quot;https://www.wikidot.com/user:info/ccckmit&quot;  &gt;ccckmit&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
</description>
				<pubDate>Mon, 20 Jan 2014 06:32:07 +0000</pubDate>
												<content:encoded>
					<![CDATA[
						 <ol> <li>Generalized and Customizable Sets in R <ul> <li><a href="http://cran.r-project.org/web/packages/sets/vignettes/sets.pdf">http://cran.r-project.org/web/packages/sets/vignettes/sets.pdf</a></li> </ul> </li> <li><a href="http://cran.r-project.org/web/packages/sets/">http://cran.r-project.org/web/packages/sets/</a></li> <li><a href="http://stackoverflow.com/questions/15197613/fuzzy-logic-function-in-r-as-in-matlab">http://stackoverflow.com/questions/15197613/fuzzy-logic-function-in-r-as-in-matlab</a></li> </ol> <p>by <span class="printuser avatarhover"><a href="https://www.wikidot.com/user:info/ccckmit" ><img class="small" src="https://www.wikidot.com/avatar.php?userid=296763&amp;amp;size=small&amp;amp;timestamp=1794171486" alt="ccckmit" style="background-image:url(https://www.wikidot.com/userkarma.php?u=296763)" /></a><a href="https://www.wikidot.com/user:info/ccckmit" >ccckmit</a></span></p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://ccckmit.wikidot.com/r:web</guid>
				<title>R 統計軟體與網頁程式</title>
				<link>https://ccckmit.wikidot.com/r:web</link>
				<description>

&lt;ul&gt;
&lt;li&gt;Shiny &amp;#8212; &lt;a href=&quot;http://rstudio.github.io/shiny/tutorial/&quot;&gt;http://rstudio.github.io/shiny/tutorial/&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://rstudio.github.io/shiny/tutorial/&quot;&gt;http://rstudio.github.io/shiny/tutorial/&lt;/a&gt; (讚！)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://rpubs.com/&quot;&gt;http://rpubs.com/&lt;/a&gt; &amp;#8212; 用 Rmarkdown 寫，直接在網頁上出版！
&lt;ul&gt;
&lt;li&gt;必須安裝 Rstudio &amp;#8212; &lt;a href=&quot;http://www.rstudio.com/&quot;&gt;http://www.rstudio.com/&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;順序、先安裝 R，然後裝 Rstudio，再用下列指令裝 knitr 。&lt;/p&gt;
&lt;p&gt;install.packages(&#039;knitr&#039;, dependencies = TRUE)&lt;/p&gt;
&lt;h1&gt;&lt;span&gt;WebServer&lt;/span&gt;&lt;/h1&gt;
&lt;ol&gt;
&lt;li&gt;R 官方蒐集列表
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://cran.r-project.org/doc/FAQ/R-FAQ.html#R-Web-Interfaces&quot;&gt;http://cran.r-project.org/doc/FAQ/R-FAQ.html#R-Web-Interfaces&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Steve Chen 寫的R軟體簡單網頁操作界面程式，以 PHP 網頁程式語言為前端，R軟體為後端運算
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://steve-chen.net/R_PHP&quot;&gt;http://steve-chen.net/R_PHP&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Rweb is a Web based interface to R (a statistical analysis package) that takes the submitted code, runs R on the code (in batch mode), and returns the output (printed and graphical)
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://www.math.montana.edu/Rweb/&quot;&gt;http://www.math.montana.edu/Rweb/&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;R.rsp: Dynamic generation of scientific reports
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://cran.r-project.org/web/packages/R.rsp/index.html&quot;&gt;http://cran.r-project.org/web/packages/R.rsp/index.html&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Web interface for R and Octave
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://www.ms.uky.edu/~statweb/&quot;&gt;http://www.ms.uky.edu/~statweb/&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;rApache &amp;#8212; Web Application Development with R and Apache
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://rapache.net/&quot;&gt;http://rapache.net/&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;CGIwithR: CGI Programming in R
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://cran.r-project.org/web/packages/CGIwithR/index.html&quot;&gt;http://cran.r-project.org/web/packages/CGIwithR/index.html&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Rserve is a TCP/IP server which allows other programs to use facilities of R
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://www.rforge.net/Rserve/&quot;&gt;http://www.rforge.net/Rserve/&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h1&gt;&lt;span&gt;HTML, JavaScript, Browser&lt;/span&gt;&lt;/h1&gt;
&lt;ol&gt;
&lt;li&gt;websockets:HTML 5 Websocket Interface for R&lt;/li&gt;
&lt;li&gt;gWidgets gWidgets API for building toolkit-independent, interactive GUIs&lt;/li&gt;
&lt;li&gt;gWidgetsRGtk2:Toolkit implementation of gWidgets for RGtk2&lt;/li&gt;
&lt;li&gt;gWidgetsWWW:Toolkit implementation of the gWidgets API for use with web pages&lt;/li&gt;
&lt;li&gt;gWidgetstcltk:Toolkit implementation of gWidgets for tcltk package&lt;/li&gt;
&lt;li&gt;iWebPlots Interactive web-based plots&lt;/li&gt;
&lt;li&gt;RJSONIO Serialize R objects to JSON, JavaScript Object Notation&lt;/li&gt;
&lt;/ol&gt;
&lt;h1&gt;&lt;span&gt;XML, YAML,&lt;/span&gt;&lt;/h1&gt;
&lt;ol&gt;
&lt;li&gt;ascii Export R objects to several markup languages&lt;/li&gt;
&lt;li&gt;yaml Methods to convert R to YAML and back&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;by &lt;span class=&quot;printuser avatarhover&quot;&gt;&lt;a href=&quot;https://www.wikidot.com/user:info/ccckmit&quot;  &gt;&lt;img class=&quot;small&quot; src=&quot;https://www.wikidot.com/avatar.php?userid=296763&amp;amp;amp;size=small&amp;amp;amp;timestamp=1794171486&quot; alt=&quot;ccckmit&quot; style=&quot;background-image:url(https://www.wikidot.com/userkarma.php?u=296763)&quot; /&gt;&lt;/a&gt;&lt;a href=&quot;https://www.wikidot.com/user:info/ccckmit&quot;  &gt;ccckmit&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
</description>
				<pubDate>Sun, 04 Sep 2011 08:33:09 +0000</pubDate>
												<content:encoded>
					<![CDATA[
						 <ul> <li>Shiny &#8212; <a href="http://rstudio.github.io/shiny/tutorial/">http://rstudio.github.io/shiny/tutorial/</a> <ul> <li><a href="http://rstudio.github.io/shiny/tutorial/">http://rstudio.github.io/shiny/tutorial/</a> (讚！)</li> </ul> </li> <li><a href="http://rpubs.com/">http://rpubs.com/</a> &#8212; 用 Rmarkdown 寫，直接在網頁上出版！ <ul> <li>必須安裝 Rstudio &#8212; <a href="http://www.rstudio.com/">http://www.rstudio.com/</a></li> </ul> </li> </ul> <p>順序、先安裝 R，然後裝 Rstudio，再用下列指令裝 knitr 。</p> <p>install.packages('knitr', dependencies = TRUE)</p> <h1><span>WebServer</span></h1> <ol> <li>R 官方蒐集列表 <ul> <li><a href="http://cran.r-project.org/doc/FAQ/R-FAQ.html#R-Web-Interfaces">http://cran.r-project.org/doc/FAQ/R-FAQ.html#R-Web-Interfaces</a></li> </ul> </li> <li>Steve Chen 寫的R軟體簡單網頁操作界面程式，以 PHP 網頁程式語言為前端，R軟體為後端運算 <ul> <li><a href="http://steve-chen.net/R_PHP">http://steve-chen.net/R_PHP</a></li> </ul> </li> <li>Rweb is a Web based interface to R (a statistical analysis package) that takes the submitted code, runs R on the code (in batch mode), and returns the output (printed and graphical) <ul> <li><a href="http://www.math.montana.edu/Rweb/">http://www.math.montana.edu/Rweb/</a></li> </ul> </li> <li>R.rsp: Dynamic generation of scientific reports <ul> <li><a href="http://cran.r-project.org/web/packages/R.rsp/index.html">http://cran.r-project.org/web/packages/R.rsp/index.html</a></li> </ul> </li> <li>Web interface for R and Octave <ul> <li><a href="http://www.ms.uky.edu/~statweb/">http://www.ms.uky.edu/~statweb/</a></li> </ul> </li> <li>rApache &#8212; Web Application Development with R and Apache <ul> <li><a href="http://rapache.net/">http://rapache.net/</a></li> </ul> </li> <li>CGIwithR: CGI Programming in R <ul> <li><a href="http://cran.r-project.org/web/packages/CGIwithR/index.html">http://cran.r-project.org/web/packages/CGIwithR/index.html</a></li> </ul> </li> <li>Rserve is a TCP/IP server which allows other programs to use facilities of R <ul> <li><a href="http://www.rforge.net/Rserve/">http://www.rforge.net/Rserve/</a></li> </ul> </li> </ol> <h1><span>HTML, JavaScript, Browser</span></h1> <ol> <li>websockets:HTML 5 Websocket Interface for R</li> <li>gWidgets gWidgets API for building toolkit-independent, interactive GUIs</li> <li>gWidgetsRGtk2:Toolkit implementation of gWidgets for RGtk2</li> <li>gWidgetsWWW:Toolkit implementation of the gWidgets API for use with web pages</li> <li>gWidgetstcltk:Toolkit implementation of gWidgets for tcltk package</li> <li>iWebPlots Interactive web-based plots</li> <li>RJSONIO Serialize R objects to JSON, JavaScript Object Notation</li> </ol> <h1><span>XML, YAML,</span></h1> <ol> <li>ascii Export R objects to several markup languages</li> <li>yaml Methods to convert R to YAML and back</li> </ol> <p>by <span class="printuser avatarhover"><a href="https://www.wikidot.com/user:info/ccckmit" ><img class="small" src="https://www.wikidot.com/avatar.php?userid=296763&amp;amp;size=small&amp;amp;timestamp=1794171486" alt="ccckmit" style="background-image:url(https://www.wikidot.com/userkarma.php?u=296763)" /></a><a href="https://www.wikidot.com/user:info/ccckmit" >ccckmit</a></span></p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://ccckmit.wikidot.com/r:str</guid>
				<title>Str</title>
				<link>https://ccckmit.wikidot.com/r:str</link>
				<description>

&lt;p&gt;Function Description&lt;br /&gt;
substr(x, start=n1, stop=n2) Extract or replace substrings in a character vector.&lt;br /&gt;
x &amp;lt;- &amp;quot;abcdef&amp;quot;&lt;br /&gt;
substr(x, 2, 4) is &amp;quot;bcd&amp;quot;&lt;br /&gt;
substr(x, 2, 4) &amp;lt;- &amp;quot;22222&amp;quot; is &amp;quot;a222ef&amp;quot;&lt;br /&gt;
grep(pattern, x , ignore.case=FALSE, fixed=FALSE) Search for pattern in x. If fixed =FALSE then pattern is a regular expression. If fixed=TRUE then pattern is a text string. Returns matching indices.&lt;br /&gt;
grep(&amp;quot;A&amp;quot;, c(&amp;quot;b&amp;quot;,&amp;quot;A&amp;quot;,&amp;quot;c&amp;quot;), fixed=TRUE) returns 2&lt;br /&gt;
sub(pattern, replacement, x, ignore.case =FALSE, fixed=FALSE) Find pattern in x and replace with replacement text. If fixed=FALSE then pattern is a regular expression.&lt;br /&gt;
If fixed = T then pattern is a text string.&lt;br /&gt;
sub(&amp;quot;\\s&amp;quot;,&amp;quot;.&amp;quot;,&amp;quot;Hello There&amp;quot;) returns &amp;quot;Hello.There&amp;quot;&lt;br /&gt;
strsplit(x, split) Split the elements of character vector x at split.&lt;br /&gt;
strsplit(&amp;quot;abc&amp;quot;, &amp;quot;&amp;quot;) returns 3 element vector &amp;quot;a&amp;quot;,&amp;quot;b&amp;quot;,&amp;quot;c&amp;quot;&lt;br /&gt;
paste(&amp;#8230;, sep=&amp;quot;&amp;quot;) Concatenate strings after using sep string to seperate them.&lt;br /&gt;
paste(&amp;quot;x&amp;quot;,1:3,sep=&amp;quot;&amp;quot;) returns c(&amp;quot;x1&amp;quot;,&amp;quot;x2&amp;quot; &amp;quot;x3&amp;quot;)&lt;br /&gt;
paste(&amp;quot;x&amp;quot;,1:3,sep=&amp;quot;M&amp;quot;) returns c(&amp;quot;xM1&amp;quot;,&amp;quot;xM2&amp;quot; &amp;quot;xM3&amp;quot;)&lt;br /&gt;
paste(&amp;quot;Today is&amp;quot;, date())&lt;br /&gt;
toupper(x) Uppercase&lt;br /&gt;
tolower(x) Lowercase&lt;br /&gt;
sprintf(fmt, &amp;#8230;)&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://www.statmethods.net/management/functions.html&quot;&gt;http://www.statmethods.net/management/functions.html&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h1&gt;&lt;span&gt;字串連接&lt;/span&gt;&lt;/h1&gt;
&lt;blockquote&gt;
&lt;p&gt;tmp = paste(&amp;quot;GAD&amp;quot;, &amp;quot;AB&amp;quot;, sep = &amp;quot;,&amp;quot;)&lt;br /&gt;
tmp&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;[1] &amp;quot;GAD,AB&amp;quot;&lt;/p&gt;
&lt;h1&gt;&lt;span&gt;子字串&lt;/span&gt;&lt;/h1&gt;
&lt;p&gt;str(&amp;quot;abcdef&amp;quot;, 2, 4)&lt;br /&gt;
[1] &amp;quot;bcd&amp;quot;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;substring(&amp;quot;abcdef&amp;quot;, 1:6, 1:6)&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;[1] &amp;quot;a&amp;quot; &amp;quot;b&amp;quot; &amp;quot;c&amp;quot; &amp;quot;d&amp;quot; &amp;quot;e&amp;quot; &amp;quot;f&amp;quot;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;## strsplit is more efficient &amp;#8230;&lt;/p&gt;
&lt;p&gt;substr(rep(&amp;quot;abcdef&amp;quot;, 4), 1:4, 4:5)&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;[1] &amp;quot;abcd&amp;quot; &amp;quot;bcde&amp;quot; &amp;quot;cd&amp;quot; &amp;quot;de&amp;quot;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;x &amp;lt;- c(&amp;quot;asfef&amp;quot;, &amp;quot;qwerty&amp;quot;, &amp;quot;yuiop[&amp;quot;, &amp;quot;b&amp;quot;, &amp;quot;stuff.blah.yech&amp;quot;)&lt;br /&gt;
substr(x, 2, 5)&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;[1] &amp;quot;sfef&amp;quot; &amp;quot;wert&amp;quot; &amp;quot;uiop&amp;quot; &amp;quot;&amp;quot; &amp;quot;tuff&amp;quot;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;substring(x, 2, 4:6)&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;[1] &amp;quot;sfe&amp;quot; &amp;quot;wert&amp;quot; &amp;quot;uiop[&amp;quot; &amp;quot;&amp;quot; &amp;quot;tuff&amp;quot;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;substring(x, 2) &amp;lt;- c(&amp;quot;..&amp;quot;, &amp;quot;+++&amp;quot;)&lt;br /&gt;
x&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;[1] &amp;quot;a..ef&amp;quot; &amp;quot;q+++ty&amp;quot; &amp;quot;y..op[&amp;quot; &amp;quot;b&amp;quot;&lt;br /&gt;
[5] &amp;quot;s..ff.blah.yech&amp;quot;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;x &amp;lt;- &amp;quot;1234567890&amp;quot;&lt;br /&gt;
substr(x, 3, 3)&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;[1] &amp;quot;3&amp;quot;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;substr(x, 5, 7)&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;[1] &amp;quot;567&amp;quot;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;substr(x, 4, 4) &amp;lt;- &amp;quot;A&amp;quot;&lt;br /&gt;
x&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;[1] &amp;quot;123A567890&amp;quot;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;substr(x, 2, 4) &amp;lt;- &amp;quot;TTF&amp;quot;&lt;br /&gt;
x&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;[1] &amp;quot;1TTF567890&amp;quot;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;substr(x, 9, 12) &amp;lt;- &amp;quot;ABCD&amp;quot;&lt;br /&gt;
x&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;[1] &amp;quot;1TTF5678AB&amp;quot;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;substring(x, 5)&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;[1] &amp;quot;5678AB&amp;quot;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;substring(x, 5) &amp;lt;- &amp;quot;&amp;#8230;&amp;quot;&lt;br /&gt;
x&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;[1] &amp;quot;1TTF&amp;#8230;8AB&amp;quot;&lt;/p&gt;
&lt;h1&gt;&lt;span&gt;參考&lt;/span&gt;&lt;/h1&gt;
&lt;ol&gt;
&lt;li&gt;&lt;a href=&quot;http://stackoverflow.com/questions/7201341/how-can-2-strings-be-concatenated-in-r&quot;&gt;http://stackoverflow.com/questions/7201341/how-can-2-strings-be-concatenated-in-r&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://stat.ethz.ch/R-manual/R-devel/library/base/html/substr.html&quot;&gt;http://stat.ethz.ch/R-manual/R-devel/library/base/html/substr.html&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;by &lt;span class=&quot;printuser avatarhover&quot;&gt;&lt;a href=&quot;https://www.wikidot.com/user:info/ccckmit&quot;  &gt;&lt;img class=&quot;small&quot; src=&quot;https://www.wikidot.com/avatar.php?userid=296763&amp;amp;amp;size=small&amp;amp;amp;timestamp=1794171486&quot; alt=&quot;ccckmit&quot; style=&quot;background-image:url(https://www.wikidot.com/userkarma.php?u=296763)&quot; /&gt;&lt;/a&gt;&lt;a href=&quot;https://www.wikidot.com/user:info/ccckmit&quot;  &gt;ccckmit&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
</description>
				<pubDate>Sun, 19 Jan 2014 08:10:38 +0000</pubDate>
												<content:encoded>
					<![CDATA[
						 <p>Function Description<br /> substr(x, start=n1, stop=n2) Extract or replace substrings in a character vector.<br /> x &lt;- &quot;abcdef&quot;<br /> substr(x, 2, 4) is &quot;bcd&quot;<br /> substr(x, 2, 4) &lt;- &quot;22222&quot; is &quot;a222ef&quot;<br /> grep(pattern, x , ignore.case=FALSE, fixed=FALSE) Search for pattern in x. If fixed =FALSE then pattern is a regular expression. If fixed=TRUE then pattern is a text string. Returns matching indices.<br /> grep(&quot;A&quot;, c(&quot;b&quot;,&quot;A&quot;,&quot;c&quot;), fixed=TRUE) returns 2<br /> sub(pattern, replacement, x, ignore.case =FALSE, fixed=FALSE) Find pattern in x and replace with replacement text. If fixed=FALSE then pattern is a regular expression.<br /> If fixed = T then pattern is a text string.<br /> sub(&quot;\\s&quot;,&quot;.&quot;,&quot;Hello There&quot;) returns &quot;Hello.There&quot;<br /> strsplit(x, split) Split the elements of character vector x at split.<br /> strsplit(&quot;abc&quot;, &quot;&quot;) returns 3 element vector &quot;a&quot;,&quot;b&quot;,&quot;c&quot;<br /> paste(&#8230;, sep=&quot;&quot;) Concatenate strings after using sep string to seperate them.<br /> paste(&quot;x&quot;,1:3,sep=&quot;&quot;) returns c(&quot;x1&quot;,&quot;x2&quot; &quot;x3&quot;)<br /> paste(&quot;x&quot;,1:3,sep=&quot;M&quot;) returns c(&quot;xM1&quot;,&quot;xM2&quot; &quot;xM3&quot;)<br /> paste(&quot;Today is&quot;, date())<br /> toupper(x) Uppercase<br /> tolower(x) Lowercase<br /> sprintf(fmt, &#8230;)</p> <ul> <li><a href="http://www.statmethods.net/management/functions.html">http://www.statmethods.net/management/functions.html</a></li> </ul> <h1><span>字串連接</span></h1> <blockquote> <p>tmp = paste(&quot;GAD&quot;, &quot;AB&quot;, sep = &quot;,&quot;)<br /> tmp</p> </blockquote> <p>[1] &quot;GAD,AB&quot;</p> <h1><span>子字串</span></h1> <p>str(&quot;abcdef&quot;, 2, 4)<br /> [1] &quot;bcd&quot;</p> <blockquote> <p>substring(&quot;abcdef&quot;, 1:6, 1:6)</p> </blockquote> <p>[1] &quot;a&quot; &quot;b&quot; &quot;c&quot; &quot;d&quot; &quot;e&quot; &quot;f&quot;</p> <blockquote> <p>## strsplit is more efficient &#8230;</p> <p>substr(rep(&quot;abcdef&quot;, 4), 1:4, 4:5)</p> </blockquote> <p>[1] &quot;abcd&quot; &quot;bcde&quot; &quot;cd&quot; &quot;de&quot;</p> <blockquote> <p>x &lt;- c(&quot;asfef&quot;, &quot;qwerty&quot;, &quot;yuiop[&quot;, &quot;b&quot;, &quot;stuff.blah.yech&quot;)<br /> substr(x, 2, 5)</p> </blockquote> <p>[1] &quot;sfef&quot; &quot;wert&quot; &quot;uiop&quot; &quot;&quot; &quot;tuff&quot;</p> <blockquote> <p>substring(x, 2, 4:6)</p> </blockquote> <p>[1] &quot;sfe&quot; &quot;wert&quot; &quot;uiop[&quot; &quot;&quot; &quot;tuff&quot;</p> <blockquote> <p>substring(x, 2) &lt;- c(&quot;..&quot;, &quot;+++&quot;)<br /> x</p> </blockquote> <p>[1] &quot;a..ef&quot; &quot;q+++ty&quot; &quot;y..op[&quot; &quot;b&quot;<br /> [5] &quot;s..ff.blah.yech&quot;</p> <blockquote> <p>x &lt;- &quot;1234567890&quot;<br /> substr(x, 3, 3)</p> </blockquote> <p>[1] &quot;3&quot;</p> <blockquote> <p>substr(x, 5, 7)</p> </blockquote> <p>[1] &quot;567&quot;</p> <blockquote> <p>substr(x, 4, 4) &lt;- &quot;A&quot;<br /> x</p> </blockquote> <p>[1] &quot;123A567890&quot;</p> <blockquote> <p>substr(x, 2, 4) &lt;- &quot;TTF&quot;<br /> x</p> </blockquote> <p>[1] &quot;1TTF567890&quot;</p> <blockquote> <p>substr(x, 9, 12) &lt;- &quot;ABCD&quot;<br /> x</p> </blockquote> <p>[1] &quot;1TTF5678AB&quot;</p> <blockquote> <p>substring(x, 5)</p> </blockquote> <p>[1] &quot;5678AB&quot;</p> <blockquote> <p>substring(x, 5) &lt;- &quot;&#8230;&quot;<br /> x</p> </blockquote> <p>[1] &quot;1TTF&#8230;8AB&quot;</p> <h1><span>參考</span></h1> <ol> <li><a href="http://stackoverflow.com/questions/7201341/how-can-2-strings-be-concatenated-in-r">http://stackoverflow.com/questions/7201341/how-can-2-strings-be-concatenated-in-r</a></li> <li><a href="http://stat.ethz.ch/R-manual/R-devel/library/base/html/substr.html">http://stat.ethz.ch/R-manual/R-devel/library/base/html/substr.html</a></li> </ol> <p>by <span class="printuser avatarhover"><a href="https://www.wikidot.com/user:info/ccckmit" ><img class="small" src="https://www.wikidot.com/avatar.php?userid=296763&amp;amp;size=small&amp;amp;timestamp=1794171486" alt="ccckmit" style="background-image:url(https://www.wikidot.com/userkarma.php?u=296763)" /></a><a href="https://www.wikidot.com/user:info/ccckmit" >ccckmit</a></span></p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://ccckmit.wikidot.com/r:regexp</guid>
				<title>正規表達式</title>
				<link>https://ccckmit.wikidot.com/r:regexp</link>
				<description>

&lt;p&gt;group &amp;lt;- c(&amp;quot;12357e&amp;quot;, &amp;quot;12575e&amp;quot;, &amp;quot;197e18&amp;quot;, &amp;quot;e18947&amp;quot;)&lt;br /&gt;
group&lt;br /&gt;
[1] &amp;quot;12357e&amp;quot; &amp;quot;12575e&amp;quot; &amp;quot;197e18&amp;quot; &amp;quot;e18947&amp;quot;&lt;/p&gt;
&lt;p&gt;gsub(&amp;quot;e&amp;quot;, &amp;quot;&amp;quot;, group)&lt;br /&gt;
[1] &amp;quot;12357&amp;quot; &amp;quot;12575&amp;quot; &amp;quot;19718&amp;quot; &amp;quot;18947&amp;quot;&lt;/p&gt;
&lt;h1&gt;&lt;span&gt;參考文獻&lt;/span&gt;&lt;/h1&gt;
&lt;ol&gt;
&lt;li&gt;&lt;a href=&quot;http://stackoverflow.com/questions/11936339/in-r-how-do-i-replace-text-within-a-string&quot;&gt;http://stackoverflow.com/questions/11936339/in-r-how-do-i-replace-text-within-a-string&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Using Regular Expressions in R: Case Study in Cleaning a BibTeX Database, March 9, 2010, By Jeromy Anglim
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://www.r-bloggers.com/using-regular-expressions-in-r-case-study-in-cleaning-a-bibtex-database/&quot;&gt;http://www.r-bloggers.com/using-regular-expressions-in-r-case-study-in-cleaning-a-bibtex-database/&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Package ‘stringr’ &amp;#8212; Make it easier to work with strings.
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://cran.r-project.org/web/packages/stringr/stringr.pdf&quot;&gt;http://cran.r-project.org/web/packages/stringr/stringr.pdf&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Package ‘reportr’ &amp;#8212; A general message and error reporting system
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://cran.r-project.org/web/packages/reportr/reportr.pdf&quot;&gt;http://cran.r-project.org/web/packages/reportr/reportr.pdf&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Package ‘tm’ &amp;#8212; Text Mining Package
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://cran.r-project.org/web/packages/tm/tm.pdf&quot;&gt;http://cran.r-project.org/web/packages/tm/tm.pdf&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;by &lt;span class=&quot;printuser avatarhover&quot;&gt;&lt;a href=&quot;https://www.wikidot.com/user:info/ccckmit&quot;  &gt;&lt;img class=&quot;small&quot; src=&quot;https://www.wikidot.com/avatar.php?userid=296763&amp;amp;amp;size=small&amp;amp;amp;timestamp=1794171486&quot; alt=&quot;ccckmit&quot; style=&quot;background-image:url(https://www.wikidot.com/userkarma.php?u=296763)&quot; /&gt;&lt;/a&gt;&lt;a href=&quot;https://www.wikidot.com/user:info/ccckmit&quot;  &gt;ccckmit&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
</description>
				<pubDate>Sun, 24 Jun 2012 10:15:15 +0000</pubDate>
												<content:encoded>
					<![CDATA[
						 <p>group &lt;- c(&quot;12357e&quot;, &quot;12575e&quot;, &quot;197e18&quot;, &quot;e18947&quot;)<br /> group<br /> [1] &quot;12357e&quot; &quot;12575e&quot; &quot;197e18&quot; &quot;e18947&quot;</p> <p>gsub(&quot;e&quot;, &quot;&quot;, group)<br /> [1] &quot;12357&quot; &quot;12575&quot; &quot;19718&quot; &quot;18947&quot;</p> <h1><span>參考文獻</span></h1> <ol> <li><a href="http://stackoverflow.com/questions/11936339/in-r-how-do-i-replace-text-within-a-string">http://stackoverflow.com/questions/11936339/in-r-how-do-i-replace-text-within-a-string</a></li> <li>Using Regular Expressions in R: Case Study in Cleaning a BibTeX Database, March 9, 2010, By Jeromy Anglim <ul> <li><a href="http://www.r-bloggers.com/using-regular-expressions-in-r-case-study-in-cleaning-a-bibtex-database/">http://www.r-bloggers.com/using-regular-expressions-in-r-case-study-in-cleaning-a-bibtex-database/</a></li> </ul> </li> <li>Package ‘stringr’ &#8212; Make it easier to work with strings. <ul> <li><a href="http://cran.r-project.org/web/packages/stringr/stringr.pdf">http://cran.r-project.org/web/packages/stringr/stringr.pdf</a></li> </ul> </li> <li>Package ‘reportr’ &#8212; A general message and error reporting system <ul> <li><a href="http://cran.r-project.org/web/packages/reportr/reportr.pdf">http://cran.r-project.org/web/packages/reportr/reportr.pdf</a></li> </ul> </li> <li>Package ‘tm’ &#8212; Text Mining Package <ul> <li><a href="http://cran.r-project.org/web/packages/tm/tm.pdf">http://cran.r-project.org/web/packages/tm/tm.pdf</a></li> </ul> </li> </ol> <p>by <span class="printuser avatarhover"><a href="https://www.wikidot.com/user:info/ccckmit" ><img class="small" src="https://www.wikidot.com/avatar.php?userid=296763&amp;amp;size=small&amp;amp;timestamp=1794171486" alt="ccckmit" style="background-image:url(https://www.wikidot.com/userkarma.php?u=296763)" /></a><a href="https://www.wikidot.com/user:info/ccckmit" >ccckmit</a></span></p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://ccckmit.wikidot.com/r:datamining</guid>
				<title>資料採礦</title>
				<link>https://ccckmit.wikidot.com/r:datamining</link>
				<description>

&lt;h1&gt;&lt;span&gt;電子書&lt;/span&gt;&lt;/h1&gt;
&lt;ul&gt;
&lt;li&gt;Introduction to Data Science, by Jeffrey Stanton &amp;#8212; &lt;a href=&quot;http://jsresearch.net/wiki/projects/teachdatascience&quot;&gt;http://jsresearch.net/wiki/projects/teachdatascience&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Data Mining Algorithms In R &amp;#8212; &lt;a href=&quot;http://en.wikibooks.org/wiki/Data_Mining_Algorithms_In_R&quot;&gt;http://en.wikibooks.org/wiki/Data_Mining_Algorithms_In_R&lt;/a&gt; (讚！)&lt;/li&gt;
&lt;/ul&gt;
&lt;h1&gt;&lt;span&gt;課程&lt;/span&gt;&lt;/h1&gt;
&lt;ul&gt;
&lt;li&gt;Computing for Data Analysis, by Roger D. Peng &amp;#8212; &lt;a href=&quot;https://class.coursera.org/compdata-004/lecture&quot;&gt;https://class.coursera.org/compdata-004/lecture&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h1&gt;&lt;span&gt;參考文獻&lt;/span&gt;&lt;/h1&gt;
&lt;ol&gt;
&lt;li&gt;&lt;a href=&quot;http://rdatamining.wordpress.com/&quot;&gt;RDataMining&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://rdatamining.wordpress.com/2011/08/26/examples-on-clustering-with-r/&quot;&gt;http://rdatamining.wordpress.com/2011/08/26/examples-on-clustering-with-r/&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Rattle: A Data Mining GUI for R
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://journal.r-project.org/archive/2009-2/RJournal_2009-2_Williams.pdf&quot;&gt;http://journal.r-project.org/archive/2009-2/RJournal_2009-2_Williams.pdf&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;by &lt;span class=&quot;printuser avatarhover&quot;&gt;&lt;a href=&quot;https://www.wikidot.com/user:info/ccckmit&quot;  &gt;&lt;img class=&quot;small&quot; src=&quot;https://www.wikidot.com/avatar.php?userid=296763&amp;amp;amp;size=small&amp;amp;amp;timestamp=1794171486&quot; alt=&quot;ccckmit&quot; style=&quot;background-image:url(https://www.wikidot.com/userkarma.php?u=296763)&quot; /&gt;&lt;/a&gt;&lt;a href=&quot;https://www.wikidot.com/user:info/ccckmit&quot;  &gt;ccckmit&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
</description>
				<pubDate>Sun, 24 Jun 2012 08:48:36 +0000</pubDate>
												<content:encoded>
					<![CDATA[
						 <h1><span>電子書</span></h1> <ul> <li>Introduction to Data Science, by Jeffrey Stanton &#8212; <a href="http://jsresearch.net/wiki/projects/teachdatascience">http://jsresearch.net/wiki/projects/teachdatascience</a></li> <li>Data Mining Algorithms In R &#8212; <a href="http://en.wikibooks.org/wiki/Data_Mining_Algorithms_In_R">http://en.wikibooks.org/wiki/Data_Mining_Algorithms_In_R</a> (讚！)</li> </ul> <h1><span>課程</span></h1> <ul> <li>Computing for Data Analysis, by Roger D. Peng &#8212; <a href="https://class.coursera.org/compdata-004/lecture">https://class.coursera.org/compdata-004/lecture</a></li> </ul> <h1><span>參考文獻</span></h1> <ol> <li><a href="http://rdatamining.wordpress.com/">RDataMining</a> <ul> <li><a href="http://rdatamining.wordpress.com/2011/08/26/examples-on-clustering-with-r/">http://rdatamining.wordpress.com/2011/08/26/examples-on-clustering-with-r/</a></li> </ul> </li> <li>Rattle: A Data Mining GUI for R <ul> <li><a href="http://journal.r-project.org/archive/2009-2/RJournal_2009-2_Williams.pdf">http://journal.r-project.org/archive/2009-2/RJournal_2009-2_Williams.pdf</a></li> </ul> </li> </ol> <p>by <span class="printuser avatarhover"><a href="https://www.wikidot.com/user:info/ccckmit" ><img class="small" src="https://www.wikidot.com/avatar.php?userid=296763&amp;amp;size=small&amp;amp;timestamp=1794171486" alt="ccckmit" style="background-image:url(https://www.wikidot.com/userkarma.php?u=296763)" /></a><a href="https://www.wikidot.com/user:info/ccckmit" >ccckmit</a></span></p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://ccckmit.wikidot.com/r:decisiontree</guid>
				<title>決策樹</title>
				<link>https://ccckmit.wikidot.com/r:decisiontree</link>
				<description>

&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://en.wikibooks.org/wiki/Data_Mining_Algorithms_In_R/Classification/Decision_Trees&quot;&gt;http://en.wikibooks.org/wiki/Data_Mining_Algorithms_In_R/Classification/Decision_Trees&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;by &lt;span class=&quot;printuser avatarhover&quot;&gt;&lt;a href=&quot;https://www.wikidot.com/user:info/ccckmit&quot;  &gt;&lt;img class=&quot;small&quot; src=&quot;https://www.wikidot.com/avatar.php?userid=296763&amp;amp;amp;size=small&amp;amp;amp;timestamp=1794171486&quot; alt=&quot;ccckmit&quot; style=&quot;background-image:url(https://www.wikidot.com/userkarma.php?u=296763)&quot; /&gt;&lt;/a&gt;&lt;a href=&quot;https://www.wikidot.com/user:info/ccckmit&quot;  &gt;ccckmit&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
</description>
				<pubDate>Fri, 17 Jan 2014 10:37:54 +0000</pubDate>
												<content:encoded>
					<![CDATA[
						 <ul> <li><a href="http://en.wikibooks.org/wiki/Data_Mining_Algorithms_In_R/Classification/Decision_Trees">http://en.wikibooks.org/wiki/Data_Mining_Algorithms_In_R/Classification/Decision_Trees</a></li> </ul> <p>by <span class="printuser avatarhover"><a href="https://www.wikidot.com/user:info/ccckmit" ><img class="small" src="https://www.wikidot.com/avatar.php?userid=296763&amp;amp;size=small&amp;amp;timestamp=1794171486" alt="ccckmit" style="background-image:url(https://www.wikidot.com/userkarma.php?u=296763)" /></a><a href="https://www.wikidot.com/user:info/ccckmit" >ccckmit</a></span></p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://ccckmit.wikidot.com/r:svm</guid>
				<title>SVM : Support Vector Machine</title>
				<link>https://ccckmit.wikidot.com/r:svm</link>
				<description>

&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://en.wikibooks.org/wiki/Data_Mining_Algorithms_In_R/Classification/SVM&quot;&gt;http://en.wikibooks.org/wiki/Data_Mining_Algorithms_In_R/Classification/SVM&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;by &lt;span class=&quot;printuser avatarhover&quot;&gt;&lt;a href=&quot;https://www.wikidot.com/user:info/ccckmit&quot;  &gt;&lt;img class=&quot;small&quot; src=&quot;https://www.wikidot.com/avatar.php?userid=296763&amp;amp;amp;size=small&amp;amp;amp;timestamp=1794171486&quot; alt=&quot;ccckmit&quot; style=&quot;background-image:url(https://www.wikidot.com/userkarma.php?u=296763)&quot; /&gt;&lt;/a&gt;&lt;a href=&quot;https://www.wikidot.com/user:info/ccckmit&quot;  &gt;ccckmit&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
</description>
				<pubDate>Sun, 24 Jun 2012 08:59:10 +0000</pubDate>
												<content:encoded>
					<![CDATA[
						 <ul> <li><a href="http://en.wikibooks.org/wiki/Data_Mining_Algorithms_In_R/Classification/SVM">http://en.wikibooks.org/wiki/Data_Mining_Algorithms_In_R/Classification/SVM</a></li> </ul> <ul> <li><a href="http://cran.r-project.org/web/packages/kernlab/kernlab.pdf">http://cran.r-project.org/web/packages/kernlab/kernlab.pdf</a></li> </ul> <div class="code"> <pre><code>&gt; library(kernlab) &gt; # create data &gt; x &lt;- sort(runif(300)) &gt; y &lt;- sin(pi*x) + rnorm(300,0,sd=exp(sin(2*pi*x))) &gt; # first calculate the median &gt; qrm &lt;- kqr(x, y, tau = 0.5, C=0.15) Using automatic sigma estimation (sigest) for RBF or laplace kernel &gt; # predict and plot &gt; plot(x, y) &gt; ytest &lt;- predict(qrm, x) &gt; lines(x, ytest, col=&quot;blue&quot;) &gt; # calculate 0.9 quantile &gt; qrm &lt;- kqr(x, y, tau = 0.9, kernel = &quot;rbfdot&quot;, + kpar = list(sigma = 10), C = 0.15) &gt; ytest &lt;- predict(qrm, x) &gt; lines(x, ytest, col=&quot;red&quot;) &gt; # print model coefficients and other information &gt; coef(qrm) [1] -0.015000000 -0.015000000 -0.015000000 -0.015000000 -0.015000000 [6] -0.015000000 -0.015000000 -0.015000000 -0.015000000 -0.015000000 [11] -0.015000000 -0.015000000 0.133870560 -0.015000000 -0.015000000 [16] -0.015000000 -0.015000000 0.135000000 -0.014999999 -0.015000000 [21] -0.015000000 -0.015000000 -0.015000000 -0.015000000 -0.015000000 [26] -0.015000000 -0.015000000 -0.015000000 -0.015000000 -0.015000000 [31] -0.015000000 -0.015000000 -0.014999995 -0.015000000 -0.015000000 [36] -0.015000000 0.135000000 0.135000000 -0.015000000 -0.015000000 [41] -0.015000000 0.135000000 -0.015000000 -0.015000000 -0.015000000 [46] -0.015000000 -0.015000000 -0.015000000 -0.015000000 -0.015000000 [51] -0.015000000 -0.015000000 -0.015000000 0.135000000 -0.015000000 [56] -0.015000000 0.135000000 -0.015000000 -0.015000000 -0.015000000 [61] 0.135000000 -0.015000000 0.135000000 0.135000000 -0.015000000 [66] 0.135000000 0.135000000 -0.015000000 -0.015000000 -0.015000000 [71] -0.015000000 -0.015000000 -0.015000000 -0.015000000 -0.015000000 [76] -0.015000000 0.135000000 -0.014999994 -0.015000000 -0.015000000 [81] -0.015000000 -0.015000000 -0.015000000 -0.015000000 -0.015000000 [86] -0.015000000 -0.015000000 -0.015000000 0.134999999 -0.015000000 [91] -0.015000000 -0.015000000 -0.015000000 -0.015000000 -0.015000000 [96] -0.015000000 -0.015000000 -0.015000000 -0.015000000 -0.015000000 [101] 0.134999999 -0.015000000 -0.015000000 0.103202674 -0.015000000 [106] -0.015000000 -0.015000000 -0.015000000 -0.015000000 -0.015000000 [111] -0.015000000 -0.015000000 0.135000000 -0.015000000 -0.015000000 [116] -0.015000000 0.135000000 -0.015000000 -0.015000000 -0.015000000 [121] -0.002296026 -0.015000000 0.135000000 -0.015000000 -0.015000000 [126] 0.135000000 -0.015000000 -0.015000000 0.135000000 -0.015000000 [131] 0.134999999 -0.015000000 -0.015000000 -0.015000000 -0.015000000 [136] -0.015000000 -0.015000000 -0.015000000 -0.015000000 -0.015000000 [141] -0.015000000 -0.015000000 -0.015000000 -0.015000000 -0.015000000 [146] -0.015000000 -0.015000000 -0.006708508 -0.015000000 -0.015000000 [151] -0.015000000 -0.014999997 -0.015000000 -0.015000000 -0.015000000 [156] 0.135000000 -0.015000000 -0.015000000 0.135000000 -0.015000000 [161] 0.134999997 -0.014999999 -0.015000000 -0.015000000 -0.015000000 [166] -0.015000000 -0.015000000 -0.015000000 -0.015000000 -0.015000000 [171] -0.015000000 -0.015000000 -0.015000000 -0.015000000 -0.015000000 [176] -0.015000000 -0.015000000 -0.015000000 -0.015000000 -0.015000000 [181] -0.015000000 -0.015000000 -0.015000000 -0.015000000 -0.015000000 [186] -0.015000000 -0.015000000 -0.015000000 -0.015000000 -0.014999999 [191] -0.015000000 -0.015000000 -0.015000000 -0.015000000 -0.015000000 [196] 0.135000000 -0.015000000 -0.015000000 0.134999999 -0.015000000 [201] -0.015000000 -0.015000000 -0.015000000 -0.015000000 -0.015000000 [206] -0.015000000 -0.015000000 -0.015000000 -0.015000000 -0.015000000 [211] -0.015000000 -0.015000000 -0.015000000 -0.015000000 -0.015000000 [216] -0.015000000 -0.015000000 -0.015000000 -0.015000000 -0.015000000 [221] -0.015000000 -0.015000000 -0.015000000 -0.015000000 -0.015000000 [226] -0.015000000 -0.015000000 -0.015000000 -0.015000000 -0.015000000 [231] -0.015000000 -0.015000000 0.134999999 -0.015000000 -0.015000000 [236] -0.015000000 -0.015000000 -0.015000000 0.129101279 -0.015000000 [241] -0.015000000 -0.015000000 -0.015000000 -0.015000000 -0.015000000 [246] -0.015000000 -0.015000000 -0.015000000 -0.015000000 -0.015000000 [251] -0.015000000 -0.015000000 -0.015000000 -0.015000000 -0.015000000 [256] -0.015000000 -0.015000000 -0.015000000 -0.015000000 -0.015000000 [261] -0.015000000 -0.015000000 -0.015000000 -0.015000000 -0.015000000 [266] -0.015000000 -0.015000000 -0.014999997 -0.015000000 -0.015000000 [271] -0.015000000 -0.015000000 -0.015000000 -0.015000000 -0.015000000 [276] -0.015000000 -0.015000000 -0.015000000 -0.015000000 -0.015000000 [281] 0.134999999 -0.015000000 -0.015000000 -0.015000000 -0.015000000 [286] -0.015000000 -0.015000000 -0.015000000 -0.015000000 -0.015000000 [291] -0.015000000 -0.015000000 -0.015000000 0.002829996 -0.015000000 [296] -0.015000000 -0.015000000 -0.015000000 -0.015000000 -0.015000000 &gt; b(qrm) [1] -0.8857253 &gt; error(qrm) [1] 0.1451163 0.9000000 &gt; kernelf(qrm)</code></pre></div> <h1><span>參考文獻</span></h1> <ol> <li>Support Vector Machines, The Interface to libsvm in package e1071, by David Meyer, September 12, 2011 <ul> <li><a href="http://cran.r-project.org/web/packages/e1071/vignettes/svmdoc.pdf">http://cran.r-project.org/web/packages/e1071/vignettes/svmdoc.pdf</a></li> </ul> </li> <li>SVM and PAMR <ul> <li><a href="http://www-stat.stanford.edu/tibs/PAM/">http://www-stat.stanford.edu/tibs/PAM/</a></li> </ul> </li> </ol> <p>by <span class="printuser avatarhover"><a href="https://www.wikidot.com/user:info/ccckmit" ><img class="small" src="https://www.wikidot.com/avatar.php?userid=296763&amp;amp;size=small&amp;amp;timestamp=1794171486" alt="ccckmit" style="background-image:url(https://www.wikidot.com/userkarma.php?u=296763)" /></a><a href="https://www.wikidot.com/user:info/ccckmit" >ccckmit</a></span></p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://ccckmit.wikidot.com/r:clustering</guid>
				<title>分群</title>
				<link>https://ccckmit.wikidot.com/r:clustering</link>
				<description>

&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://en.wikibooks.org/wiki/Data_Mining_Algorithms_In_R/Clustering&quot;&gt;http://en.wikibooks.org/wiki/Data_Mining_Algorithms_In_R/Clustering&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://en.wikibooks.org/wiki/Data_Mining_Algorithms_In_R/Clustering/K-Means&quot;&gt;http://en.wikibooks.org/wiki/Data_Mining_Algorithms_In_R/Clustering/K-Means&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://en.wikibooks.org/wiki/Data_Mining_Algorithms_In_R/Classification&quot;&gt;http://en.wikibooks.org/wiki/Data_Mining_Algorithms_In_R/Classification&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h1&gt;&lt;span&gt;k-means&lt;/span&gt;&lt;/h1&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://stat.ethz.ch/R-manual/R-patched/library/stats/html/kmeans.html&quot;&gt;http://stat.ethz.ch/R-manual/R-patched/library/stats/html/kmeans.html&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;pre&gt;&lt;code&gt;require(graphics)

# a 2-dimensional example
x &amp;lt;- rbind(matrix(rnorm(100, sd = 0.3), ncol = 2),
           matrix(rnorm(100, mean = 1, sd = 0.3), ncol = 2))
colnames(x) &amp;lt;- c(&amp;quot;x&amp;quot;, &amp;quot;y&amp;quot;)
(cl &amp;lt;- kmeans(x, 2))
plot(x, col = cl$cluster)
points(cl$centers, col = 1:2, pch = 8, cex = 2)

# sum of squares
ss &amp;lt;- function(x) sum(scale(x, scale = FALSE)^2)

## cluster centers &amp;quot;fitted&amp;quot; to each obs.:
fitted.x &amp;lt;- fitted(cl);  head(fitted.x)
resid.x &amp;lt;- x - fitted(cl)

## Equalities : ----------------------------------
cbind(cl[c(&amp;quot;betweenss&amp;quot;, &amp;quot;tot.withinss&amp;quot;, &amp;quot;totss&amp;quot;)], # the same two columns
         c(ss(fitted.x), ss(resid.x),    ss(x)))
stopifnot(all.equal(cl$ totss,        ss(x)),
      all.equal(cl$ tot.withinss, ss(resid.x)),
      ## these three are the same:
      all.equal(cl$ betweenss,    ss(fitted.x)),
      all.equal(cl$ betweenss, cl$totss - cl$tot.withinss),
      ## and hence also
      all.equal(ss(x), ss(fitted.x) + ss(resid.x))
      )

kmeans(x,1)$withinss # trivial one-cluster, (its W.SS == ss(x))

## random starts do help here with too many clusters
## (and are often recommended anyway!):
(cl &amp;lt;- kmeans(x, 5, nstart = 25))
plot(x, col = cl$cluster)
points(cl$centers, col = 1:5, pch = 8)&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h1&gt;&lt;span&gt;決策樹&lt;/span&gt;&lt;/h1&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://cran.r-project.org/web/packages/rpart/rpart.pdf&quot;&gt;http://cran.r-project.org/web/packages/rpart/rpart.pdf&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;pre&gt;&lt;code&gt;fit &amp;lt;- rpart(Price ~ Mileage + Type + Country, cu.summary)
par(xpd = TRUE)
plot(fit, compress = TRUE)
text(fit, use.n = TRUE)&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h1&gt;&lt;span&gt;hclust&lt;/span&gt;&lt;/h1&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://stat.ethz.ch/R-manual/R-patched/library/stats/html/hclust.html&quot;&gt;http://stat.ethz.ch/R-manual/R-patched/library/stats/html/hclust.html&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;pre&gt;&lt;code&gt;require(graphics)

hc &amp;lt;- hclust(dist(USArrests), &amp;quot;ave&amp;quot;)
plot(hc)
plot(hc, hang = -1)

## Do the same with centroid clustering and squared Euclidean distance,
## cut the tree into ten clusters and reconstruct the upper part of the
## tree from the cluster centers.
hc &amp;lt;- hclust(dist(USArrests)^2, &amp;quot;cen&amp;quot;)
memb &amp;lt;- cutree(hc, k = 10)
cent &amp;lt;- NULL
for(k in 1:10){
  cent &amp;lt;- rbind(cent, colMeans(USArrests[memb == k, , drop = FALSE]))
}
hc1 &amp;lt;- hclust(dist(cent)^2, method = &amp;quot;cen&amp;quot;, members = table(memb))
opar &amp;lt;- par(mfrow = c(1, 2))
plot(hc,  labels = FALSE, hang = -1, main = &amp;quot;Original Tree&amp;quot;)
plot(hc1, labels = FALSE, hang = -1, main = &amp;quot;Re-start from 10 clusters&amp;quot;)
par(opar)&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h1&gt;&lt;span&gt;參考文獻&lt;/span&gt;&lt;/h1&gt;
&lt;ol&gt;
&lt;li&gt;&lt;a href=&quot;http://www.statmethods.net/advstats/cluster.html&quot;&gt;http://www.statmethods.net/advstats/cluster.html&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.statmethods.net/&quot;&gt;Quick-R : accessing the power of R&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://www.statmethods.net/advstats/cluster.html&quot;&gt;Cluster Analysis&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://stat.ethz.ch/R-manual/R-devel/library/stats/html/kmeans.html&quot;&gt;K-Means Clustering&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://stat.ethz.ch/R-manual/R-devel/library/stats/html/kmeans.html&quot;&gt;http://stat.ethz.ch/R-manual/R-devel/library/stats/html/kmeans.html&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://horicky.blogspot.tw/2012/04/machine-learning-in-r-clustering.html&quot;&gt;Pragmatic Programming Techniques : Machine Learning in R: Clustering&lt;/a&gt;, SUNDAY, APRIL 8, 2012&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.r-tutor.com/&quot;&gt;R Tutorial&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://www.r-tutor.com/gpu-computing/clustering/hierarchical-cluster-analysis&quot;&gt;Hierarchical Cluster Analysis&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://rdatamining.wordpress.com/&quot;&gt;RDataMining&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://rdatamining.wordpress.com/2011/08/26/examples-on-clustering-with-r/&quot;&gt;http://rdatamining.wordpress.com/2011/08/26/examples-on-clustering-with-r/&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;by &lt;span class=&quot;printuser avatarhover&quot;&gt;&lt;a href=&quot;https://www.wikidot.com/user:info/ccckmit&quot;  &gt;&lt;img class=&quot;small&quot; src=&quot;https://www.wikidot.com/avatar.php?userid=296763&amp;amp;amp;size=small&amp;amp;amp;timestamp=1794171486&quot; alt=&quot;ccckmit&quot; style=&quot;background-image:url(https://www.wikidot.com/userkarma.php?u=296763)&quot; /&gt;&lt;/a&gt;&lt;a href=&quot;https://www.wikidot.com/user:info/ccckmit&quot;  &gt;ccckmit&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
</description>
				<pubDate>Sun, 24 Jun 2012 08:48:16 +0000</pubDate>
												<content:encoded>
					<![CDATA[
						 <ul> <li><a href="http://en.wikibooks.org/wiki/Data_Mining_Algorithms_In_R/Clustering">http://en.wikibooks.org/wiki/Data_Mining_Algorithms_In_R/Clustering</a> <ul> <li><a href="http://en.wikibooks.org/wiki/Data_Mining_Algorithms_In_R/Clustering/K-Means">http://en.wikibooks.org/wiki/Data_Mining_Algorithms_In_R/Clustering/K-Means</a></li> </ul> </li> <li><a href="http://en.wikibooks.org/wiki/Data_Mining_Algorithms_In_R/Classification">http://en.wikibooks.org/wiki/Data_Mining_Algorithms_In_R/Classification</a></li> </ul> <h1><span>k-means</span></h1> <ul> <li><a href="http://stat.ethz.ch/R-manual/R-patched/library/stats/html/kmeans.html">http://stat.ethz.ch/R-manual/R-patched/library/stats/html/kmeans.html</a></li> </ul> <div class="code"> <pre><code>require(graphics) # a 2-dimensional example x &lt;- rbind(matrix(rnorm(100, sd = 0.3), ncol = 2), matrix(rnorm(100, mean = 1, sd = 0.3), ncol = 2)) colnames(x) &lt;- c(&quot;x&quot;, &quot;y&quot;) (cl &lt;- kmeans(x, 2)) plot(x, col = cl$cluster) points(cl$centers, col = 1:2, pch = 8, cex = 2) # sum of squares ss &lt;- function(x) sum(scale(x, scale = FALSE)^2) ## cluster centers &quot;fitted&quot; to each obs.: fitted.x &lt;- fitted(cl); head(fitted.x) resid.x &lt;- x - fitted(cl) ## Equalities : ---------------------------------- cbind(cl[c(&quot;betweenss&quot;, &quot;tot.withinss&quot;, &quot;totss&quot;)], # the same two columns c(ss(fitted.x), ss(resid.x), ss(x))) stopifnot(all.equal(cl$ totss, ss(x)), all.equal(cl$ tot.withinss, ss(resid.x)), ## these three are the same: all.equal(cl$ betweenss, ss(fitted.x)), all.equal(cl$ betweenss, cl$totss - cl$tot.withinss), ## and hence also all.equal(ss(x), ss(fitted.x) + ss(resid.x)) ) kmeans(x,1)$withinss # trivial one-cluster, (its W.SS == ss(x)) ## random starts do help here with too many clusters ## (and are often recommended anyway!): (cl &lt;- kmeans(x, 5, nstart = 25)) plot(x, col = cl$cluster) points(cl$centers, col = 1:5, pch = 8)</code></pre></div> <h1><span>決策樹</span></h1> <ul> <li><a href="http://cran.r-project.org/web/packages/rpart/rpart.pdf">http://cran.r-project.org/web/packages/rpart/rpart.pdf</a></li> </ul> <div class="code"> <pre><code>fit &lt;- rpart(Price ~ Mileage + Type + Country, cu.summary) par(xpd = TRUE) plot(fit, compress = TRUE) text(fit, use.n = TRUE)</code></pre></div> <h1><span>hclust</span></h1> <ul> <li><a href="http://stat.ethz.ch/R-manual/R-patched/library/stats/html/hclust.html">http://stat.ethz.ch/R-manual/R-patched/library/stats/html/hclust.html</a></li> </ul> <div class="code"> <pre><code>require(graphics) hc &lt;- hclust(dist(USArrests), &quot;ave&quot;) plot(hc) plot(hc, hang = -1) ## Do the same with centroid clustering and squared Euclidean distance, ## cut the tree into ten clusters and reconstruct the upper part of the ## tree from the cluster centers. hc &lt;- hclust(dist(USArrests)^2, &quot;cen&quot;) memb &lt;- cutree(hc, k = 10) cent &lt;- NULL for(k in 1:10){ cent &lt;- rbind(cent, colMeans(USArrests[memb == k, , drop = FALSE])) } hc1 &lt;- hclust(dist(cent)^2, method = &quot;cen&quot;, members = table(memb)) opar &lt;- par(mfrow = c(1, 2)) plot(hc, labels = FALSE, hang = -1, main = &quot;Original Tree&quot;) plot(hc1, labels = FALSE, hang = -1, main = &quot;Re-start from 10 clusters&quot;) par(opar)</code></pre></div> <h1><span>參考文獻</span></h1> <ol> <li><a href="http://www.statmethods.net/advstats/cluster.html">http://www.statmethods.net/advstats/cluster.html</a></li> <li><a href="http://www.statmethods.net/">Quick-R : accessing the power of R</a> <ul> <li><a href="http://www.statmethods.net/advstats/cluster.html">Cluster Analysis</a></li> </ul> </li> <li><a href="http://stat.ethz.ch/R-manual/R-devel/library/stats/html/kmeans.html">K-Means Clustering</a> <ul> <li><a href="http://stat.ethz.ch/R-manual/R-devel/library/stats/html/kmeans.html">http://stat.ethz.ch/R-manual/R-devel/library/stats/html/kmeans.html</a></li> </ul> </li> <li><a href="http://horicky.blogspot.tw/2012/04/machine-learning-in-r-clustering.html">Pragmatic Programming Techniques : Machine Learning in R: Clustering</a>, SUNDAY, APRIL 8, 2012</li> <li><a href="http://www.r-tutor.com/">R Tutorial</a> <ul> <li><a href="http://www.r-tutor.com/gpu-computing/clustering/hierarchical-cluster-analysis">Hierarchical Cluster Analysis</a></li> </ul> </li> <li><a href="http://rdatamining.wordpress.com/">RDataMining</a> <ul> <li><a href="http://rdatamining.wordpress.com/2011/08/26/examples-on-clustering-with-r/">http://rdatamining.wordpress.com/2011/08/26/examples-on-clustering-with-r/</a></li> </ul> </li> </ol> <p>by <span class="printuser avatarhover"><a href="https://www.wikidot.com/user:info/ccckmit" ><img class="small" src="https://www.wikidot.com/avatar.php?userid=296763&amp;amp;size=small&amp;amp;timestamp=1794171486" alt="ccckmit" style="background-image:url(https://www.wikidot.com/userkarma.php?u=296763)" /></a><a href="https://www.wikidot.com/user:info/ccckmit" >ccckmit</a></span></p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://ccckmit.wikidot.com/r:calculus</guid>
				<title>微積分</title>
				<link>https://ccckmit.wikidot.com/r:calculus</link>
				<description>

&lt;ul&gt;
&lt;li&gt;R 中計算函數的微分 &amp;#8212; &lt;a href=&quot;http://rpubs.com/wush978/differentiation&quot;&gt;http://rpubs.com/wush978/differentiation&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;by &lt;span class=&quot;printuser avatarhover&quot;&gt;&lt;a href=&quot;https://www.wikidot.com/user:info/ccckmit&quot;  &gt;&lt;img class=&quot;small&quot; src=&quot;https://www.wikidot.com/avatar.php?userid=296763&amp;amp;amp;size=small&amp;amp;amp;timestamp=1794171486&quot; alt=&quot;ccckmit&quot; style=&quot;background-image:url(https://www.wikidot.com/userkarma.php?u=296763)&quot; /&gt;&lt;/a&gt;&lt;a href=&quot;https://www.wikidot.com/user:info/ccckmit&quot;  &gt;ccckmit&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
</description>
				<pubDate>Sun, 24 Jun 2012 09:16:15 +0000</pubDate>
												<content:encoded>
					<![CDATA[
						 <ul> <li>R 中計算函數的微分 &#8212; <a href="http://rpubs.com/wush978/differentiation">http://rpubs.com/wush978/differentiation</a></li> </ul> <h1><span>符號微分</span></h1> <p>使用 stats 套件的 deriv 函數。</p> <div class="code"> <pre><code>&gt; f=expression(x^2, 'x') &gt; D(f, 'x') 2 * x &gt; df = D(f, 'x') &gt; df 2 * x &gt; D(df, 'x') [1] 2 &gt; f=expression(sin(5*x), 'x') &gt; D(f, 'x') cos(5 * x) * 5 &gt; D(D(f, 'x'), 'x') -(sin(5 * x) * 5 * 5) &gt; f=expression(exp(x), 'x') &gt; f expression(exp(x), &quot;x&quot;) &gt; D(f, 'x') exp(x) &gt; D(D(f,'x'),'x') exp(x) &gt;</code></pre></div> <p>實驗二</p> <div class="code"> <pre><code>&gt; D(expression(x^n),&quot;x&quot;) x^(n - 1) * n &gt; D(expression(exp(a*x)),&quot;x&quot;) exp(a * x) * a &gt; D(expression(1/x),&quot;x&quot;) -(1/x^2) &gt; D(expression(x^3),&quot;x&quot;) 3 * x^2 &gt; D(expression(pnorm(x)),&quot;x&quot;) dnorm(x) &gt; D(expression(dnorm(x)),&quot;x&quot;) -(x * dnorm(x))</code></pre></div> <p>實驗三：</p> <div class="code"> <pre><code>&gt; foo &lt;- expression((sin(x)^3+y)/(x+atan(y))) &gt; D(D(foo, &quot;x&quot;), &quot;y&quot;) -(3 * (cos(x) * sin(x)^2) * (1/(1 + y^2))/(x + atan(y))^2 + (1/(x + atan(y))^2 - (sin(x)^3 + y) * (2 * (1/(1 + y^2) * (x + atan(y))))/((x + atan(y))^2)^2))</code></pre></div> <h1><span>數值微分</span></h1> <p>使用 numDeriv package</p> <h1><span>符號積分</span></h1> <h1><span>數值積分</span></h1> <ul> <li><a href="http://en.wikibooks.org/wiki/R_Programming/Mathematics#Symbolic_calculations">http://en.wikibooks.org/wiki/R_Programming/Mathematics#Symbolic_calculations</a></li> </ul> <div class="code"> <pre><code>&gt; integrate(dnorm,-Inf,Inf) 1 with absolute error &lt; 9.4e-05 &gt; integrate(dnorm,-1.96,1.96) 0.9500042 with absolute error &lt; 1.0e-11 &gt; integrate(dnorm,-1.64,1.64) 0.8989948 with absolute error &lt; 6.8e-14 # we can also store the result in an object &gt; ci90 &lt;- integrate(dnorm,-1.64,1.64) &gt; ci90$value [1] 0.8989948 &gt; integrate(dnorm,-1.64,1.64)$value [1] 0.8989948</code></pre></div> <p>多變數數值積分</p> <div class="code"> <pre><code>&gt; library(adapt) &gt; ?adapt &gt; ir2pi &lt;- 1/sqrt(2*pi) &gt; fred &lt;- function(z) { ir2pi^length(z) * exp(-0.5 * sum(z * z))} &gt; &gt; adapt(2, lo = c(-5,-5), up = c(5,5), functn = fred) value relerr minpts lenwrk ifail 1.039222 0.0007911264 231 73 0 &gt; adapt(2, lo = c(-5,-5), up = c(5,5), functn = fred, eps = 1e-4) value relerr minpts lenwrk ifail 1.000237 1.653498e-05 655 143 0 &gt; adapt(2, lo = c(-5,-5), up = c(5,5), functn = fred, eps = 1e-6) value relerr minpts lenwrk ifail 1.000039 3.22439e-07 1719 283 0</code></pre></div> <h1><span>使用 Ryacas 套件</span></h1> <p>下載：<a href="https://code.google.com/p/ryacas/downloads/list">https://code.google.com/p/ryacas/downloads/list</a></p> <p>Symbolic computation in R?</p> <ul> <li><a href="http://stats.stackexchange.com/questions/4775/symbolic-computation-in-r">http://stats.stackexchange.com/questions/4775/symbolic-computation-in-r</a></li> </ul> <blockquote> <p>Yes. There is the Ryacas package which is hosted on Google Code here. Ryacas has recently been expanded/converted to the rMathpiper package which is hosted here. I have used Ryacas and it is straightforward, but you will need to install Yacas in order for it to work (Yacas does all the heavy lifting; Ryacas is just an R interface to Yacas).</p> </blockquote> <p>There is also the rSymPy project hosted on Google Code here. I haven't tried this one. The idea is similar, though, link to the sympy CAS which does the symbolic work.</p> <ul> <li><a href="http://stackoverflow.com/questions/8779362/explicit-formula-versus-symbolic-derivatives-in-r">http://stackoverflow.com/questions/8779362/explicit-formula-versus-symbolic-derivatives-in-r</a></li> <li><a href="http://r.789695.n4.nabble.com/Symbolic-Integration-in-R-td857074.html">http://r.789695.n4.nabble.com/Symbolic-Integration-in-R-td857074.html</a></li> </ul> <h1><span>使用 sage 軟體</span></h1> <ul> <li><a href="http://sagemath.org/">http://sagemath.org/</a></li> </ul> <h1><span>參考文獻</span></h1> <ol> <li>Using R for Introductory Calculus and Statistics <ul> <li><a href="http://www.r-project.org/conferences/useR-2007/program/presentations/kaplan.pdf">http://www.r-project.org/conferences/useR-2007/program/presentations/kaplan.pdf</a></li> </ul> </li> <li>Plotting, Derivatives, and Integrals for Teaching Calculus in R, Daniel Kaplan, March 23, 2012 <ul> <li><a href="http://cran.r-project.org/web/packages/mosaic/vignettes/Calculus.pdf">http://cran.r-project.org/web/packages/mosaic/vignettes/Calculus.pdf</a></li> </ul> </li> </ol> <p>by <span class="printuser avatarhover"><a href="https://www.wikidot.com/user:info/ccckmit" ><img class="small" src="https://www.wikidot.com/avatar.php?userid=296763&amp;amp;size=small&amp;amp;timestamp=1794171486" alt="ccckmit" style="background-image:url(https://www.wikidot.com/userkarma.php?u=296763)" /></a><a href="https://www.wikidot.com/user:info/ccckmit" >ccckmit</a></span></p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://ccckmit.wikidot.com/r:ref</guid>
				<title>R 統計軟體 -- 參考文獻</title>
				<link>https://ccckmit.wikidot.com/r:ref</link>
				<description>

&lt;h1&gt;&lt;span&gt;課程&lt;/span&gt;&lt;/h1&gt;
&lt;p&gt;by &lt;span class=&quot;printuser avatarhover&quot;&gt;&lt;a href=&quot;https://www.wikidot.com/user:info/ccckmit&quot;  &gt;&lt;img class=&quot;small&quot; src=&quot;https://www.wikidot.com/avatar.php?userid=296763&amp;amp;amp;size=small&amp;amp;amp;timestamp=1794171486&quot; alt=&quot;ccckmit&quot; style=&quot;background-image:url(https://www.wikidot.com/userkarma.php?u=296763)&quot; /&gt;&lt;/a&gt;&lt;a href=&quot;https://www.wikidot.com/user:info/ccckmit&quot;  &gt;ccckmit&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
</description>
				<pubDate>Wed, 05 Jan 2011 03:07:16 +0000</pubDate>
												<content:encoded>
					<![CDATA[
						 <h1><span>課程</span></h1> <ul> <li>Free, Upcoming online courses:Data Analysis, R, Statistics, Machine Learning, Analytics &#8212; <a href="http://www.kdnuggets.com/2013/02/online-courses-statistics-machine-learning-analytics.html">http://www.kdnuggets.com/2013/02/online-courses-statistics-machine-learning-analytics.html</a></li> <li><a href="https://class.coursera.org/dataanalysis-002/lecture/index">https://class.coursera.org/dataanalysis-002/lecture/index</a></li> </ul> <h1><span>網站</span></h1> <ul> <li>統計之都 &#8212; <a href="http://cos.name/books/">http://cos.name/books/</a></li> <li><a href="http://en.wikibooks.org/wiki/R_Programming">http://en.wikibooks.org/wiki/R_Programming</a></li> <li><a href="https://sites.google.com/site/rlearningsite/analysis/inference">https://sites.google.com/site/rlearningsite/analysis/inference</a></li> </ul> <ul> <li>R commander &#8212; <a href="http://socserv.mcmaster.ca/jfox/Misc/Rcmdr/">http://socserv.mcmaster.ca/jfox/Misc/Rcmdr/</a></li> </ul> <ul> <li>R: 統計計算與程式語言, 林建甫 <ul> <li><a href="http://web.ntpu.edu.tw/~cflin/Teach/R/Rproj.htm">http://web.ntpu.edu.tw/~cflin/Teach/R/Rproj.htm</a></li> </ul> </li> <li>数据科学与R语言 &#8212; <a href="http://xccds1977.blogspot.tw/">http://xccds1977.blogspot.tw/</a> <ul> <li>R书精选之十二宫 &#8212; <a href="http://xccds1977.blogspot.tw/2013/02/r.html">http://xccds1977.blogspot.tw/2013/02/r.html</a></li> </ul> </li> <li><a href="https://sites.google.com/site/stats202/">https://sites.google.com/site/stats202/</a> <ul> <li>R References &#8212; <a href="https://sites.google.com/site/stats202/r">https://sites.google.com/site/stats202/r</a></li> <li>An Introduction to R</li> <li>S Poetry</li> <li>R for Beginners</li> <li>Using R for Introductory Statistics</li> <li>Modern Applied Statistics with S</li> <li>S Programming</li> <li>Extending the Linear Model with R</li> <li>Quick-R</li> </ul> </li> </ul> <h1><span>Taiwan R User Group</span></h1> <ul> <li>聚會網站 &#8212; <a href="http://www.meetup.com/Taiwan-R/">http://www.meetup.com/Taiwan-R/</a></li> <li>youtube 頻道 &#8212; <a href="http://www.youtube.com/user/TWuseRGroup">http://www.youtube.com/user/TWuseRGroup</a></li> <li>fb 粉私 &#8212; <a href="http://www.facebook.com/Tw.R.User">http://www.facebook.com/Tw.R.User</a></li> </ul> <h1><span>R 的電子書</span></h1> <ol> <li>R 文档 &#8212; <a href="http://www.biosino.org/R/R-doc/">http://www.biosino.org/R/R-doc/</a> <ul> <li>《R导论》PDF 版本 &#8212; <a href="http://www.biosino.org/R/R-doc/files/R-intro_cn.pdf">http://www.biosino.org/R/R-doc/files/R-intro_cn.pdf</a> (R 學習：推薦)</li> <li>《R for beginners》中文版 &#8212; <a href="http://www.biosino.org/R/R-doc/files/R4beg_cn_2.0.pdf">http://www.biosino.org/R/R-doc/files/R4beg_cn_2.0.pdf</a> (R 快速入門：推薦)</li> <li>统计学与R读书笔记第五版 &#8212; <a href="http://cran.r-project.org/doc/contrib/Xu-Statistics_and_R.pdf">http://cran.r-project.org/doc/contrib/Xu-Statistics_and_R.pdf</a> (數學統計：推薦) <ul> <li>第四版 &#8212; <a href="http://www.rproject.info/uploads/Site/R.pdf">http://www.rproject.info/uploads/Site/R.pdf</a></li> </ul> </li> <li>统计建模与R软件 &#8212; <a href="http://www.rproject.info/uploads/Site/R-modeling.pdf">http://www.rproject.info/uploads/Site/R-modeling.pdf</a></li> </ul> </li> <li>R 學習筆記 &#8212; <a href="http://sites.google.com/site/rprojectnotes/">http://sites.google.com/site/rprojectnotes/</a></li> <li>R 導論 (丁國徽 譯)&#8212; <a href="http://www.biosino.org/pages/newhtm/r/tchtml/index.html#Top">http://www.biosino.org/pages/newhtm/r/tchtml/index.html#Top</a></li> </ol> <h1><span>R 的線上文件</span></h1> <ol> <li>The R Stats Package &#8212; <a href="http://stat.ethz.ch/R-manual/R-patched/library/stats/html/00Index.html">http://stat.ethz.ch/R-manual/R-patched/library/stats/html/00Index.html</a></li> <li>R Language Definition &#8212; <a href="http://cran.r-project.org/doc/manuals/R-lang.html">http://cran.r-project.org/doc/manuals/R-lang.html</a> <ul> <li><a href="http://cran.r-project.org/doc/manuals/R-lang.pdf">http://cran.r-project.org/doc/manuals/R-lang.pdf</a></li> </ul> </li> <li>R 文档 &#8212; <a href="http://www.biosino.org/R/R-doc/">http://www.biosino.org/R/R-doc/</a> <ul> <li>R 語言定義 &#8212; <a href="http://www.biosino.org/R/R-doc/R-lang/">http://www.biosino.org/R/R-doc/R-lang/</a></li> </ul> </li> <li>R常见问题解答 &#8212; <a href="http://cran.r-project.org/doc/contrib/Liu-FAQ.pdf">http://cran.r-project.org/doc/contrib/Liu-FAQ.pdf</a> <ul> <li><a href="http://cran.r-project.org/doc/FAQ/R-FAQ.html">http://cran.r-project.org/doc/FAQ/R-FAQ.html</a></li> </ul> </li> </ol> <h1><span>R 的參考文獻</span></h1> <ol> <li>Cloud-R : <a href="http://epigenomics.ncu.edu.tw/Cloud-R/index_tw.php">http://epigenomics.ncu.edu.tw/Cloud-R/index_tw.php</a></li> <li>R 语言 简介 &#8212; <a href="http://blog.csdn.net/aixiaohei/article/details/7304629">http://blog.csdn.net/aixiaohei/article/details/7304629</a></li> <li>R 軟體：基本統計分析快速入門 作者：淡江大學統計系 陳景祥 2010/03/15 <ul> <li><a href="http://steve-chen.net/R/R-stat-intro.pdf">http://steve-chen.net/R/R-stat-intro.pdf</a></li> </ul> </li> <li>维基百科:R语言 &#8212; <a href="http://zh.wikipedia.org/zh/R%E8%AF%AD%E8%A8%80">http://zh.wikipedia.org/zh/R%E8%AF%AD%E8%A8%80</a></li> <li>R Reference Card &#8212; <a href="http://cran.r-project.org/doc/contrib/Short-refcard.pdf">http://cran.r-project.org/doc/contrib/Short-refcard.pdf</a></li> <li><a href="http://www.youtube.com/user/wildsc0p">Statistics &amp; Packages : YouTube-wildsc0p 的頻道</a> <ul> <li>Statistics with R (part 1: vector arithmetics tutorial) &#8212; <a href="http://www.youtube.com/watch?v=mL27TAJGlWc">http://www.youtube.com/watch?v=mL27TAJGlWc</a></li> <li>Statistics with R (part 2: help search commands tutorial) &#8212; <a href="http://www.youtube.com/watch?v=d6nSr9L9bVU&amp;feature=related">http://www.youtube.com/watch?v=d6nSr9L9bVU&amp;feature=related</a></li> <li>Statistics with R (part 3: plot and history tutorial) &#8212; <a href="http://www.youtube.com/watch?v=NfH5peM1RtI&amp;feature=related">http://www.youtube.com/watch?v=NfH5peM1RtI&amp;feature=related</a></li> <li>Statistics with R (part 4: R CRAN web tutorial) &#8212; <a href="http://www.youtube.com/watch?v=AipnE4s8sKk&amp;feature=related">http://www.youtube.com/watch?v=AipnE4s8sKk&amp;feature=related</a></li> <li>Statistics with R (part 5: external files tutorial) &#8212; <a href="http://www.youtube.com/watch?v=qb3LpWxvubQ&amp;feature=related">http://www.youtube.com/watch?v=qb3LpWxvubQ&amp;feature=related</a></li> <li>Statistics with R (part 6: matrix operations tutorial) &#8212; <a href="http://www.youtube.com/watch?v=GFsgBqjAMvQ&amp;feature=related">http://www.youtube.com/watch?v=GFsgBqjAMvQ&amp;feature=related</a></li> <li>Statistics with R (part 7: analyzing dataset tutorial) &#8212; <a href="http://www.youtube.com/watch?v=B5h9MHqpGOQ&amp;feature=related">http://www.youtube.com/watch?v=B5h9MHqpGOQ&amp;feature=related</a></li> </ul> </li> <li><a href="http://www.youtube.com/user/Tutorlol">http://www.youtube.com/user/Tutorlol</a> <ul> <li><a href="http://www.youtube.com/watch?v=ZoPJGmpYJzw&amp;feature=related">R Tutorial #1 - Download, Installation, Setup - Statistical Programming Language R</a></li> <li><a href="http://www.youtube.com/watch?v=E1JNGqJqHpU">R Tutorial #2 - Math with Scalars and Vectors - Statistical Programming Language R</a></li> <li><a href="http://www.youtube.com/watch?v=hLozrMhpWuY&amp;feature=related">R Tutorial #3 - More about Vectors - Statistical Programming Language R</a></li> <li><a href="http://www.youtube.com/watch?v=Cpjj02Os2oQ&amp;feature=related">R Tutorial #4 - Introduction to Objects - Statistical Programming Language R</a></li> <li><a href="http://www.youtube.com/watch?v=y8qIkoVRrJM&amp;feature=related">R Tutorial #5 - Project-Managment - Statistical Programming Language R</a></li> <li><a href="http://www.youtube.com/watch?v=a4gfXZmcUx8&amp;feature=related">R Tutorial #6 - Arrays and Matrices - Statistical Programming Language R</a></li> <li><a href="http://www.youtube.com/watch?v=jF71LzipydA&amp;feature=related">R Tutorial #7 - Solving systems of linear equations - Statistical Programming Language R</a></li> <li><a href="http://www.youtube.com/watch?v=9kImnwZHQyc&amp;feature=related">R Tutorial #8 - Reading data from files</a></li> <li><a href="http://www.youtube.com/watch?v=nn9Ej_sKOKM&amp;feature=related">R Tutorial #9 - Scatter Plots</a></li> <li><a href="http://www.youtube.com/watch?v=3gRQsBZSxUo&amp;feature=related">R Tutorial #10 - Linear Regression</a></li> </ul> </li> </ol> <h1><span>實體書</span></h1> <ol> <li>R軟體：應用統計方法 修訂版 附光碟/1片 &#8212; <a href="http://www.books.com.tw/exep/prod/booksfile.php?item=0010486896">http://www.books.com.tw/exep/prod/booksfile.php?item=0010486896</a></li> <li>Introducing Monte Carlo Methods with R &#8212; <a href="http://www.springerlink.com/content/978-1-4419-1575-7#section=625974&amp;page=9&amp;locus=88">http://www.springerlink.com/content/978-1-4419-1575-7#section=625974&amp;page=9&amp;locus=88</a></li> </ol> <h1><span>程式資源</span></h1> <ol> <li>Bayesian Statistics: An Introduction: R programs <ul> <li>Computer programs (in R) relating to the book &#8212; <a href="http://www-users.york.ac.uk/~pml1/bayes/rprogs/">http://www-users.york.ac.uk/~pml1/bayes/rprogs/</a></li> </ul> </li> </ol> <h1><span>投影片</span></h1> <ol> <li>Introducing Monte Carlo Methods with R <ul> <li><a href="http://inst-mat.utalca.cl/jornadasbioestadistica2011/doc/CursoCasella/%20UseR-SC-10-B-Part1.pdf">http://inst-mat.utalca.cl/jornadasbioestadistica2011/doc/CursoCasella/%20UseR-SC-10-B-Part1.pdf</a></li> </ul> </li> </ol> <p>by <span class="printuser avatarhover"><a href="https://www.wikidot.com/user:info/ccckmit" ><img class="small" src="https://www.wikidot.com/avatar.php?userid=296763&amp;amp;size=small&amp;amp;timestamp=1794171486" alt="ccckmit" style="background-image:url(https://www.wikidot.com/userkarma.php?u=296763)" /></a><a href="https://www.wikidot.com/user:info/ccckmit" >ccckmit</a></span></p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://ccckmit.wikidot.com/r:voice</guid>
				<title>R 軟體在語音處理上的用途</title>
				<link>https://ccckmit.wikidot.com/r:voice</link>
				<description>

&lt;ol&gt;
&lt;li&gt;Analysis of music and speech
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://cran.r-project.org/web/packages/tuneR/&quot;&gt;http://cran.r-project.org/web/packages/tuneR/&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Computing and Visualizing Dynamic Time Warping Alignments in R: The dtw Package
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://cran.r-project.org/web/packages/dtw/vignettes/dtw.pdf&quot;&gt;http://cran.r-project.org/web/packages/dtw/vignettes/dtw.pdf&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;The EMU Speech Database System — &lt;a href=&quot;http://emu.sourceforge.net/&quot;&gt;http://emu.sourceforge.net/&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;by &lt;span class=&quot;printuser avatarhover&quot;&gt;&lt;a href=&quot;https://www.wikidot.com/user:info/ccckmit&quot;  &gt;&lt;img class=&quot;small&quot; src=&quot;https://www.wikidot.com/avatar.php?userid=296763&amp;amp;amp;size=small&amp;amp;amp;timestamp=1794171486&quot; alt=&quot;ccckmit&quot; style=&quot;background-image:url(https://www.wikidot.com/userkarma.php?u=296763)&quot; /&gt;&lt;/a&gt;&lt;a href=&quot;https://www.wikidot.com/user:info/ccckmit&quot;  &gt;ccckmit&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
</description>
				<pubDate>Sat, 03 Sep 2011 21:46:21 +0000</pubDate>
												<content:encoded>
					<![CDATA[
						 <ol> <li>Analysis of music and speech <ul> <li><a href="http://cran.r-project.org/web/packages/tuneR/">http://cran.r-project.org/web/packages/tuneR/</a></li> </ul> </li> <li>Computing and Visualizing Dynamic Time Warping Alignments in R: The dtw Package <ul> <li><a href="http://cran.r-project.org/web/packages/dtw/vignettes/dtw.pdf">http://cran.r-project.org/web/packages/dtw/vignettes/dtw.pdf</a></li> </ul> </li> <li>The EMU Speech Database System — <a href="http://emu.sourceforge.net/">http://emu.sourceforge.net/</a></li> </ol> <p>by <span class="printuser avatarhover"><a href="https://www.wikidot.com/user:info/ccckmit" ><img class="small" src="https://www.wikidot.com/avatar.php?userid=296763&amp;amp;size=small&amp;amp;timestamp=1794171486" alt="ccckmit" style="background-image:url(https://www.wikidot.com/userkarma.php?u=296763)" /></a><a href="https://www.wikidot.com/user:info/ccckmit" >ccckmit</a></span></p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://ccckmit.wikidot.com/r:learning</guid>
				<title>機器學習 -- 使用 R 軟體</title>
				<link>https://ccckmit.wikidot.com/r:learning</link>
				<description>

&lt;h1&gt;&lt;span&gt;Q learning&lt;/span&gt;&lt;/h1&gt;
&lt;p&gt;by &lt;span class=&quot;printuser avatarhover&quot;&gt;&lt;a href=&quot;https://www.wikidot.com/user:info/ccckmit&quot;  &gt;&lt;img class=&quot;small&quot; src=&quot;https://www.wikidot.com/avatar.php?userid=296763&amp;amp;amp;size=small&amp;amp;amp;timestamp=1794171486&quot; alt=&quot;ccckmit&quot; style=&quot;background-image:url(https://www.wikidot.com/userkarma.php?u=296763)&quot; /&gt;&lt;/a&gt;&lt;a href=&quot;https://www.wikidot.com/user:info/ccckmit&quot;  &gt;ccckmit&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
</description>
				<pubDate>Sun, 24 Jun 2012 09:02:03 +0000</pubDate>
												<content:encoded>
					<![CDATA[
						 <h1><span>Q learning</span></h1> <ul> <li><a href="http://cran.r-project.org/web/packages/qLearn/qLearn.pdf">http://cran.r-project.org/web/packages/qLearn/qLearn.pdf</a></li> </ul> <div class="code"> <pre><code>set.seed(100) # Simple Simulation on 1000 subjects sim&lt;-matrix(0,nrow=1000,ncol=7) colnames(sim)&lt;-c(&quot;H1&quot;,&quot;A1&quot;,&quot;Y1&quot;,&quot;H2&quot;,&quot;A2&quot;,&quot;Y2&quot;,&quot;IS2&quot;) sim&lt;-as.data.frame(sim) # Randomly generate stage 1 covariates and stage 1 and 2 treatments sim[,c(&quot;H1&quot;,&quot;A1&quot;,&quot;A2&quot;)]&lt;-2*rbinom(1000*3,1,0.5)-1 # Generate stage 2 covariates based on H1 and T1 expit&lt;-exp(0.5*sim$H1+0.5*sim$A1)/(1+exp(0.5*sim$H1+0.5*sim$A1)) sim$H2&lt;-2*rbinom(1000,1,expit)-1 # Assume stage 1 outcome Y1 is 0 # Generate stage 2 outcome Y2 sim$Y2&lt;-0.5*sim$A2+0.5*sim$A2*sim$A1-0.5*sim$A1+rnorm(1000) # Randomly assign 500 subjects to S2 sim[sample(1000,500),&quot;IS2&quot;]&lt;-1 sim[sim$IS2==0,c(&quot;A2&quot;,&quot;Y2&quot;)]&lt;-NA # Define models for both stages s2Formula&lt;-Y2~H1*A1+A1*A2+A2:H2 s1Formula&lt;-Y1~H1*A1 ## Fixed Xi as 0.05 qLearn(s2Formula,s1Formula,sim,s2Treat=&quot;A2&quot;,interact=c(&quot;A1&quot;,&quot;H2&quot;), s2Indicator=&quot;IS2&quot;,s1Method=&quot;Fixed Xi&quot;,fixedXi=0.05,bootNum=100)</code></pre></div> <h1><span>參考文獻</span></h1> <ol> <li>CRAN Task View: Machine Learning &amp; Statistical Learning <ul> <li><a href="http://cran.r-project.org/web/views/MachineLearning.html">http://cran.r-project.org/web/views/MachineLearning.html</a></li> </ul> </li> <li>mlr - Machine Learning in R <ul> <li><a href="http://mlr.r-forge.r-project.org/">http://mlr.r-forge.r-project.org/</a></li> </ul> </li> </ol> <p>by <span class="printuser avatarhover"><a href="https://www.wikidot.com/user:info/ccckmit" ><img class="small" src="https://www.wikidot.com/avatar.php?userid=296763&amp;amp;size=small&amp;amp;timestamp=1794171486" alt="ccckmit" style="background-image:url(https://www.wikidot.com/userkarma.php?u=296763)" /></a><a href="https://www.wikidot.com/user:info/ccckmit" >ccckmit</a></span></p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://ccckmit.wikidot.com/r:optimize</guid>
				<title>R 統計軟體 -- 優化方法 (人工智慧常用)</title>
				<link>https://ccckmit.wikidot.com/r:optimize</link>
				<description>

&lt;ul&gt;
&lt;li&gt;Using R for Data Analysis and Graphics , Introduction, Code and Commentary
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://cran.r-project.org/doc/contrib/usingR.pdf&quot;&gt;http://cran.r-project.org/doc/contrib/usingR.pdf&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Optimize 在台灣稱為最佳化，在中國大陸稱為優化。&lt;/p&gt;
&lt;p&gt;在以下兩個優化方法中，我們都採用函數 &lt;span class=&quot;math-inline&quot;&gt;$f(x) = (x-a)^2$&lt;/span&gt; 作為優化範例。&lt;/p&gt;
&lt;h1&gt;&lt;span&gt;一維空間優化方法：optimize()&lt;/span&gt;&lt;/h1&gt;
&lt;p&gt;在 R 軟體當中內建了一個 One Dimensional Optimization 的方法，名稱是 optimize() 其說明網址如下&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://stat.ethz.ch/R-manual/R-patched/library/stats/html/optimize.html&quot;&gt;http://stat.ethz.ch/R-manual/R-patched/library/stats/html/optimize.html&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;在說明中有兩個使用範例，本文將其中的範例修改成更容易理解的方式，以方便讀者追蹤。&lt;/p&gt;
&lt;h2&gt;&lt;span&gt;範例一：&lt;span class=&quot;math-inline&quot;&gt;$optimize(f(x) = (x-1/3)^2) ; 0 \le x \le1$&lt;/span&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;pre&gt;&lt;code&gt;&amp;gt; f &amp;lt;- function (x) { r = (x-1/3)^2; cat(&amp;quot;x=&amp;quot;, x, &amp;quot;f(x)=&amp;quot;, r, &amp;quot;\n&amp;quot;); r; }
&amp;gt; optimize(f, c(-7, 20))
x= 3.313082 f(x)= 8.878904 
x= 9.686918 f(x)= 87.48954 
x= -0.6261646 f(x)= 0.9206363 
x= 0.3333333 f(x)= 2.496005e-31 
x= 0.333374 f(x)= 1.656089e-09 
x= 0.3332926 f(x)= 1.656089e-09 
x= 0.3333333 f(x)= 2.496005e-31 
$minimum
[1] 0.3333333

$objective
[1] 2.496005e-31

&amp;gt; optimize(f, c(0, 1))
x= 0.381966 f(x)= 0.002365137 
x= 0.618034 f(x)= 0.08105446 
x= 0.236068 f(x)= 0.009460549 
x= 0.3333333 f(x)= 0 
x= 0.3332926 f(x)= 1.656089e-09 
x= 0.333374 f(x)= 1.656089e-09 
x= 0.3333333 f(x)= 0 
$minimum
[1] 0.3333333

$objective
[1] 0&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2&gt;&lt;span&gt;範例二：&lt;span class=&quot;math-inline&quot;&gt;$optimize(f(x) = x^2 * (x-1) = x^3 - x^2) ; 0 \le x \le 10$&lt;/span&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;pre&gt;&lt;code&gt;&amp;gt; ## See where the function is evaluated:
&amp;gt; optimize(function(x) x^2*(print(x)-1), lower=0, upper=10)
[1] 3.81966
[1] 6.18034
[1] 2.36068
[1] 2.077939
[1] 1.505823
[1] 0.9306496
[1] 0.9196752
[1] 0.772905
[1] 0.4776816
[1] 0.6491436
[1] 0.656315
[1] 0.6653777
[1] 0.6667786
[1] 0.6666728
[1] 0.6666321
[1] 0.6667135
[1] 0.6666728
$minimum
[1] 0.6666728

$objective
[1] -0.1481481&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2&gt;&lt;span&gt;範例三：optimize() 走錯方向了&lt;/span&gt;&lt;/h2&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;pre&gt;&lt;code&gt;&amp;gt; fp &amp;lt;- function(x) { cat(&amp;quot;x=&amp;quot;, x, &amp;quot;f(x)=&amp;quot;, f(x), &amp;quot;\n&amp;quot;); f(x) }
&amp;gt; optimize(fp, c(-4, 20))# doesn&#039;t see the minimum
x= 5.167184 f(x)= 10 
x= 10.83282 f(x)= 10 
x= 14.33437 f(x)= 10 
x= 16.49845 f(x)= 10 
x= 17.83592 f(x)= 10 
x= 18.66253 f(x)= 10 
x= 19.1734 f(x)= 10 
x= 19.48913 f(x)= 10 
x= 19.68427 f(x)= 10 
x= 19.80487 f(x)= 10 
x= 19.8794 f(x)= 10 
x= 19.92547 f(x)= 10 
x= 19.95393 f(x)= 10 
x= 19.97153 f(x)= 10 
x= 19.9824 f(x)= 10 
x= 19.98913 f(x)= 10 
x= 19.99328 f(x)= 10 
x= 19.99585 f(x)= 10 
x= 19.99743 f(x)= 10 
x= 19.99841 f(x)= 10 
x= 19.99902 f(x)= 10 
x= 19.99939 f(x)= 10 
x= 19.99963 f(x)= 10 
x= 19.99977 f(x)= 10 
x= 19.99986 f(x)= 10 
x= 19.99991 f(x)= 10 
x= 19.99995 f(x)= 10 
x= 19.99995 f(x)= 10 
$minimum
[1] 19.99995

$objective
[1] 10

&amp;gt; 
&amp;gt; optimize(fp, c(-7, 20))# o&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;但是如果調整 y 的搜尋範圍，就可能走對方向，請看以下結果。&lt;/p&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;pre&gt;&lt;code&gt;&amp;gt; optimize(fp, c(-7, 20))
x= 3.313082 f(x)= 0.6489993 
x= 9.686918 f(x)= 10 
x= -0.6261646 f(x)= 0.5406712 
x= 1.244956 f(x)= 0.01686762 
x= 1.250965 f(x)= 0.01859948 
x= 0.771827 f(x)= 0.01249235 
x= 0.2378417 f(x)= 0.2692639 
x= 1.000451 f(x)= 0 
x= 0.9906964 f(x)= 2.088206e-47 
x= 0.9955736 f(x)= 7.684301e-99 
x= 0.9980122 f(x)= 3.320444e-219 
x= 0.9992315 f(x)= 0 
x= 0.9998411 f(x)= 0 
x= 0.9996083 f(x)= 0 
x= 0.9994644 f(x)= 0 
x= 0.9993754 f(x)= 0 
x= 0.9993204 f(x)= 0 
x= 0.9992797 f(x)= 0 
x= 0.9992797 f(x)= 0 
$minimum
[1] 0.9992797

$objective
[1] 0

&amp;gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h1&gt;&lt;span&gt;非線性優化方法：nlm() 最小化&lt;/span&gt;&lt;/h1&gt;
&lt;p&gt;在 R 軟體當中內建了一個非線性優化方法，名稱是 nlm() 其說明網址如下&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://stat.ethz.ch/R-manual/R-patched/library/stats/html/nlm.html&quot;&gt;http://stat.ethz.ch/R-manual/R-patched/library/stats/html/nlm.html&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;在說明中有一個使用範例，筆者執行結果如下：&lt;/p&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;pre&gt;&lt;code&gt;&amp;gt; f &amp;lt;- function(x) sum((x-1:length(x))^2)
&amp;gt; nlm(f, c(10,10))
$minimum
[1] 4.303458e-26

$estimate
[1] 1 2

$gradient
[1]  2.757794e-13 -3.099743e-13

$code
[1] 1

$iterations
[1] 2

&amp;gt; nlm(f, c(10,10), print.level = 2)
iteration = 0
Step:
[1] 0 0
Parameter:
[1] 10 10
Function Value
[1] 145
Gradient:
[1] 18.00001 16.00001

iteration = 1
Step:
[1] -9 -8
Parameter:
[1] 1 2
Function Value
[1] 1.721748e-13
Gradient:
[1] 1.551336e-06 1.379735e-06

iteration = 2
Parameter:
[1] 1 2
Function Value
[1] 4.303458e-26
Gradient:
[1]  2.757794e-13 -3.099743e-13

相對梯度距離零太近。
目前的迭代值很可能就已經是答案了。

$minimum
[1] 4.303458e-26

$estimate
[1] 1 2

$gradient
[1]  2.757794e-13 -3.099743e-13

$code
[1] 1

$iterations
[1] 2

&amp;gt; utils::str(nlm(f, c(5), hessian = TRUE))
List of 6
 $ minimum   : num 2.44e-24
 $ estimate  : num 1
 $ gradient  : num 1e-06
 $ hessian   : num [1, 1] 2
 $ code      : int 1
 $ iterations: int 1
&amp;gt; 
&amp;gt; f &amp;lt;- function(x, a) sum((x-a)^2)
&amp;gt; nlm(f, c(10,10), a=c(3,5))
$minimum
[1] 3.371781e-25

$estimate
[1] 3 5

$gradient
[1]  6.750156e-13 -9.450218e-13

$code
[1] 1

$iterations
[1] 2

&amp;gt; f &amp;lt;- function(x, a)
+ {
+     res &amp;lt;- sum((x-a)^2)
+     attr(res, &amp;quot;gradient&amp;quot;) &amp;lt;- 2*(x-a)
+     res
+ }
&amp;gt; nlm(f, c(10,10), a=c(3,5))
$minimum
[1] 0

$estimate
[1] 3 5

$gradient
[1] 0 0

$code
[1] 1

$iterations
[1] 1

&amp;gt; 
&amp;gt; ## more examples, including the use of derivatives.
&amp;gt; ## Not run: demo(nlm)
&amp;gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h1&gt;&lt;span&gt;多維空間優化方法 optim()&lt;/span&gt;&lt;/h1&gt;
&lt;ol&gt;
&lt;li&gt;參考：R 學習筆記/數學應用‎/數值分析/最佳化（Numerical Optimization）
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://sites.google.com/site/rprojectnotes/mathematics/numerical_analysis#TOC-Numerical-Optimization&quot;&gt;https://sites.google.com/site/rprojectnotes/mathematics/numerical_analysis#TOC-Numerical-Optimization&lt;/a&gt;-&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h1&gt;&lt;span&gt;線性不等式限制區求最小值: constrOptim()&lt;/span&gt;&lt;/h1&gt;
&lt;ol&gt;
&lt;li&gt;constrOptim {stats} Linearly Constrained Optimization
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://stat.ethz.ch/R-manual/R-patched/library/stats/html/constrOptim.html&quot;&gt;http://stat.ethz.ch/R-manual/R-patched/library/stats/html/constrOptim.html&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;by &lt;span class=&quot;printuser avatarhover&quot;&gt;&lt;a href=&quot;https://www.wikidot.com/user:info/ccckmit&quot;  &gt;&lt;img class=&quot;small&quot; src=&quot;https://www.wikidot.com/avatar.php?userid=296763&amp;amp;amp;size=small&amp;amp;amp;timestamp=1794171486&quot; alt=&quot;ccckmit&quot; style=&quot;background-image:url(https://www.wikidot.com/userkarma.php?u=296763)&quot; /&gt;&lt;/a&gt;&lt;a href=&quot;https://www.wikidot.com/user:info/ccckmit&quot;  &gt;ccckmit&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
</description>
				<pubDate>Fri, 02 Sep 2011 06:48:24 +0000</pubDate>
												<content:encoded>
					<![CDATA[
						 <ul> <li>Using R for Data Analysis and Graphics , Introduction, Code and Commentary <ul> <li><a href="http://cran.r-project.org/doc/contrib/usingR.pdf">http://cran.r-project.org/doc/contrib/usingR.pdf</a></li> </ul> </li> </ul> <p>Optimize 在台灣稱為最佳化，在中國大陸稱為優化。</p> <p>在以下兩個優化方法中，我們都採用函數 <span class="math-inline">$f(x) = (x-a)^2$</span> 作為優化範例。</p> <h1><span>一維空間優化方法：optimize()</span></h1> <p>在 R 軟體當中內建了一個 One Dimensional Optimization 的方法，名稱是 optimize() 其說明網址如下</p> <ul> <li><a href="http://stat.ethz.ch/R-manual/R-patched/library/stats/html/optimize.html">http://stat.ethz.ch/R-manual/R-patched/library/stats/html/optimize.html</a></li> </ul> <p>在說明中有兩個使用範例，本文將其中的範例修改成更容易理解的方式，以方便讀者追蹤。</p> <h2><span>範例一：<span class="math-inline">$optimize(f(x) = (x-1/3)^2) ; 0 \le x \le1$</span></span></h2> <div class="code"> <pre><code>&gt; f &lt;- function (x) { r = (x-1/3)^2; cat(&quot;x=&quot;, x, &quot;f(x)=&quot;, r, &quot;\n&quot;); r; } &gt; optimize(f, c(-7, 20)) x= 3.313082 f(x)= 8.878904 x= 9.686918 f(x)= 87.48954 x= -0.6261646 f(x)= 0.9206363 x= 0.3333333 f(x)= 2.496005e-31 x= 0.333374 f(x)= 1.656089e-09 x= 0.3332926 f(x)= 1.656089e-09 x= 0.3333333 f(x)= 2.496005e-31 $minimum [1] 0.3333333 $objective [1] 2.496005e-31 &gt; optimize(f, c(0, 1)) x= 0.381966 f(x)= 0.002365137 x= 0.618034 f(x)= 0.08105446 x= 0.236068 f(x)= 0.009460549 x= 0.3333333 f(x)= 0 x= 0.3332926 f(x)= 1.656089e-09 x= 0.333374 f(x)= 1.656089e-09 x= 0.3333333 f(x)= 0 $minimum [1] 0.3333333 $objective [1] 0</code></pre></div> <h2><span>範例二：<span class="math-inline">$optimize(f(x) = x^2 * (x-1) = x^3 - x^2) ; 0 \le x \le 10$</span></span></h2> <div class="code"> <pre><code>&gt; ## See where the function is evaluated: &gt; optimize(function(x) x^2*(print(x)-1), lower=0, upper=10) [1] 3.81966 [1] 6.18034 [1] 2.36068 [1] 2.077939 [1] 1.505823 [1] 0.9306496 [1] 0.9196752 [1] 0.772905 [1] 0.4776816 [1] 0.6491436 [1] 0.656315 [1] 0.6653777 [1] 0.6667786 [1] 0.6666728 [1] 0.6666321 [1] 0.6667135 [1] 0.6666728 $minimum [1] 0.6666728 $objective [1] -0.1481481</code></pre></div> <h2><span>範例三：optimize() 走錯方向了</span></h2> <div class="code"> <pre><code>&gt; fp &lt;- function(x) { cat(&quot;x=&quot;, x, &quot;f(x)=&quot;, f(x), &quot;\n&quot;); f(x) } &gt; optimize(fp, c(-4, 20))# doesn't see the minimum x= 5.167184 f(x)= 10 x= 10.83282 f(x)= 10 x= 14.33437 f(x)= 10 x= 16.49845 f(x)= 10 x= 17.83592 f(x)= 10 x= 18.66253 f(x)= 10 x= 19.1734 f(x)= 10 x= 19.48913 f(x)= 10 x= 19.68427 f(x)= 10 x= 19.80487 f(x)= 10 x= 19.8794 f(x)= 10 x= 19.92547 f(x)= 10 x= 19.95393 f(x)= 10 x= 19.97153 f(x)= 10 x= 19.9824 f(x)= 10 x= 19.98913 f(x)= 10 x= 19.99328 f(x)= 10 x= 19.99585 f(x)= 10 x= 19.99743 f(x)= 10 x= 19.99841 f(x)= 10 x= 19.99902 f(x)= 10 x= 19.99939 f(x)= 10 x= 19.99963 f(x)= 10 x= 19.99977 f(x)= 10 x= 19.99986 f(x)= 10 x= 19.99991 f(x)= 10 x= 19.99995 f(x)= 10 x= 19.99995 f(x)= 10 $minimum [1] 19.99995 $objective [1] 10 &gt; &gt; optimize(fp, c(-7, 20))# o</code></pre></div> <p>但是如果調整 y 的搜尋範圍，就可能走對方向，請看以下結果。</p> <div class="code"> <pre><code>&gt; optimize(fp, c(-7, 20)) x= 3.313082 f(x)= 0.6489993 x= 9.686918 f(x)= 10 x= -0.6261646 f(x)= 0.5406712 x= 1.244956 f(x)= 0.01686762 x= 1.250965 f(x)= 0.01859948 x= 0.771827 f(x)= 0.01249235 x= 0.2378417 f(x)= 0.2692639 x= 1.000451 f(x)= 0 x= 0.9906964 f(x)= 2.088206e-47 x= 0.9955736 f(x)= 7.684301e-99 x= 0.9980122 f(x)= 3.320444e-219 x= 0.9992315 f(x)= 0 x= 0.9998411 f(x)= 0 x= 0.9996083 f(x)= 0 x= 0.9994644 f(x)= 0 x= 0.9993754 f(x)= 0 x= 0.9993204 f(x)= 0 x= 0.9992797 f(x)= 0 x= 0.9992797 f(x)= 0 $minimum [1] 0.9992797 $objective [1] 0 &gt;</code></pre></div> <h1><span>非線性優化方法：nlm() 最小化</span></h1> <p>在 R 軟體當中內建了一個非線性優化方法，名稱是 nlm() 其說明網址如下</p> <ul> <li><a href="http://stat.ethz.ch/R-manual/R-patched/library/stats/html/nlm.html">http://stat.ethz.ch/R-manual/R-patched/library/stats/html/nlm.html</a></li> </ul> <p>在說明中有一個使用範例，筆者執行結果如下：</p> <div class="code"> <pre><code>&gt; f &lt;- function(x) sum((x-1:length(x))^2) &gt; nlm(f, c(10,10)) $minimum [1] 4.303458e-26 $estimate [1] 1 2 $gradient [1] 2.757794e-13 -3.099743e-13 $code [1] 1 $iterations [1] 2 &gt; nlm(f, c(10,10), print.level = 2) iteration = 0 Step: [1] 0 0 Parameter: [1] 10 10 Function Value [1] 145 Gradient: [1] 18.00001 16.00001 iteration = 1 Step: [1] -9 -8 Parameter: [1] 1 2 Function Value [1] 1.721748e-13 Gradient: [1] 1.551336e-06 1.379735e-06 iteration = 2 Parameter: [1] 1 2 Function Value [1] 4.303458e-26 Gradient: [1] 2.757794e-13 -3.099743e-13 相對梯度距離零太近。 目前的迭代值很可能就已經是答案了。 $minimum [1] 4.303458e-26 $estimate [1] 1 2 $gradient [1] 2.757794e-13 -3.099743e-13 $code [1] 1 $iterations [1] 2 &gt; utils::str(nlm(f, c(5), hessian = TRUE)) List of 6 $ minimum : num 2.44e-24 $ estimate : num 1 $ gradient : num 1e-06 $ hessian : num [1, 1] 2 $ code : int 1 $ iterations: int 1 &gt; &gt; f &lt;- function(x, a) sum((x-a)^2) &gt; nlm(f, c(10,10), a=c(3,5)) $minimum [1] 3.371781e-25 $estimate [1] 3 5 $gradient [1] 6.750156e-13 -9.450218e-13 $code [1] 1 $iterations [1] 2 &gt; f &lt;- function(x, a) + { + res &lt;- sum((x-a)^2) + attr(res, &quot;gradient&quot;) &lt;- 2*(x-a) + res + } &gt; nlm(f, c(10,10), a=c(3,5)) $minimum [1] 0 $estimate [1] 3 5 $gradient [1] 0 0 $code [1] 1 $iterations [1] 1 &gt; &gt; ## more examples, including the use of derivatives. &gt; ## Not run: demo(nlm) &gt;</code></pre></div> <h1><span>多維空間優化方法 optim()</span></h1> <ol> <li>參考：R 學習筆記/數學應用‎/數值分析/最佳化（Numerical Optimization） <ul> <li><a href="https://sites.google.com/site/rprojectnotes/mathematics/numerical_analysis#TOC-Numerical-Optimization">https://sites.google.com/site/rprojectnotes/mathematics/numerical_analysis#TOC-Numerical-Optimization</a>-</li> </ul> </li> </ol> <h1><span>線性不等式限制區求最小值: constrOptim()</span></h1> <ol> <li>constrOptim {stats} Linearly Constrained Optimization <ul> <li><a href="http://stat.ethz.ch/R-manual/R-patched/library/stats/html/constrOptim.html">http://stat.ethz.ch/R-manual/R-patched/library/stats/html/constrOptim.html</a></li> </ul> </li> </ol> <p>by <span class="printuser avatarhover"><a href="https://www.wikidot.com/user:info/ccckmit" ><img class="small" src="https://www.wikidot.com/avatar.php?userid=296763&amp;amp;size=small&amp;amp;timestamp=1794171486" alt="ccckmit" style="background-image:url(https://www.wikidot.com/userkarma.php?u=296763)" /></a><a href="https://www.wikidot.com/user:info/ccckmit" >ccckmit</a></span></p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://ccckmit.wikidot.com/r:nerual</guid>
				<title>神經網路</title>
				<link>https://ccckmit.wikidot.com/r:nerual</link>
				<description>

&lt;p&gt;neural network animation in R &amp;#8212; &lt;a href=&quot;https://www.youtube.com/watch?v=gY9DewL6Dqk&quot;&gt;https://www.youtube.com/watch?v=gY9DewL6Dqk&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;by &lt;span class=&quot;printuser avatarhover&quot;&gt;&lt;a href=&quot;https://www.wikidot.com/user:info/ccckmit&quot;  &gt;&lt;img class=&quot;small&quot; src=&quot;https://www.wikidot.com/avatar.php?userid=296763&amp;amp;amp;size=small&amp;amp;amp;timestamp=1794171486&quot; alt=&quot;ccckmit&quot; style=&quot;background-image:url(https://www.wikidot.com/userkarma.php?u=296763)&quot; /&gt;&lt;/a&gt;&lt;a href=&quot;https://www.wikidot.com/user:info/ccckmit&quot;  &gt;ccckmit&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
</description>
				<pubDate>Sun, 24 Jun 2012 10:31:09 +0000</pubDate>
												<content:encoded>
					<![CDATA[
						 <p>neural network animation in R &#8212; <a href="https://www.youtube.com/watch?v=gY9DewL6Dqk">https://www.youtube.com/watch?v=gY9DewL6Dqk</a></p> <h1><span>實驗</span></h1> <p>參考：<a href="http://gekkoquant.com/2012/05/26/neural-networks-with-r-simple-example/">http://gekkoquant.com/2012/05/26/neural-networks-with-r-simple-example/</a></p> <div class="code"> <pre><code>&gt; install.packages('neuralnet') 嘗試 URL 'http://cran.csie.ntu.edu.tw/bin/windows/contrib/3.0/neuralnet_1.32.zip' Content type 'application/zip' length 58718 bytes (57 Kb) 開啟了 URL downloaded 57 Kb package ‘neuralnet’ successfully unpacked and MD5 sums checked The downloaded binary packages are in C:\Users\ccc\AppData\Local\Temp\Rtmp0sE1PU\downloaded_packages &gt; library(&quot;neuralnet&quot;) Loading required package: grid Loading required package: MASS &gt; traininginput &lt;- as.data.frame(runif(50, min=0, max=100)) &gt; trainingoutput &lt;- sqrt(traininginput) &gt; trainingdata &lt;- cbind(traininginput,trainingoutput) &gt; colnames(trainingdata) &lt;- c(&quot;Input&quot;,&quot;Output&quot;) &gt; net.sqrt &lt;- neuralnet(Output~Input,trainingdata, hidden=10, threshold=0.01) &gt; print(net.sqrt) Call: neuralnet(formula = Output ~ Input, data = trainingdata, hidden = 10, threshold = 0.01) 1 repetition was calculated. Error Reached Threshold Steps 1 0.0001101775792 0.008844721887 4735 &gt; plot(net.sqrt)</code></pre></div> <a href="https://ccckmit.wdfiles.com/local--files/r:nerual/nerualnet.jpg"><img src="https://ccckmit.wdfiles.com/local--resized-images/r:nerual/nerualnet.jpg/medium.jpg" alt="nerualnet.jpg" class="image" /></a> <div class="code"> <pre><code>&gt; testdata &lt;- as.data.frame((1:10)^2) &gt; net.results &lt;- compute(net.sqrt, testdata) &gt; ls(net.results) [1] &quot;net.result&quot; &quot;neurons&quot; &gt; print(net.results$net.result) [,1] [1,] 1.001467881 [2,] 1.999387727 [3,] 3.001562476 [4,] 3.999058142 [5,] 5.000677091 [6,] 6.000564137 [7,] 6.999302601 [8,] 7.998807718 [9,] 9.003759600 [10,] 9.981962425 &gt; cleanoutput &lt;- cbind(testdata,sqrt(testdata), + as.data.frame(net.results$net.result)) &gt; colnames(cleanoutput) &lt;- c(&quot;Input&quot;,&quot;Expected Output&quot;,&quot;Neural Net Output&quot;) &gt; print(cleanoutput) Input Expected Output Neural Net Output 1 1 1 1.001467881 2 4 2 1.999387727 3 9 3 3.001562476 4 16 4 3.999058142 5 25 5 5.000677091 6 36 6 6.000564137 7 49 7 6.999302601 8 64 8 7.998807718 9 81 9 9.003759600 10 100 10 9.981962425 &gt;</code></pre></div> <h1><span>參考文獻</span></h1> <ol> <li>neuralnet: Training of neural networks <ul> <li><a href="http://cran.r-project.org/web/packages/neuralnet/index.html">http://cran.r-project.org/web/packages/neuralnet/index.html</a></li> <li>Neural Networks with R – A Simple Example <ul> <li><a href="http://gekkoquant.com/2012/05/26/neural-networks-with-r-simple-example/">http://gekkoquant.com/2012/05/26/neural-networks-with-r-simple-example/</a></li> </ul> </li> </ul> </li> <li><a href="http://cran.r-project.org/web/views/MachineLearning.html">http://cran.r-project.org/web/views/MachineLearning.html</a> <ul> <li>Neural Networks : Single-hidden-layer neural network are implemented in package nnet (shipped with base R). Package RSNNS offers an interface to the Stuttgart Neural Network Simulator (SNNS).</li> </ul> </li> <li>neuralnet: Training of Neural Networks, by Frauke Günther and Stefan Fritsch <ul> <li><a href="http://journal.r-project.org/archive/2010-1/RJournal_2010-1_Guenther+Fritsch.pdf">http://journal.r-project.org/archive/2010-1/RJournal_2010-1_Guenther+Fritsch.pdf</a></li> </ul> </li> </ol> <p>by <span class="printuser avatarhover"><a href="https://www.wikidot.com/user:info/ccckmit" ><img class="small" src="https://www.wikidot.com/avatar.php?userid=296763&amp;amp;size=small&amp;amp;timestamp=1794171486" alt="ccckmit" style="background-image:url(https://www.wikidot.com/userkarma.php?u=296763)" /></a><a href="https://www.wikidot.com/user:info/ccckmit" >ccckmit</a></span></p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://ccckmit.wikidot.com/r:graph</guid>
				<title>R -- 圖形理論 (含搜尋策略)</title>
				<link>https://ccckmit.wikidot.com/r:graph</link>
				<description>

&lt;ol&gt;
&lt;li&gt;&lt;a href=&quot;http://cran.r-project.org/web/packages/igraph/index.html&quot;&gt;http://cran.r-project.org/web/packages/igraph/index.html&lt;/a&gt; (iGraph)
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://cran.r-project.org/web/packages/igraph/igraph.pdf&quot;&gt;http://cran.r-project.org/web/packages/igraph/igraph.pdf&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Practical statistical network analysis (with R and igraph)
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://statmath.wu.ac.at/research/friday/resources_WS0708_SS08/igraph.pdf&quot;&gt;http://statmath.wu.ac.at/research/friday/resources_WS0708_SS08/igraph.pdf&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;包含 Alpha-Beta Cut &amp;#8230;.&lt;/li&gt;
&lt;li&gt;Find distance of route from get.shortest.paths() &amp;#8212; &lt;a href=&quot;http://stackoverflow.com/questions/9317923/find-distance-of-route-from-get-shortest-paths&quot;&gt;http://stackoverflow.com/questions/9317923/find-distance-of-route-from-get-shortest-paths&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;shortest.paths {igraph} &amp;#8212; &lt;a href=&quot;http://igraph.sourceforge.net/doc/R/shortest.paths.html&quot;&gt;http://igraph.sourceforge.net/doc/R/shortest.paths.html&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;初次尝试igraph包 &amp;#8212; &lt;a href=&quot;http://xccds1977.blogspot.tw/2012/06/igraph.html&quot;&gt;http://xccds1977.blogspot.tw/2012/06/igraph.html&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;BFS &amp;#8212; &lt;a href=&quot;http://www.inside-r.org/packages/cran/igraph/docs/graph.bfs&quot;&gt;http://www.inside-r.org/packages/cran/igraph/docs/graph.bfs&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;DFS &amp;#8212; &lt;a href=&quot;http://www.biostatistician.cn/thread-47443-1-1.html&quot;&gt;http://www.biostatistician.cn/thread-47443-1-1.html&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;影片:iGraph tutorial &amp;#8212; &lt;a href=&quot;https://www.youtube.com/watch?v=1gDQg5abHsE&quot;&gt;https://www.youtube.com/watch?v=1gDQg5abHsE&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://igraph.sourceforge.net/&quot;&gt;http://igraph.sourceforge.net/&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://cran.r-project.org/web/packages/qgraph/index.html&quot;&gt;http://cran.r-project.org/web/packages/qgraph/index.html&lt;/a&gt; (qGraph)
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://cran.r-project.org/web/packages/qgraph/qgraph.pdf&quot;&gt;http://cran.r-project.org/web/packages/qgraph/qgraph.pdf&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Draw Network in R (control edge thickness plus non-overlapping edges)
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://stackoverflow.com/questions/7521381/draw-network-in-r-control-edge-thickness-plus-non-overlapping-edges&quot;&gt;http://stackoverflow.com/questions/7521381/draw-network-in-r-control-edge-thickness-plus-non-overlapping-edges&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;gRaphical Models in R &amp;#8212; &lt;a href=&quot;http://cran.r-project.org/web/views/gR.html&quot;&gt;http://cran.r-project.org/web/views/gR.html&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;h1&gt;&lt;span&gt;igraph 操作&lt;/span&gt;&lt;/h1&gt;
&lt;p&gt;必須先用 install.packages(&amp;quot;igraph&amp;quot;) 安裝 igraph 套件，然後再用 library(&amp;quot;igraph&amp;quot;) 引入套件。&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://statmath.wu.ac.at/research/friday/resources_WS0708_SS08/igraph.pdf&quot;&gt;http://statmath.wu.ac.at/research/friday/resources_WS0708_SS08/igraph.pdf&lt;/a&gt; (讚！)&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;pre&gt;&lt;code&gt;g &amp;lt;- graph( c(0,1, 0,2, 1,2, 2,4), n=5 ) # 失敗.... 由於 igraph 改從 1 開始了，所以不能從 0 開始 ....

g &amp;lt;- graph( c(1,2, 1,3, 2,3, 3,5), n=5 )
g
IGRAPH D--- 5 4 -- 
plot(g)&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;問題：&lt;a href=&quot;http://stackoverflow.com/questions/7521381/draw-network-in-r-control-edge-thickness-plus-non-overlapping-edges&quot;&gt;http://stackoverflow.com/questions/7521381/draw-network-in-r-control-edge-thickness-plus-non-overlapping-edges&lt;/a&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;I&#039;m not sure why but the bit which has the code g &amp;lt;- graph.edgelist(as.matrix(Edges[,-3]-1)) produces an error like Error in graph(t(el), directed = directed) : At structure_generators.c:84 : Invalid (negative) vertex id, Invalid vertex id any idea what the problem is? – h.l.m Oct 3 &#039;12 at 1:23&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;解答：&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;This is because since this answer igraph changed node numbering starting from 1 now where it was 0. It works if you remove the -1. Edited the answer as well. – Sacha Epskamp Oct 3 &#039;12 at 6:06&lt;/p&gt;
&lt;/blockquote&gt;
&lt;ul&gt;
&lt;li&gt;Graph theory — analysis and visualization &amp;#8212; &lt;a href=&quot;http://stats.stackexchange.com/questions/6155/graph-theory-analysis-and-visualization&quot;&gt;http://stats.stackexchange.com/questions/6155/graph-theory-analysis-and-visualization&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;pre&gt;&lt;code&gt;adj.mat &amp;lt;- matrix(sample(c(0,1), 9, replace=TRUE), nr=3)
g &amp;lt;- graph.adjacency(adj.mat)
plot(g)&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;数据科学与R语言:初次尝试igraph包 &amp;#8212; &lt;a href=&quot;http://xccds1977.blogspot.tw/2012/06/igraph.html&quot;&gt;http://xccds1977.blogspot.tw/2012/06/igraph.html&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;pre&gt;&lt;code&gt;# 也可以画出一些特殊结构的图形，例如下面的星形图
g2 &amp;lt;- graph.star(10, mode = &amp;quot;in&amp;quot;)
plot(g2,layout=layout.fruchterman.reingold(g2))

# 当然也能从文件创建图形
# 首先读入数据，整理后用graph.data.frame函数创建图形对象
traits &amp;lt;- read.csv(&#039;http://igraph.sourceforge.net/igraphbook/traits.csv&#039;, head=FALSE)
names(traits) &amp;lt;- c(&#039;name&#039;,&#039;age&#039;,&#039;gender&#039;)
traits[,1] &amp;lt;- sapply(strsplit(as.character(traits[,1]),&#039; &#039;),&#039;[&#039;,1)
relation &amp;lt;- read.csv(&#039;http://igraph.sourceforge.net/igraphbook/relations.csv&#039;, head=FALSE)
names(relation) &amp;lt;- c(&#039;from&#039;,&#039;to&#039;,&#039;sameroom&#039;,&#039;friendship&#039;,&#039;advice&#039;)
g4 &amp;lt;- graph.data.frame(relation,vertices=traits)
plot(g4,layout=layout.kamada.kawai,vertex.shape=&#039;rectangle&#039;,vertex.label=V(g4)$name,vertex.size=20,asp=F)&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://www.r-bloggers.com/network-visualization-in-r-with-the-igraph-package/&quot;&gt;http://www.r-bloggers.com/network-visualization-in-r-with-the-igraph-package/&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;pre&gt;&lt;code&gt;# Data format. The data is in &#039;edges&#039; format meaning that each row records a relationship (edge) between two people (vertices).
# Additional attributes can be included. Here is an example:
#    Supervisor    Examiner    Grade    Spec(ialization)
#    AA        BD        6    X    
#    BD        CA        8    Y
#    AA        DE        7    Y
#    ...        ...        ...    ...
# In this anonymized example, we have data on co-supervision with additional information about grades and specialization. 
# It is also possible to have the data in a matrix form (see the igraph documentation for details)

# Load the data. The data needs to be loaded as a table first: 

bsk&amp;lt;-read.table(&amp;quot;http://www.dimiter.eu/Data_files/edgesdata3.txt&amp;quot;, sep=&#039;\t&#039;, dec=&#039;,&#039;, header=T)#specify the path, separator(tab, comma, ...), decimal point symbol, etc.

# Transform the table into the required graph format:
bsk.network&amp;lt;-graph.data.frame(bsk, directed=F) #the &#039;directed&#039; attribute specifies whether the edges are directed
# or equivelent irrespective of the position (1st vs 2nd column). For directed graphs use &#039;directed=T&#039;

# Inspect the data:

V(bsk.network) #prints the list of vertices (people)
E(bsk.network) #prints the list of edges (relationships)
degree(bsk.network) #print the number of edges per vertex (relationships per people)

# First try. We can plot the graph right away but the results will usually be unsatisfactory:
plot(bsk.network)&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;範例 2&lt;/p&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;pre&gt;&lt;code&gt;#Subset the data. If we want to exclude people who are in the network only tangentially (participate in one or two relationships only)
# we can exclude the by subsetting the graph on the basis of the &#039;degree&#039;:

bad.vs&amp;lt;-V(bsk.network)[degree(bsk.network)&amp;lt;3] #identify those vertices part of less than three edges
bsk.network&amp;lt;-delete.vertices(bsk.network, bad.vs) #exclude them from the graph

# Plot the data.Some details about the graph can be specified in advance.
# For example we can separate some vertices (people) by color:

V(bsk.network)$color&amp;lt;-ifelse(V(bsk.network)$name==&#039;CA&#039;, &#039;blue&#039;, &#039;red&#039;) #useful for highlighting certain people. Works by matching the name attribute of the vertex to the one specified in the &#039;ifelse&#039; expression

# We can also color the connecting edges differently depending on the &#039;grade&#039;: 

E(bsk.network)$color&amp;lt;-ifelse(E(bsk.network)$grade==9, &amp;quot;red&amp;quot;, &amp;quot;grey&amp;quot;)

# or depending on the different specialization (&#039;spec&#039;):

E(bsk.network)$color&amp;lt;-ifelse(E(bsk.network)$spec==&#039;X&#039;, &amp;quot;red&amp;quot;, ifelse(E(bsk.network)$spec==&#039;Y&#039;, &amp;quot;blue&amp;quot;, &amp;quot;grey&amp;quot;))

# Note: the example uses nested ifelse expressions which is in general a bad idea but does the job in this case
# Additional attributes like size can be further specified in an analogous manner, either in advance or when the plot function is called:

V(bsk.network)$size&amp;lt;-degree(bsk.network)/10#here the size of the vertices is specified by the degree of the vertex, so that people supervising more have get proportionally bigger dots. Getting the right scale gets some playing around with the parameters of the scale function (from the &#039;base&#039; package)

# Note that if the same attribute is specified beforehand and inside the function, the former will be overridden.
# And finally the plot itself:
par(mai=c(0,0,1,0))             #this specifies the size of the margins. the default settings leave too much free space on all sides (if no axes are printed)
plot(bsk.network,                #the graph to be plotted
layout=layout.fruchterman.reingold,    # the layout method. see the igraph documentation for details
main=&#039;Organizational network example&#039;,    #specifies the title
vertex.label.dist=0.5,            #puts the name labels slightly off the dots
vertex.frame.color=&#039;blue&#039;,         #the color of the border of the dots 
vertex.label.color=&#039;black&#039;,        #the color of the name labels
vertex.label.font=2,            #the font of the name labels
vertex.label=V(bsk.network)$name,        #specifies the lables of the vertices. in this case the &#039;name&#039; attribute is used
vertex.label.cex=1            #specifies the size of the font of the labels. can also be made to vary
)

# Save and export the plot. The plot can be copied as a metafile to the clipboard, or it can be saved as a pdf or png (and other formats).
# For example, we can save it as a png:
png(filename=&amp;quot;org_network.png&amp;quot;, height=800, width=600) #call the png writer
#run the plot
dev.off() #dont forget to close the device
#And that&#039;s the end for now.&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h1&gt;&lt;span&gt;qGraph 操作&lt;/span&gt;&lt;/h1&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;pre&gt;&lt;code&gt;&amp;gt; Edges &amp;lt;- data.frame(
+     from = rep(1:5,each=5),
+     to = rep(1:5,times=5),
+     thickness = abs(rnorm(25)))
&amp;gt; 
&amp;gt; Edges &amp;lt;- subset(Edges,from!=to)
&amp;gt; library(&amp;quot;qgraph&amp;quot;)
&amp;gt; qgraph(Edges,esize=5,gray=TRUE)
&amp;gt; qgraph(Edges,esize=5,gray=TRUE,minimum=0,cut=.Machine$double.xmin)
&amp;gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;by &lt;span class=&quot;printuser avatarhover&quot;&gt;&lt;a href=&quot;https://www.wikidot.com/user:info/ccckmit&quot;  &gt;&lt;img class=&quot;small&quot; src=&quot;https://www.wikidot.com/avatar.php?userid=296763&amp;amp;amp;size=small&amp;amp;amp;timestamp=1794171486&quot; alt=&quot;ccckmit&quot; style=&quot;background-image:url(https://www.wikidot.com/userkarma.php?u=296763)&quot; /&gt;&lt;/a&gt;&lt;a href=&quot;https://www.wikidot.com/user:info/ccckmit&quot;  &gt;ccckmit&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
</description>
				<pubDate>Fri, 04 Oct 2013 13:19:42 +0000</pubDate>
												<content:encoded>
					<![CDATA[
						 <ol> <li><a href="http://cran.r-project.org/web/packages/igraph/index.html">http://cran.r-project.org/web/packages/igraph/index.html</a> (iGraph) <ul> <li><a href="http://cran.r-project.org/web/packages/igraph/igraph.pdf">http://cran.r-project.org/web/packages/igraph/igraph.pdf</a></li> <li>Practical statistical network analysis (with R and igraph) <ul> <li><a href="http://statmath.wu.ac.at/research/friday/resources_WS0708_SS08/igraph.pdf">http://statmath.wu.ac.at/research/friday/resources_WS0708_SS08/igraph.pdf</a></li> </ul> </li> <li>包含 Alpha-Beta Cut &#8230;.</li> <li>Find distance of route from get.shortest.paths() &#8212; <a href="http://stackoverflow.com/questions/9317923/find-distance-of-route-from-get-shortest-paths">http://stackoverflow.com/questions/9317923/find-distance-of-route-from-get-shortest-paths</a></li> <li>shortest.paths {igraph} &#8212; <a href="http://igraph.sourceforge.net/doc/R/shortest.paths.html">http://igraph.sourceforge.net/doc/R/shortest.paths.html</a></li> <li>初次尝试igraph包 &#8212; <a href="http://xccds1977.blogspot.tw/2012/06/igraph.html">http://xccds1977.blogspot.tw/2012/06/igraph.html</a></li> <li>BFS &#8212; <a href="http://www.inside-r.org/packages/cran/igraph/docs/graph.bfs">http://www.inside-r.org/packages/cran/igraph/docs/graph.bfs</a></li> <li>DFS &#8212; <a href="http://www.biostatistician.cn/thread-47443-1-1.html">http://www.biostatistician.cn/thread-47443-1-1.html</a></li> <li>影片:iGraph tutorial &#8212; <a href="https://www.youtube.com/watch?v=1gDQg5abHsE">https://www.youtube.com/watch?v=1gDQg5abHsE</a></li> <li><a href="http://igraph.sourceforge.net/">http://igraph.sourceforge.net/</a></li> </ul> </li> <li><a href="http://cran.r-project.org/web/packages/qgraph/index.html">http://cran.r-project.org/web/packages/qgraph/index.html</a> (qGraph) <ul> <li><a href="http://cran.r-project.org/web/packages/qgraph/qgraph.pdf">http://cran.r-project.org/web/packages/qgraph/qgraph.pdf</a></li> <li>Draw Network in R (control edge thickness plus non-overlapping edges) <ul> <li><a href="http://stackoverflow.com/questions/7521381/draw-network-in-r-control-edge-thickness-plus-non-overlapping-edges">http://stackoverflow.com/questions/7521381/draw-network-in-r-control-edge-thickness-plus-non-overlapping-edges</a></li> </ul> </li> </ul> </li> <li>gRaphical Models in R &#8212; <a href="http://cran.r-project.org/web/views/gR.html">http://cran.r-project.org/web/views/gR.html</a></li> </ol> <h1><span>igraph 操作</span></h1> <p>必須先用 install.packages(&quot;igraph&quot;) 安裝 igraph 套件，然後再用 library(&quot;igraph&quot;) 引入套件。</p> <ul> <li><a href="http://statmath.wu.ac.at/research/friday/resources_WS0708_SS08/igraph.pdf">http://statmath.wu.ac.at/research/friday/resources_WS0708_SS08/igraph.pdf</a> (讚！)</li> </ul> <div class="code"> <pre><code>g &lt;- graph( c(0,1, 0,2, 1,2, 2,4), n=5 ) # 失敗.... 由於 igraph 改從 1 開始了，所以不能從 0 開始 .... g &lt;- graph( c(1,2, 1,3, 2,3, 3,5), n=5 ) g IGRAPH D--- 5 4 -- plot(g)</code></pre></div> <p>問題：<a href="http://stackoverflow.com/questions/7521381/draw-network-in-r-control-edge-thickness-plus-non-overlapping-edges">http://stackoverflow.com/questions/7521381/draw-network-in-r-control-edge-thickness-plus-non-overlapping-edges</a></p> <blockquote> <p>I'm not sure why but the bit which has the code g &lt;- graph.edgelist(as.matrix(Edges[,-3]-1)) produces an error like Error in graph(t(el), directed = directed) : At structure_generators.c:84 : Invalid (negative) vertex id, Invalid vertex id any idea what the problem is? – h.l.m Oct 3 '12 at 1:23</p> </blockquote> <p>解答：</p> <blockquote> <p>This is because since this answer igraph changed node numbering starting from 1 now where it was 0. It works if you remove the -1. Edited the answer as well. – Sacha Epskamp Oct 3 '12 at 6:06</p> </blockquote> <ul> <li>Graph theory — analysis and visualization &#8212; <a href="http://stats.stackexchange.com/questions/6155/graph-theory-analysis-and-visualization">http://stats.stackexchange.com/questions/6155/graph-theory-analysis-and-visualization</a></li> </ul> <div class="code"> <pre><code>adj.mat &lt;- matrix(sample(c(0,1), 9, replace=TRUE), nr=3) g &lt;- graph.adjacency(adj.mat) plot(g)</code></pre></div> <ul> <li>数据科学与R语言:初次尝试igraph包 &#8212; <a href="http://xccds1977.blogspot.tw/2012/06/igraph.html">http://xccds1977.blogspot.tw/2012/06/igraph.html</a></li> </ul> <div class="code"> <pre><code># 也可以画出一些特殊结构的图形，例如下面的星形图 g2 &lt;- graph.star(10, mode = &quot;in&quot;) plot(g2,layout=layout.fruchterman.reingold(g2)) # 当然也能从文件创建图形 # 首先读入数据，整理后用graph.data.frame函数创建图形对象 traits &lt;- read.csv('http://igraph.sourceforge.net/igraphbook/traits.csv', head=FALSE) names(traits) &lt;- c('name','age','gender') traits[,1] &lt;- sapply(strsplit(as.character(traits[,1]),' '),'[',1) relation &lt;- read.csv('http://igraph.sourceforge.net/igraphbook/relations.csv', head=FALSE) names(relation) &lt;- c('from','to','sameroom','friendship','advice') g4 &lt;- graph.data.frame(relation,vertices=traits) plot(g4,layout=layout.kamada.kawai,vertex.shape='rectangle',vertex.label=V(g4)$name,vertex.size=20,asp=F)</code></pre></div> <ul> <li><a href="http://www.r-bloggers.com/network-visualization-in-r-with-the-igraph-package/">http://www.r-bloggers.com/network-visualization-in-r-with-the-igraph-package/</a></li> </ul> <div class="code"> <pre><code># Data format. The data is in 'edges' format meaning that each row records a relationship (edge) between two people (vertices). # Additional attributes can be included. Here is an example: # Supervisor Examiner Grade Spec(ialization) # AA BD 6 X # BD CA 8 Y # AA DE 7 Y # ... ... ... ... # In this anonymized example, we have data on co-supervision with additional information about grades and specialization. # It is also possible to have the data in a matrix form (see the igraph documentation for details) # Load the data. The data needs to be loaded as a table first: bsk&lt;-read.table(&quot;http://www.dimiter.eu/Data_files/edgesdata3.txt&quot;, sep='\t', dec=',', header=T)#specify the path, separator(tab, comma, ...), decimal point symbol, etc. # Transform the table into the required graph format: bsk.network&lt;-graph.data.frame(bsk, directed=F) #the 'directed' attribute specifies whether the edges are directed # or equivelent irrespective of the position (1st vs 2nd column). For directed graphs use 'directed=T' # Inspect the data: V(bsk.network) #prints the list of vertices (people) E(bsk.network) #prints the list of edges (relationships) degree(bsk.network) #print the number of edges per vertex (relationships per people) # First try. We can plot the graph right away but the results will usually be unsatisfactory: plot(bsk.network)</code></pre></div> <p>範例 2</p> <div class="code"> <pre><code>#Subset the data. If we want to exclude people who are in the network only tangentially (participate in one or two relationships only) # we can exclude the by subsetting the graph on the basis of the 'degree': bad.vs&lt;-V(bsk.network)[degree(bsk.network)&lt;3] #identify those vertices part of less than three edges bsk.network&lt;-delete.vertices(bsk.network, bad.vs) #exclude them from the graph # Plot the data.Some details about the graph can be specified in advance. # For example we can separate some vertices (people) by color: V(bsk.network)$color&lt;-ifelse(V(bsk.network)$name=='CA', 'blue', 'red') #useful for highlighting certain people. Works by matching the name attribute of the vertex to the one specified in the 'ifelse' expression # We can also color the connecting edges differently depending on the 'grade': E(bsk.network)$color&lt;-ifelse(E(bsk.network)$grade==9, &quot;red&quot;, &quot;grey&quot;) # or depending on the different specialization ('spec'): E(bsk.network)$color&lt;-ifelse(E(bsk.network)$spec=='X', &quot;red&quot;, ifelse(E(bsk.network)$spec=='Y', &quot;blue&quot;, &quot;grey&quot;)) # Note: the example uses nested ifelse expressions which is in general a bad idea but does the job in this case # Additional attributes like size can be further specified in an analogous manner, either in advance or when the plot function is called: V(bsk.network)$size&lt;-degree(bsk.network)/10#here the size of the vertices is specified by the degree of the vertex, so that people supervising more have get proportionally bigger dots. Getting the right scale gets some playing around with the parameters of the scale function (from the 'base' package) # Note that if the same attribute is specified beforehand and inside the function, the former will be overridden. # And finally the plot itself: par(mai=c(0,0,1,0)) #this specifies the size of the margins. the default settings leave too much free space on all sides (if no axes are printed) plot(bsk.network, #the graph to be plotted layout=layout.fruchterman.reingold, # the layout method. see the igraph documentation for details main='Organizational network example', #specifies the title vertex.label.dist=0.5, #puts the name labels slightly off the dots vertex.frame.color='blue', #the color of the border of the dots vertex.label.color='black', #the color of the name labels vertex.label.font=2, #the font of the name labels vertex.label=V(bsk.network)$name, #specifies the lables of the vertices. in this case the 'name' attribute is used vertex.label.cex=1 #specifies the size of the font of the labels. can also be made to vary ) # Save and export the plot. The plot can be copied as a metafile to the clipboard, or it can be saved as a pdf or png (and other formats). # For example, we can save it as a png: png(filename=&quot;org_network.png&quot;, height=800, width=600) #call the png writer #run the plot dev.off() #dont forget to close the device #And that's the end for now.</code></pre></div> <h1><span>qGraph 操作</span></h1> <div class="code"> <pre><code>&gt; Edges &lt;- data.frame( + from = rep(1:5,each=5), + to = rep(1:5,times=5), + thickness = abs(rnorm(25))) &gt; &gt; Edges &lt;- subset(Edges,from!=to) &gt; library(&quot;qgraph&quot;) &gt; qgraph(Edges,esize=5,gray=TRUE) &gt; qgraph(Edges,esize=5,gray=TRUE,minimum=0,cut=.Machine$double.xmin) &gt;</code></pre></div> <p>by <span class="printuser avatarhover"><a href="https://www.wikidot.com/user:info/ccckmit" ><img class="small" src="https://www.wikidot.com/avatar.php?userid=296763&amp;amp;size=small&amp;amp;timestamp=1794171486" alt="ccckmit" style="background-image:url(https://www.wikidot.com/userkarma.php?u=296763)" /></a><a href="https://www.wikidot.com/user:info/ccckmit" >ccckmit</a></span></p> 
				 	]]>
				</content:encoded>							</item>
				</channel>
</rss>