Health Station

Mohsen Heidari : The Epidemiology student at Shahid Beheshti University of Medical Sciences and Health Services

 
مطالعات مورد شاهدی (Case Control)
نویسنده : محسن حیدری - ساعت ٥:٢٦ ‎ق.ظ روز چهارشنبه ٢٧ آبان ۱۳٩٤
 

بعد از اتمام این جلسه، شرکت کنندگان قادر خواهد بود که

  1. ویژگی­های اصلی یک مطالعه مورد شاهدی و نکات مهم در طراحی آن را توصیف کنند.

  2. اهمیت تعریف دقیق "موردها" و "شاهدها" را درک کنند.

  3. در انتخاب شاهدها به این موضوع توجه کنند که شاهدها بایستی معرف جمعیتی باشند که موردها از آن ایجاد شده­اند تا سوگرایی انتخاب را به حداقل برسانند.

  4. مشکلات موجود در به دست آوردن یک برآورد دقیق از مواجهه در این نوع مطالعه را درک کرده و از روشهای کاهش سوگرایی اطلاعات آگاه باشند.

  5. مزایا و نقایص طراحی­های همسان(Matched) و ناهمسان(Unmatched) را بدانند و اهمیت جمع آوری اطلاعات با مخدوش­کننده های بالقوه را درک کنند.

  6. چگونگی آنالیز داده­های حاصل از مطالعات مورد شاهدی را توصیف کرده و تشخیص دهند که کدام برآورد خطر را می­توان از این مطالعات تخمین زد.

  7. مزایا و نقایص طراحی مطالعه مورد شاهدی را بدانند.     

 


 
 
Analysis of Variance (ANOVA)
نویسنده : محسن حیدری - ساعت ٥:۱٧ ‎ق.ظ روز چهارشنبه ٢٧ آبان ۱۳٩٤
 

Analysis of Variance (ANOVA)

 

I.            Introduction

 

In Regression, the decomposition of the total sum of squares (SST) into the “explained” sum of squares (SSR) and the “unexplained” sum of squares (SSE) took place in the Analysis of Variance or ANOVA table. However, ANOVA also refers to a statistical technique used to test for diffferences between the means for several populations. While the procedure is related to regression, in ANOVA the independent variable(s) are qualitative rather than quantitative. In both regression and ANOVA the dependent variable is quantitative.

 

Example 1: As city manager, one of your responsibilities is purchasing. The city is looking to buy lightbulbs for the city’s streetlights. Aware that some brands’ lightbulbs might outlive other brands’ lightbulbs, you decide to conduct an experiment. Seven lightbulbs each are purchased from four brands (GE, Dot, West, and a generic) and placed in streetlights. The lifetime of each of the 28 lightbulbs is then recorded in the file “Lightbulbs.”

 

In this example, the lifetime of a lightbulb, in thousands of hours, is the quantitative dependent variable of interest. The company marketing the lightbulb, i.e., the brand-name, is the qualitative independent variable. The variable “brand name” has four possible values (or four “levels” in the terminology of ANOVA). The letter “k” will be used for the number of “levels” of the independent variable or “factor”. Here, k = 4 for the four brands being tested. We say, “the factor brand-name has four levels: GE, Dot, West, and generic.”

 

The “populations” referred to in these notes are simply the different levels of the factor. So that, in this example, we are interested in whether the mean lifetimes for the four populations of lightbulbs differ. Since we cannot know with certainty, however, the true mean lifetime of all lightbulbs carrying a certain brand-name, we rely upon statistics to determine if the differences observed between samples drawn from the four brands are statistically significant. (Non-significant differences are those that can plausibly be attributed to chance, i.e., sample-to-sample, variation alone.)

 

II.          The (one-way) ANOVA Model

 

In order to perform tests of statistical significance, a model is assumed. The model used in ANOVA is similar in many respects to the model employed in regression. In fact, You may find it useful in these notes to make analogies between the model and formulas in ANOVA and the the corresponding model and formulas in regression. In the model below, recall that the dependent (or response) variable is quantitative as in regression, but the independent (or factor) variable is now qualitative. We begin with a model in which a single independent variable is used to describe the dependent variable. This One-Way ANOVA is analogous to simple regression. The one-way analysis of variance model is

 

