<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-5524550387096090472</id><updated>2012-02-16T03:35:43.355-08:00</updated><category term='Office'/><category term='TFS'/><category term='Statistics'/><category term='Excel'/><title type='text'>Stanley's .NET Blog</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://standotnet.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5524550387096090472/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://standotnet.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Stanley</name><uri>http://www.blogger.com/profile/02992383483349823030</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>5</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-5524550387096090472.post-7841874578369964112</id><published>2009-07-13T21:12:00.001-07:00</published><updated>2009-07-13T21:12:57.977-07:00</updated><title type='text'>Full-text Search on PDFs on Windows Sharepoint Services (64-bit)</title><content type='html'>&lt;p&gt;Setup:&lt;/p&gt; &lt;p&gt;Windows Server 2008 64-bit&lt;br&gt;Windows Sharepoint Services 3.0&lt;br&gt;Search Server 2008 Express&lt;/p&gt; &lt;p&gt;Problem:&lt;/p&gt; &lt;p&gt;You’ve search the Web, followed all the instructions, installed Adobe iFilter three times, configured your registry settings, and you still can’t search within PDFs.&amp;nbsp; You can search for PDFs if the query string is included in the filename, but that’s not really that useful; you want to be able to search within the documents.&lt;/p&gt; &lt;p&gt;Solution:&lt;/p&gt; &lt;p&gt;Ensure that you are using the 64-bit (v9) edition of Adobe’s iFilter.&amp;nbsp; After that is installed, you need to change the following registry key:&lt;/p&gt; &lt;p&gt;&lt;strong&gt;&lt;u&gt;KEY:&lt;/u&gt;&lt;/strong&gt; HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\12.0\Search\Setup\ContentIndexCommon\Filters\Extension\.pdf&lt;/p&gt; &lt;p&gt;&lt;strong&gt;&lt;u&gt;VALUE:&lt;/u&gt;&lt;/strong&gt; {E8978DA6-047F-4E3D-9C78-CDBE46041603}&lt;/p&gt; &lt;p&gt;After you do a full crawl, search should now be enabled per site.&amp;nbsp; To enable it for Search Server, you also need to update the following key to the same value:&lt;/p&gt; &lt;p&gt;&lt;strong&gt;&lt;u&gt;KEY:&lt;/u&gt;&lt;/strong&gt; HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\&lt;strong&gt;Office Server&lt;/strong&gt;\12.0\Search\Setup\ContentIndexCommon\Filters\Extension\.pdf&lt;/p&gt; &lt;p&gt;&lt;strong&gt;&lt;u&gt;VALUE:&lt;/u&gt;&lt;/strong&gt; {E8978DA6-047F-4E3D-9C78-CDBE46041603}&lt;/p&gt; &lt;p&gt;The previous value was 4C904448-74A9-11D0-AF6E-00C04FD8DC02.&lt;/p&gt; &lt;p&gt;Search should now be enabled for all Sharepoint sites.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5524550387096090472-7841874578369964112?l=standotnet.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://standotnet.blogspot.com/feeds/7841874578369964112/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://standotnet.blogspot.com/2009/07/full-text-search-on-pdfs-on-windows.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5524550387096090472/posts/default/7841874578369964112'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5524550387096090472/posts/default/7841874578369964112'/><link rel='alternate' type='text/html' href='http://standotnet.blogspot.com/2009/07/full-text-search-on-pdfs-on-windows.html' title='Full-text Search on PDFs on Windows Sharepoint Services (64-bit)'/><author><name>Stanley</name><uri>http://www.blogger.com/profile/02992383483349823030</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5524550387096090472.post-4903227875317859159</id><published>2009-06-17T19:35:00.001-07:00</published><updated>2009-06-17T19:35:26.343-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='TFS'/><title type='text'>TF30177: Team Project Creation Failed after Fresh Team Foundation Server Install</title><content type='html'>&lt;p&gt;If you’re getting this error after a fresh TFS and Team Explorer install, the first thing you should do is check whether you have Visual Studio 2008 SP1 installed.&amp;nbsp; If so, and you installed Team Explorer after SP1, that’s probably the problem.&amp;nbsp; You need to re-install SP1 to bring the Team Explorer bits up-to-date.&amp;nbsp; And no, it has nothing to do with permissions on the TFSREPORTS user; don’t waste your time.&amp;nbsp; Ignore the error description and explanation given.&amp;nbsp; Re-install Visual Studio 2008 SP1.&amp;nbsp; Restart.&lt;/p&gt; &lt;p&gt;&lt;strong&gt;Error&lt;br&gt;&lt;/strong&gt;TF30004: The New Team Project Wizard encountered an unexpected error while initializing the Microsoft.ProjectCreationWizard.Reporting plug-in.&lt;/p&gt; &lt;p&gt;&lt;strong&gt;Explanation&lt;/strong&gt;&lt;br&gt;TF30171: The Microsoft.ProjectCreationWizard.Reporting plug-in used to create the new team project could not be initialized and returned the following error: TF30224: Failed to retreive projects from the report server. Please check that the SQL Server Reporting Services Web and Windows services are running and you have sufficient privileges for creating a project.&lt;/p&gt; &lt;p&gt;&lt;strong&gt;User Action&lt;/strong&gt;&lt;br&gt;Contact your Team Foundation Server administrator. &amp;lt;— &lt;em&gt;don’t you hate it when that’s you? :)&lt;/em&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5524550387096090472-4903227875317859159?l=standotnet.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://standotnet.blogspot.com/feeds/4903227875317859159/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://standotnet.blogspot.com/2009/06/tf30177-team-project-creation-failed.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5524550387096090472/posts/default/4903227875317859159'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5524550387096090472/posts/default/4903227875317859159'/><link rel='alternate' type='text/html' href='http://standotnet.blogspot.com/2009/06/tf30177-team-project-creation-failed.html' title='TF30177: Team Project Creation Failed after Fresh Team Foundation Server Install'/><author><name>Stanley</name><uri>http://www.blogger.com/profile/02992383483349823030</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5524550387096090472.post-6499201182189833245</id><published>2009-06-15T21:12:00.001-07:00</published><updated>2009-06-15T21:12:13.024-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='TFS'/><title type='text'>Installing Visual Studio 2008 Team Foundation Server with SQL Server 2008</title><content type='html'>&lt;p&gt;Out of the box, you cannot install Team Foundation Server 2008 with SQL Server 2008.&amp;nbsp; You’ll get errors telling you that you’re using an incompatible version of SQL Server or that full text search isn’t installed or running.&amp;nbsp; So after re-installing different flavors of SQL Server 15 times, building a Windows Server 2008 image from scratch, re-installing SQL Server another 15 times on the new image, and 5 cups of coffee later, you might just end up contemplating a career change.&amp;nbsp; Or, you could just read &lt;a href="http://blogs.msdn.com/aabdou/archive/2008/05/13/team-foundation-server-sp1-beta-now-available.aspx"&gt;this&lt;/a&gt; and get on with your life.&lt;/p&gt; &lt;p&gt;In a nutshell, you need TFS SP1 to work with SQL 2008.&amp;nbsp; And you need TFS to install TFS SP1.&amp;nbsp; :)&amp;nbsp; The solution is in &lt;a href="http://blogs.msdn.com/aabdou/archive/2008/05/13/team-foundation-server-sp1-beta-now-available.aspx"&gt;this blog entry&lt;/a&gt; and requires an integrated install:&lt;/p&gt; &lt;p&gt;msiexec /a AT\vs_setup.msi /p SP1\TFS90sp1-KB949786.msp TARGETDIR="C:\Documents and Settings\MyUser\Desktop\ATSP1"&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5524550387096090472-6499201182189833245?l=standotnet.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://standotnet.blogspot.com/feeds/6499201182189833245/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://standotnet.blogspot.com/2009/06/installing-visual-studio-2008-team.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5524550387096090472/posts/default/6499201182189833245'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5524550387096090472/posts/default/6499201182189833245'/><link rel='alternate' type='text/html' href='http://standotnet.blogspot.com/2009/06/installing-visual-studio-2008-team.html' title='Installing Visual Studio 2008 Team Foundation Server with SQL Server 2008'/><author><name>Stanley</name><uri>http://www.blogger.com/profile/02992383483349823030</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5524550387096090472.post-139234756023173143</id><published>2009-06-07T03:57:00.001-07:00</published><updated>2009-06-14T20:59:52.839-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Excel'/><category scheme='http://www.blogger.com/atom/ns#' term='Statistics'/><category scheme='http://www.blogger.com/atom/ns#' term='Office'/><title type='text'>Multiple Regression Analysis Leveraging Excel in C#</title><content type='html'>&lt;p&gt;&lt;a href="http://en.wikipedia.org/wiki/Linear_regression"&gt;Linear Regression&lt;/a&gt; via Wikipedia:&lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;In statistics, &lt;b&gt;linear regression&lt;/b&gt; is used for two things;&lt;/p&gt; &lt;dl&gt; &lt;dd&gt; &lt;ul&gt; &lt;li&gt;to construct a simple formula that will predict a value or values for a variable given the value of another variable.  &lt;li&gt;to test whether and how a given variable is related to another variable or variables. &lt;/li&gt;&lt;/ul&gt;&lt;/dd&gt;&lt;/dl&gt; &lt;p&gt;Linear regression is a form of &lt;a href="http://en.wikipedia.org/wiki/Regression_analysis"&gt;regression analysis&lt;/a&gt; in which the relationship between one or more &lt;a href="http://en.wikipedia.org/wiki/Independent_variable"&gt;independent variables&lt;/a&gt; and another variable, called the dependent variable, is modelled by a &lt;a href="http://en.wikipedia.org/wiki/Least_squares"&gt;least squares&lt;/a&gt; function, called a linear regression equation. This function is a &lt;a href="http://en.wikipedia.org/wiki/Linear_combination"&gt;linear combination&lt;/a&gt; of one or more model parameters, called regression coefficients. A linear regression equation with one independent variable represents a straight line when the predicted value (i.e. the dependent variable from the regression equation) is plotted against the independent variable: this is called a &lt;a href="http://en.wikipedia.org/wiki/Simple_linear_regression"&gt;simple linear regression&lt;/a&gt;. However, note that "linear" does not refer to this straight line, but rather to the way in which the regression coefficients occur in the regression equation. The results are subject to statistical analysis.&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;In other words, if you had a hypothesis that a particular variable (denoted by y) was linearly related to one or more other variables (denoted by x&lt;sub&gt;i&lt;/sub&gt;), you could use linear regression to test your hypothesis.&amp;nbsp; For example, I could test whether property prices in Singapore (my y or dependent variable) is dependent on GDP (my x or independent variable).&amp;nbsp; Furthermore, I can use “multiple” regression analysis to test the relationship between a dependent variable and &lt;em&gt;multiple &lt;/em&gt;independent variables.&amp;nbsp; Perhaps Singapore property prices, for instance, are a function of both GDP and interest rates.&amp;nbsp; In this particular example, I have two independent variables that taken together may affect my dependent variable.&amp;nbsp; I’ll leave it at that for now as I want to jump into code, but there’s a lot more information regarding linear regression &lt;a href="http://www.bing.com/search?q=linear+regression"&gt;scattered across the Web&lt;/a&gt;.&lt;/p&gt; &lt;p&gt;Fortunately for many of us, Excel has a built-in function called &lt;a href="http://support.microsoft.com/kb/828533"&gt;LINEST&lt;/a&gt; that does all the hard work for us.&amp;nbsp; The LINEST function takes a set of known y and x points and calculates an equation for the best-fit line given the data using the least squares method.&amp;nbsp;&amp;nbsp; Check out &lt;a href="http://office.microsoft.com/en-us/excel/HP052091551033.aspx"&gt;this article&lt;/a&gt; for a good example on using Excel to do this.&amp;nbsp; The results of this function show us the relationship between the dependent and one or more independent variables.&amp;nbsp; Interpreting the data, of course, is really a whole new topic and outside the scope of this blog post.&lt;/p&gt; &lt;p&gt;Okay, so how can we leverage this built-in functionality in Excel in our own .NET applications?&amp;nbsp; It’s actually quite simple:&lt;/p&gt; &lt;ol&gt; &lt;li&gt;Add a reference the Excel PIA.  &lt;li&gt;Create an instance of the IExcel.Application interface.  &lt;li&gt;Declare a WorksheetFunction variable reference the Excel application’s WorksheetFunction property.  &lt;li&gt;Prepare the parameters for the LINEST function.  &lt;li&gt;Use the Workbook functions class to call the LINEST function.  &lt;li&gt;Parse the results. &lt;/li&gt;&lt;/ol&gt; &lt;p&gt;To add a reference to the Excel PIA, right-click on the References folder in your project, select Add Reference, and in the .NET tab select Microsoft.Office.Interop.Excel.&amp;nbsp; For my particular case, I used the v12.0.0.0 version as I had Office 2007 installed.&amp;nbsp; Once you hit OK, you should see the assembly appear in your References folder.&lt;/p&gt; &lt;p&gt;Next, we declare an instance of the IExcel.Application interface.&amp;nbsp; This gives us a reference to an Excel instance.&amp;nbsp; We then can use the WorksheetFunction property to gain access to Excel’s functions such as LINEST.&amp;nbsp; We also need to declare a “missing” variable as we need to call the LINEST function with a missing parameter since the third parameter is optional – i.e. in Excel, we may use &lt;em&gt;=LINEST(rangeY, rangeY, , true)&lt;/em&gt;.&amp;nbsp; Here, I’ve declared them as member variables:&lt;/p&gt; &lt;div id="codeSnippetWrapper" style="border-right: silver 1px solid; padding-right: 4px; border-top: silver 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: silver 1px solid; width: 97.5%; cursor: text; direction: ltr; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: silver 1px solid; font-family: 'Courier New', courier, monospace; background-color: #f4f4f4; text-align: left"&gt; &lt;div id="codeSnippet" style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span style="color: #0000ff"&gt;private&lt;/span&gt; IExcel.Application xl = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; IExcel.Application();&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span style="color: #0000ff"&gt;private&lt;/span&gt; &lt;span style="color: #0000ff"&gt;object&lt;/span&gt; missing = System.Type.Missing;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;You can then get a reference to the WorksheetFunction interface by using the Worksheet Function property:&lt;/p&gt;&lt;br /&gt;&lt;div id="codeSnippetWrapper" style="border-right: silver 1px solid; padding-right: 4px; border-top: silver 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: silver 1px solid; width: 97.5%; cursor: text; direction: ltr; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: silver 1px solid; font-family: 'Courier New', courier, monospace; background-color: #f4f4f4; text-align: left"&gt;&lt;br /&gt;&lt;div id="codeSnippet" style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;IExcel.WorksheetFunction wsf = xl.WorksheetFunction;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;And you’re set.&amp;nbsp; To call the LINEST function, simply call xl.LinEst().&amp;nbsp; The LinEst function takes 4 arguments, just like in Excel.&amp;nbsp; For instance:&lt;/p&gt;&lt;br /&gt;&lt;div id="codeSnippetWrapper" style="border-right: silver 1px solid; padding-right: 4px; border-top: silver 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: silver 1px solid; width: 97.5%; cursor: text; direction: ltr; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: silver 1px solid; font-family: 'Courier New', courier, monospace; background-color: #f4f4f4; text-align: left"&gt;&lt;br /&gt;&lt;div id="codeSnippet" style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span style="color: #0000ff"&gt;object&lt;/span&gt;[,] result = (&lt;span style="color: #0000ff"&gt;object&lt;/span&gt;[,])wsf.LinEst(yDataPoints.ToArray(), xAll, missing, &lt;span style="color: #0000ff"&gt;true&lt;/span&gt;);&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;For the first two parameters, you need to pass the y and x data sets as double arrays.&amp;nbsp; In my example, yDataPoints is of type List&amp;lt;double&amp;gt; and I call ToArray() to convert it to a double[] array.&amp;nbsp; I could pass another double[] array for the x variable data set, but in my in the case above, xAll represents a multi-dimensioned array to contain data points for multiple x variables.&amp;nbsp; In other words, if I’m regressing y against more than one x variable, as in a multiple regression analysis, I need to pass the data set of x variables as a multi-dimensioned array.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;In my particular case, I had a List of a List of doubles.&amp;nbsp; Each List&amp;lt;double&amp;gt; represented a single data set for a particular x variable.&lt;/p&gt;&lt;br /&gt;&lt;div id="codeSnippetWrapper" style="border-right: silver 1px solid; padding-right: 4px; border-top: silver 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: silver 1px solid; width: 97.5%; cursor: text; direction: ltr; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: silver 1px solid; font-family: 'Courier New', courier, monospace; background-color: #f4f4f4; text-align: left"&gt;&lt;br /&gt;&lt;div id="codeSnippet" style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;List&amp;lt;List&amp;lt;&lt;span style="color: #0000ff"&gt;double&lt;/span&gt;&amp;gt;&amp;gt; xDataPoints = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; List&amp;lt;List&amp;lt;&lt;span style="color: #0000ff"&gt;double&lt;/span&gt;&amp;gt;&amp;gt;();&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;To convert this into a multi-dimensioned array useful for the LinEst function, one could use the following code:&lt;/p&gt;&lt;br /&gt;&lt;div id="codeSnippetWrapper" style="border-right: silver 1px solid; padding-right: 4px; border-top: silver 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: silver 1px solid; width: 97.5%; cursor: text; direction: ltr; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: silver 1px solid; font-family: 'Courier New', courier, monospace; background-color: #f4f4f4; text-align: left"&gt;&lt;br /&gt;&lt;div id="codeSnippet" style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span style="color: #0000ff"&gt;double&lt;/span&gt;[,] xAll = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; &lt;span style="color: #0000ff"&gt;double&lt;/span&gt;[xDataPoints.Count, xDataPoints[0].Count];&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span style="color: #0000ff"&gt;for&lt;/span&gt; (&lt;span style="color: #0000ff"&gt;int&lt;/span&gt; i = 0; i &amp;lt; xDataPoints.Count; i++)&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;{&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;    &lt;span style="color: #0000ff"&gt;for&lt;/span&gt; (&lt;span style="color: #0000ff"&gt;int&lt;/span&gt; j = 0; j &amp;lt; xDataPoints[0].Count; j++)&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;    {&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;        xAll[i, j] = xDataPoints[i][j];&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;    }&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;}&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;Now that we have our y data points and x data points ready, you can call the LinEst function as done above.&lt;/p&gt;&lt;br /&gt;&lt;div id="codeSnippetWrapper" style="border-right: silver 1px solid; padding-right: 4px; border-top: silver 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: silver 1px solid; width: 97.5%; cursor: text; direction: ltr; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: silver 1px solid; font-family: 'Courier New', courier, monospace; background-color: #f4f4f4; text-align: left"&gt;&lt;br /&gt;&lt;div id="codeSnippet" style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span style="color: #0000ff"&gt;object&lt;/span&gt;[,] result = (&lt;span style="color: #0000ff"&gt;object&lt;/span&gt;[,])wsf.LinEst(yDataPoints.ToArray(), xAll, missing, &lt;span style="color: #0000ff"&gt;true&lt;/span&gt;);&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;The LinEst function returns a multi-dimensioned array that matches the format returned in Excel.&amp;nbsp; Here’s a screenshot of what the results would look like from the &lt;a href="http://office.microsoft.com/en-us/excel/HP052091551033.aspx"&gt;Microsoft article&lt;/a&gt; linked above.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;img src="http://office.microsoft.com/global/images/default.aspx?AssetID=ZA060512011033"&gt; &lt;/p&gt;&lt;br /&gt;&lt;p&gt;One important note for C# developers is that the resulting array starts from index 1 and not 0.&amp;nbsp; Hence, to get the y-intercept and r-squared values, for instance, you could use:&lt;/p&gt;&lt;br /&gt;&lt;div id="codeSnippetWrapper" style="border-right: silver 1px solid; padding-right: 4px; border-top: silver 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: silver 1px solid; width: 97.5%; cursor: text; direction: ltr; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: silver 1px solid; font-family: 'Courier New', courier, monospace; background-color: #f4f4f4; text-align: left"&gt;&lt;br /&gt;&lt;div id="codeSnippet" style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span style="color: #0000ff"&gt;double&lt;/span&gt; yIntercept = (&lt;span style="color: #0000ff"&gt;double&lt;/span&gt;)result[1, numSecurities];&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span style="color: #0000ff"&gt;double&lt;/span&gt; rSquared = (&lt;span style="color: #0000ff"&gt;double&lt;/span&gt;)result[3, 1];&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;Where numSecurities is the total number of variables involved (y and x variables).&amp;nbsp; To get the beta co-efficients of each x variable, you would parse the first row in backwards order (as in the image above m&lt;sub&gt;n&lt;/sub&gt; is in first column and m&lt;sub&gt;1&lt;/sub&gt; is in the second to last column).&lt;/p&gt;&lt;br /&gt;&lt;p&gt;Simple, eh?&amp;nbsp; By leveraging Excel, multiple regression analysis in your C# apps couldn’t be easier…&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5524550387096090472-139234756023173143?l=standotnet.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://standotnet.blogspot.com/feeds/139234756023173143/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://standotnet.blogspot.com/2009/06/multiple-regression-analysis-leveraging.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5524550387096090472/posts/default/139234756023173143'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5524550387096090472/posts/default/139234756023173143'/><link rel='alternate' type='text/html' href='http://standotnet.blogspot.com/2009/06/multiple-regression-analysis-leveraging.html' title='Multiple Regression Analysis Leveraging Excel in C#'/><author><name>Stanley</name><uri>http://www.blogger.com/profile/02992383483349823030</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5524550387096090472.post-8129722005800165473</id><published>2009-06-07T02:20:00.001-07:00</published><updated>2009-06-07T02:20:13.304-07:00</updated><title type='text'>Hello World</title><content type='html'>&lt;p&gt;Welcome to my blog where I will post about interesting tidbits that I discover about writing code for the .NET framework.&amp;#160; While this blog will have no particular theme, I would say that the posts are probably most useful for the practical programmer building Windows based applications.&amp;#160; C# is my language of choice and Singapore is my home.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5524550387096090472-8129722005800165473?l=standotnet.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://standotnet.blogspot.com/feeds/8129722005800165473/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://standotnet.blogspot.com/2009/06/hello-world.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5524550387096090472/posts/default/8129722005800165473'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5524550387096090472/posts/default/8129722005800165473'/><link rel='alternate' type='text/html' href='http://standotnet.blogspot.com/2009/06/hello-world.html' title='Hello World'/><author><name>Stanley</name><uri>http://www.blogger.com/profile/02992383483349823030</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
