Welcome to the Genome Toolbox! I am glad you navigated to the blog and hope you find the contents useful and insightful for your genomic needs. If you find any of the entries particularly helpful, be sure to click the +1 button on the bottom of the post and share with your colleagues. Your input is encouraged, so if you have comments or are aware of more efficient tools not included in a post, I would love to hear from you. Enjoy your time browsing through the Toolbox.
Showing posts with label Excel. Show all posts
Showing posts with label Excel. Show all posts

Monday, June 2, 2014

Wald Test Statistic

Wald tests are simple statistical tests for determining if an estimated parameter value is significantly different from zero.  The test can take two forms.  The first is where the estimate (minus zero) is divided by its standard error.  The resulting statistic is a z-score that follows a standard normal distribution from which a p-value can be calculated.  The second form is where the difference in the parameter estimate and zero is squared and divided by the variance of the parameter.  This produces a statistic that follows a chi-squared distribution with one degree of freedom.  The two forms of the Wald test statistic are below.

(1)
W=(β^β0)seˆ(β^)N(0,1)
(2)
W2=(β^β0)2Varˆ(β^)χ21

Programs like R, Microsoft Excel, or even online widgets can be used to calculate p-values from a z-score or chi-squared statistic.  Here's how to do it.

R:
P-value=2*(1-pnorm(W))
P-value=1-pchisq(W2,1)

MS Excel:
P-value=2*(1-(NORMDIST(W,0,1,TRUE)))
P-value=CHIDIST(W2,1)

Thursday, January 23, 2014

Formatting Excel Cells with Zero Filling

While Microsoft Excel could use some improvements for data management and analysis, it remains my program of choice for putting together summary tables, particularly the descriptive statistics of most Table 1's.  I'm pretty particular with formatting and wanted to create a Table 1 with column percentages that all lined up nicely.  To do this I needed to zero fill numbers both before and after the decimal point so that each number, when formatted, took up the same amount of space in the column.  I the past I would do this by pasting the table as text (without formulas) and then manually filling in zeros.  This was tedious, especially when having to redo tables after sample numbers changed.

Today I found out there is a way to have Excel automatically include these zeros.  You can do this by creating a custom number format.  Here's how to do so.

1). Right click on the cell you want to format and choose Format Cells...
2). Click the Number tab and select Custom in the Category: list.
3). Put in your desired formatting.  You can do this by building off other format types.  In my case, I wanted to have a format so that the numbers 3.5562 and 55 appeared as (03.6) and (55.0), respectively.  To do this the Type: box needed to have the format (00.0).  This will zero fill both before and after the decimal point as well as round all numbers by one decimal place.

As you can imagine, you can customize this to zero fill based on your particular needs or desired format type.  Below is an example Table 1 excerpt to show how the formatting looks.


Wednesday, November 20, 2013

Remove Duplicate Records from Excel Spreadsheet

I stray away from using Microsoft Excel for data management, but sometimes it is necessary to do quick manipulations on a relatively small dataset.  For this purpose, Excel shines.  One task I assumed Excel could do, but never knew exactly how to do it was filter out duplicate records from a dataset.  After some Goggling, I found how to do this:

(1) Select the column headers and rows in the worksheet you want to remove duplicate records from.
(2) Go to the Data tab and select Advanced Filter.
(3) For action click the Filter the list, in-place radio button and check the box for Unique records only.
(4) Press OK.

You should now have a filtered worksheet with duplicate rows removed.  This can be copied and pasted to a new worksheet for further manipulation.  Hope this was helpful.  If you have improvements on the method or further questions, please add them in the comments section below.