Y = mi + e , where

 

  • Y is the quantitative dependent variable, usually called the response variable in ANOVA
  • mi  is the true mean value of the dependent variable for the ith population, where there are k populations.
  • e is the random error in the response not attributable to the independent variable. As in regression, the error is assumed to be normally distributed with constant variance.

III.        Terminolgy

 

Although regression and analysis of variance are closely related, historically they developed separately. As a result they each adopted their own terminolgy. Unfortunately, this often means that similar things are  referred to differently in the two procedures. Below is a list of some of the names used in ANOVA and what they refer to.

 

  • Response: the dependent variable
  • Factor(s): the independent variable(s)
  • Levels: the possible values of a factor
  • Treatments: another name for levels in one-way ANOVA, but there will be a distinction between levels and treatments when we discuss two-way ANOVA later. The term treatments derives from medicine, where the different treatments were the drugs or procedures being tested on patients, and agriculture, where the treatments were the different fertilizers or pesticides being tested on crops.
  • The m i  are called the “factor-level means” or the “treatment means” in one-way ANOVA and represent the true mean value of the response variable for the ith population of treatments.

 

Example 1 (continued): For the lightbulb problem,

 

  • the response is the lifetime of a particular lightbulb (in thousands of hours)
  • the factor is the brand-name
  • there are four levels or treatments: GE, Dot, West, and generic
  • mGE is the mean lifetime of all GE bulbs, mDot is the mean lifetime of all Dot bulbs, etc.

 

IV.        Hypothesis Test

 

As usual, we rely on a hypothesis test to determine if the sample means for the k samples drawn (one from each population) differ enough for the difference to be statistically significant (more than would likely occur due to random chance alone).

 

Example 1 (continued): It is important that the student understand why probability is important here. It is not unusual for one manufacturer to source a product marketed under many brand-names. For example, there are only a handfull of companies manufacturing denim jeans, but there are dozens of brand-name jeans available to the consumer. Similarly, not all lightbulbs are manufactured by the companies marketing them. It is not inconceivable, therefore, that all four brands of lightbulbs being tested by the city come off of the same assembly line. Yet, when tested, they would still yield four different sample means simply because of sample-to-sample variation. As city manager, you might be more than a little embarassed to discover that the brand that you’ve touted as superior to all others is actually different in name only! Lawsuits have been lost for far less.

 

Hypotheses:

 

  • H0: m 1 = m 2 = ... = mk , i.e., all population means are equal. This is equivalent to saying that the k treatments have no differential effect upon the value of the response.
  • HA: At least two of the means differ. This says that different treatments produce different values of the response variable, on average.

 

 

Test Statistic:

 

F = , where MSR = the Mean Square for Treatments,

 and MSE = the Mean Square for Error

 

Note: What I'm calling MSR is often called MST in the literature. I've chosen to continue the use of MSR to highlight the similarity between regression and analysis of variance. MSE remains the same for both regression and analysis of variance. Formulas for the mean squares are given later in the notes.

 

Logic:

 

The analysis of variance uses the ratio of two variances, MSR and MSE, to determine whether population means differ; hence the name “analysis of variance.” Recall that one of the assumptions of the model is that the variance s2 is the same for all populations. MSE provides an unbiased estimate of s2 in ANOVA just as it does in regression (see regression notes). If the population means are all equal, which is the null hypothesis, it can be shown that MSR also provides an unbiased estimate of s2 . If all of the population means are equal, therefore, we would expect F to be nearly equal to 1 since MSR and MSE should yield similar estimates of the variance s2 .

 

If some population means differ from others, however, MSR will tend to be bigger than MSE resulting in an F - Ratio substantially larger than 1. Thus we reject H0 for large values of F, just as in regression.

 

V.          The ANOVA Table: Sums of Squares and Degrees of Freedom

 

A.          Introduction

 

At the heart of any analysis of variance is the ANOVA Table. The formulas for the sums of squares in ANOVA are simplified if the k samples are all of the same size nS. In the interests of simplicity, therefore, the following discussion assumes that all k samples contain the same number of observations nS.

 

B.          Notation

 

  • The index i represents the ith population or treatment, where i ranges from 1 to k
  • The index j represents the jth obsevation within a sample, where j ranges from 1 to nS
  • n is the total number of observations from all samples
  • yij is the value of the jth observation in the ith sample
  • is the mean of the ith sample
  •  (read “y double-bar”) is the mean of all n observations, , or the mean of the sample means (hence the “double-bar” in the name),

 

 

C.          Sums of Squares

 

Sum of Squares for Treatments, is the “Between Group” variation, where the k “groups” or populations are represented by their sample means. If the sample means differ substantially then SST will be large.

Sum of Squares for Error, is the “Within Group” variation and represents the random or sample-to-sample variation

Total Sum of Squares, is the total variation in the values of the response variables over all k samples. (Note: SST is the same as in regression)

 

D.          Degrees of Freedom

 

Degrees of freedom for treatments, dfSSR = k-1. Rather than memorizing this formula, just imagine the number of dummy variables  that you would have to create to conduct the equivalent analysis in regression. Since you always leave one possibility out in regression, you would need to create k – 1 dummy variables. Since the resulting regression model would have k – 1 independent variables, SSR (SST here) would have k – 1 degrees of freedom.

 

Degrees of freedom for error, dfSSE = nk.

 

Total degrees of freedom, dfSST = n – 1. This is the same result obtained in regression.

 

Note: The two component degrees of freedom sum to the total degrees of freedom, just as in regression.

 

E.          Mean Squares

 

Mean Square for Treatments,  is equivalent to MSR in regression

Mean Square for Error,   is the same as MSE in regression. As in regression, MSE is an unbiased estimator of the common population variance s2.

 

F.           F – Ratio

 

The statistic used to test the null hypothesis m 1 = m 2 = ... = mk is  . As mentioned earlier, if the null hypothesis is correct then this ratio should be close to one. If some of the sample means differ substantially, however, the ratio will be much larger. Large values of F therefore correspond to strong evidence for rejecting H0. Statgraphics reports a P-value for the test.

 

G.          Summary

 

The ANOVA Table below summarizes some of the information in this section

 

ANOVA Table for One-Way Analysis of Variance

Source

Sum of Squares

Df

Mean Square

F-Ratio

P-Value

Between  groups

SSR

k - 1

MSR = SSR/(k-1)

  F = MSR/MSE

 

Within groups

SSE

n - k

MSE = SSE/(n-k)

 

 

Total (Corr.)

SST

n - 1

 

 

 

 

VI.        Using Statgraphics

 

To perform a one-way analysis of variance in Statgraphics, follow Compare > Analysis of Variance > One-Way ANOVA and enter the response and factor into the dependent variable and factor fields, respectively.

 

Example 1 (continued): For the lightbulb problem, the spreadsheet might look like the one below. Notice that the qualitative factor Brand doesn’t need to be numeric. Statgraphics will treat the factor in ANOVA as qualitative, so there is no need to recode it as a numeric variable. For the same reason there is no need to create dummy variables as in regression.

 

 

 

This leads to the ANOVA Table below. Looking at the P-value for the F-test, we conclude that there is strong evidence that at least two of the mean lifetimes differ.

 

 

 

Once the city manager has detected a difference in mean lifetimes, he/she would naturally wish to determine which brand’s lightbulbs are superior. Statgraphics has a graphical option called a “Means Plot” which graphs 95% confidence intervals for the mean lifetimes of the four brands. If the 95% confidence intervals for two brands don’t overlap then the city manager may conclude, at the 5% level of significance, that the true mean lifetimes for the two brands differ. If, on the other hand, the intervals do overlap the manager cannot draw a statistically significant conlusion at the 5% level of significance. (Remember, it’s quite possible that the two brands’ bulbs come off of the same assembly line, so don’t try to force conclusions that can’t be supported statistically!)

 

Below is the Means Plot. There is clearly evidence, at the 5% level of significance, that the GE bulbs last longer, on average, than bulbs from the other brands. Similarly, there is evidence, at the 5% level, that the West bulbs fail sooner, on average, than bulbs from the other brands. The sample differences between the Dot and generic bulbs, however, may be due to chance alone. (We don’t actually know that Dot and generic bulbs are interchangeable, but the sample doesn’t provide strong enough evidence to discount the possibilty.)

 

 

 

 

 

 

 

 

 

VII.      Two-Way ANOVA

 

When the effects of two qualitative factors upon a quantitative response variable are investigated, the procedure is called two-way ANOVA. Although a model exists for two-way analysis of variance, similar to the multiple regression model, it will not be covered in this class. Neither will we cover the details of the ANOVA Table. Nevertheless, there are some new considerations in two-way ANOVA stemming from the presence of the second factor in the model.

 

Example 2: The EPA (Environmental Protection Agency) tests public bodies of water for the presence of coliform bacteria. Aside from being potentially harmful to people in its own right, this bacteria tend to proliferate in polluted water, making the presence of coliform bacteria a surrogate for polution. Water samples are collected off public beaches, and the number of coliform bacterial per cc is determined. (See the file “Bacteria.”

 

The EPA is interested in determining the factors that affect coliform bacterial formation in a particular county. The county  has beaches adjacent to the ocean, a bay, and a sound. The EPA beleives that the amount of “flushing” a beach gets may affect the ability of polution to accumulate in the waters off the beach. The EPA also believes that the geographical location of the beach may be significant. (There could be several reasons for this: the climate may be different in different parts of the county, or the land-use may vary across the county, etc.)

 

As luck would have it, there is at least one beach for each combination of type (ocean, bay, sound) and location (west, central, east) within the county. Because of this, the EPA decides to sample a beach at each of the 9 possible combinations of type and location and conduct a two-way analysis of variance for coliform bacterial count. Two independent samples are taken at each beach to allow for an estimation of the natural variation in coliform bacterial count (this “repetition” is needed for the computation of MSE, which estimates the sample-to-sample variance in bacterial counts).

 

VIII.    Two-Way ANOVA Using Statgraphics

 

To perform a two-way analysis of variance in Statgraphics, follow Compare > Analysis of Variance > Multifactor ANOVA and enter the response and factors into the dependent variable and factor fields, respectively.

 

Example 2 (continued): Since data from such a study often appears in the form of a two-way table, with one factor as the row variable, the second as the column variable, and the observations as values in the row-by-column cells, it is important to remember that each variable must have its own column in the spreadsheet as in the example below. (This may require that you re-format the original spreadsheet prior to beginning the analysis.)

 

 

 

The default ANOVA Table below has separate rows for the factors Type (called factor A) and Location (called factor B). A test of the significance of each factor is performed and the corresponding p-value displayed. It appears that both the type of beach and its location affect coliform bacterial count.

 

But does the effect of the beach type on bacteria count depend upon its location within the county? If the particular pairings of factor levels are important, the factors are said to “interact.”

 

 

 

Before interpreting the results in the ANOVA table above, we should consider the role that interaction plays. If the effect of beach type on bacteria formation depends on the location of the beach then it is better to investigate the combinations of the levels of the factors type and location for their affect on bacteria. It will come as no surprise to you that there is a hypothesis test for interactions.

 

H0: The factors Type and Location do not interact.

HA: The factors Typ and Location do interact

 

To check for interaction, use the right mouse button and Analysis Options and enter “2” for the Maximum Order Interaction. The resulting output for our example below shows a P-value of  0.3047 for the test for interactions. Thus the evidence for interaction is not particularly strong. The practical effect of discounting interaction is that we are able to return to the previous output (the one without interactions) and interpret the P-values for the factors Type and Location separately. Since the P-values for both factors are significant, we conclude that factors affect bacteria growth.

 

 

 

Having determined that the type of beach and the beach’s location are both significant, we next investigate the nature of the relationship between these factors and bacteria count. Once again we turn to the means plots under Graphical Options. Statgraphics dfaults to a means plot for the factor Type because this was the first factor entered in the Input Dialog Box. To get a means plot for the factor Location, use  Pane Options to select it. The two means plots appear below.

 

   

 

Individually, these means plots are interpreted as in one-way ANOVA. There is evidence, at the 5% level of significance, that the mean bacteria count at ocean beaches is less than for other types, and that the mean count is highest at bay beaches. Similarly, the mean count is lowest in the east and greatest in the west, with all differences being statistically significant at the 5% level of significance. Furthermore, because interactions were judged not-significant, we can add the main effects together and say that the least polluted beaches tend to be located in the east on the ocean, while the most polluted tend to be in the west on bays. We could not have added the separate (or main) effects in this way if there had been significant interact, for in that case the effect upon bacteria count at a particular type of beach (ocean, for example) may be very different for different locations.

 

Example 3: The last two examples are based on a marketing study. A new apple juice product was entering the marketplace. It had three distinct advantages relative to existing apple juices. First, it was not a concentrate and was therefore considered to be of higher “quality” than many similar products. Second, as one of the first juices packaged in cartons, it was cheaper than competing products. Third, partly because of the packaging, it was more convenient. The director of marketing for the company would like to know which advantage should be emphasized in advertisements. The director would also like to know whether local television or newspapers are better for sales.

 

Consequently, six cities with similar demographics are chosen, and a different combination of “Marketing Strategy “ and “Media” is tried in each. The unit sales of apple juice for the ten weeks immediately following the start of the ad campaigns are recorded for each city in the file Apple Juice (two-way). The two-way table below describes the city assignments for the six possible combinations of levels for the two factors. Below the assignment table is the ANOVA Table for interactions.

 

 

Convenience

Quality

Price

Local Television

City 1

City 3

City 5

Newspaper

City 2

City 4

City 6

 

 

 

 

Interactions are not significant to the model (p-value equals 0.9171), a fact which is reinforced by looking at the Interaction Plot under Graphical Options. Note that the two curves are almost parallel, a sign that interactions are not significant.

 

 

 

Removing interactions, we obtain the ANOVA Table below, from which we conclude that the marketing strategy is significant, but the media used probably isn’t. Since only marketing strategy apppears to affect sales, we’ll restrict ourselves to the means plot for the factor Strategy below. Only the difference in mean sales when emphasizing quality versus emphasizing convenience is statistically significant at the 5% level of significance.

 

 

 

 

 

Example 4: This is just the apple juice problem revisited (see file “Apple Juice – Remix”). By a judicious rearrangement of sales figures, I’ve created a marketing study in which interactions are significant. (See the two-way table below for the new assignments.) The comparison of the interaction plots for this example and example 3 should help to clarify the role of interactions in the interpretation of ANOVA output. The small P-value of 0.0474 for the hypothesis test of interactions implies that certain combinations of marketing strategy and media are important to sales.

 

 

Convenience

Quality

Price

Local Television

City 1

City 2

City 3

Newspaper

City 4

City 5

City 6

 

 

 

 

Looking at he interaction plot, notice that emphasizing convenience lead to both the lowest and highest mean sales, depending upon whether local television or newspapers were used. Thus, it wouldn’t make sense to talk about the effect of emphasizing convenience without consideration of the media used, i.e., we should only interpret levels of the two factors taken together (the combinations). Therefore, we will not investigate the means plots for Strategy and Media. From the interaction plot, it appears that the most effective campaign would emphasize convenience in newspapers. The least effective combination is to emphasize convenince on local television. (Note: Since the interaction plot doesn’t display confidence intervals for the six possible combinations, we cannot attach a particular significance level to our conclusions as we could with the means plots.)

 

 

 

 

 


 
 
 



Clock And Date onLoad and onUnload Example

اوقات شرعی

شنبه, شهریور ۴, ۱۳91