Generalized Linear Regression: Categorical Predictors, Dummy Variables, and Fixed Effects
Overview
In the broad linear regression chapter, we are not limited to the study of traditional GLM models, but to the introduction of many linear transformations, which are presented in the broad linear regression chapter.
In particular, the Logit series model using defined variables will be presented separately Logistic returns
The contents of this chapter include:
- Returns model for classification from variables
- The fixed effect returns to the tool variable returns
- Steady return technology
- Wait.
Classification of variables and virtual variables
Classification VariablesValues are of limited type, e.g. gender: male, female. The classification variable cannot be used directly in the regression model, i.e. to use 1 for men, to use 0 for women, and this 1 and 0 can still only be used to distinguish categories. If they are used without processing, the logic and results of the entire model are incorrect.
In programming tools such as R, the type of variable classified is a factor, not a value. When we incorporate the factor variable into the regression model, the R language automatically helps us with the final regression analysis. Now what we're trying to tell you is how he's handling this factor variable internally.
One-hot encoding
One-hot coding is a very natural idea, using a bit to indicate a possible category, and a variable cannot normally belong to more than one category at the same time, so only one bit is 1 and none other means that it is not.
Use one-of-K or one-hot encoding (one-hot encoding). It can take every one of them.$m$The characteristics of the category are converted to$m$Binary Characters
We can get these 01s right into regression models or more sophisticated machine learning models.
Virtual Encoding
The so-called "dummy variables" are actually similar in principle to a single thermal code.
The biggest difference between virtual coding on a single thermal coding is a degree of freedom between selection and reduction of reference classes, each having$m$The characteristics of the category are converted to$m-1$The remaining feature of the classification will be used as a reference, and the other features are meant to be compared with the reference class, and their coefficients are more explanatory.
The effect of the classification variables on regression models is to make comparisons between clusters, and only to act as group comparisons.
For one.$q$Horizontally classified variables that we have to create if the regression model has a cutout entry in betweenept $q-1$And the other items will use this item as a basis for their own meaning because If we add a dummy variable to this regression model with a cut-off, and add a factor horizontally, we can cause a comprehensible linear problem, which leads to a failure to solve.
When the model does not have an amplitude item, set a horizontal number of virtual variables, but it's almost impossible for the model to have an amplitude item.
At this point, we randomly select one volume as the baseline, and other virtual variables can be seen as the result of those variables when they are based on this quantity.
Different virtual variables affect all regression factors and cut-off items simultaneously.
Effect Encoding
The effect coding is also the way to select the reference class.$-1$
At this point, the amplitude item represents the overall average, the coefficients for each variable reflect the difference before his or her overall average, and in the effect coding, no separate feature is presented as a reference category, and we need to calculate it separately, which is the sum of the opposite of the coefficients for all other categories.
Because of the computational advantages of the large-scale coefficient matrix, we do not use the effects code very often.
Order dumb variable
We also have a sequenced mute variable, which preserves the sequence of the data while coding, without any difference between the idea and the one-heat code.
| Features | Encoded |
|---|---|
| bad | $(1,0,0)$ |
| normal | $(1,1,0)$ |
| good | $(1,1,1)$ |
We've got a way to code the target rate for more fine particles. We'll learn later.
Fixed Effect Return
The technology of multiple returns is very powerful, but the issue of missing variables has been a very important issue of return technology, and he will significantly influence our estimates of effectiveness.
This chapter presents the technology for re-entry of panel data, which, by the type of panel data, allows us to control those variables that are not actually observed and to explain the omission effect.
If the missing variable does not change over time (i.e. the fixed amount of the category) or if the missing variable changes over time only, we have panel data that can be used to return;
Panel Data
Panel data returns, requiring both cross-section data and time series data For example, government policy data sets on the number of traffic accidents and alcohol taxes caused by drunk driving in several states of the United States over the years. It's also a very common type of data. Descriptive statistics and visualization Section on Measurement
When describing cross-section data, we use subscripts to represent individuals, for example.$Y_i$is the number of the variable Y$i$ An individual. In the description of panel data, we need additional symbols to track both individuals and periods. For this, we use two subscripts instead of single subscripts: first of all, we need to get to the bottom of this.$i$ It's an individual; second,$t$ Indicates the period of observation. Therefore...$Y_it$Organisation$n$ No. of individuals$i$An individual.$T$No. of the period$t$Variables observed over time$Y$value.
Other terms on panel data describe the absence of observations. Balanced Panel refers to the availability of all observations; that is, variables are observed for each individual and for every period. If data is missing for at least one period or at least one individual, the panel is called the non-balanced panel
Two-time panel returns
By comparing the two-time panel data, we can deal with some of the missing variables involved in the regression and fix the effects of non-observable variables that change between individuals and over time.
You!$Z_i$No. No.$i$A unique individual that doesn't vary over time from a non-observable variable, we can build a regression equation to $$\widehat{FatalityRate_{it}}=\beta_0+\beta_1BeerTax_i+\beta_2Z_i+u_i$$ Because we mentioned the effects.$Z_i$It doesn't change over time, and we have two stages of panel data, so we're not. $$FR_{i1988}-FR_{i1982}=\beta_1(BeerTax_{i1988}-BeerTax_{i1982})+u_{i1988}-u_{i1982}$$
Discrepancies are set in such a way that the effects of non-observable variables that do not change over time are eliminated, when estimates of the regression analysis of the equations that follow the differentials allow for the use of conventional estimation methods. It can also be analysed in a way that is directly based on conventional models.
This “pre-post” analysis can be used when data are observed in two different years. However, our data sets contain observations for seven different years, and it would be unwise to discard these additional data that may be useful. This leads to a return of the fixed effects back there.
Fixed-effect regression model
The return of fixed effects is a method of control panel data that changes the missing variables as individuals (states) do not change over time. Unlike the “pre-ex post” comparison, fixed-effect regression can be used in situations where each individual has observations for two or more periods
The fixed effect regression model has$n$A different cut, one for an individual. These amplitudes can be expressed as a collection of binary (or indicator) variables. These binary variables absorb the effects of all missing variables that vary between individuals but do not change over time.
The basic form of the return equation is one of them.$Z_i$It's the fixed amount of individual observations that don't change over time. $$Y_u=\beta_0+\beta_1X_{it}+\beta_2Z_i+u_{it}$$
If we build each individual into a model with its own cut-off, $$Y_{it}=\beta_1X_i+\alpha_i+u_{it}$$ Of course, we're asking that the regression factor be consistent with the individual regression equation, which is the fixed effect regression model.
We can't use the OLS at this time. We need more changes.
The cut-off range of a given individual in a fixed-effect regression model can also be expressed as a binary variable for a single individual, i.e. we can introduce virtual variables to harmonize the regression equation as follows: $$Y_u=\beta_0+\beta_1X_u+\gamma_2D2_i+\gamma_3D3_i+\cdotp\cdotp\cdotp+\gamma_nDn_i+u_i$$ At this point, the introduction of virtual variables will also consider the problems that lead to multiple co-linearity, without losing sight of the fact that this paper "Segregated self-variant and virtual variable issues" Section At this point, the model can be reclassified as a problem for traditional regression models.
It's very easy to introduce this type of return into the problem of multiple returns. $$Y_{it}=\beta_1X_{1,it}+\cdotp\cdotp\cdotp+\beta_kX_{k,it}+\alpha_i+u_{it}$$
Time fixed effect returns
For each individual, the fixed effects represent the effects of variables that do not change over time, but change over time. Similarly, the fixed effects of time represent the effects of variables that do not change over time. It's not appropriate to have model effects if you miss the time back.
It's natural to give a model that only has time effects, or to use one dollar for example. $$Y_{it}=\beta_1X_{it}+\lambda_t+u_{it}$$ Of which$\lambda_t$ Called Time Fixed Effects
Just as an individual fixed-effect regression model can be used, one or more binary indicator variables can be used. $T-1$A binary indicator variable indicates a time fixed effect regression model: $$Y_{it}=\beta_0+\beta_1X_{it}+\delta_2BT_t+\cdotp\cdotp\cdotp+\delta_TBT_t+u_{it}$$ We're ignoring a problem that avoids convergence.
Time fixation allows us to eliminate the deviations from the missing variables, such as the national introduction of safety standards, over time but consistent across all states in a given year.
For time effects, reference may be madeLinear Time Series Analysis Financial time series analysis (one dollar) It gives us better time-effect analysis tools.
Mixed time fixed and fixed effects
If some of the missing variables are fixed for time but vary with the individual (e.g. cultural norms) while others are fixed for the individual but change over time (e.g. national security standards), it is appropriate to attract both individual and temporal effects.
Integration of individual and time fixed effect regression models (Entity and Time Fixed Effects ReviewModel) as $$Y_{it}=\beta_1X_{it}+\alpha_i+\lambda_t+u_{it}$$
We can still break down a lot of virtual variables to solve the problem.
Panel regression factor estimate
We know that the equation ahead can be determined using the traditional OLS estimated realization factor, but in practice this OLS regression is redundant or some software packages cannot be implemented when there are a very large number of individuals.
As a result, econometric software has special treatments for fixed-effect regression model OLS estimates. These special treatment methods are estimated to be OLS with the return of the whole binary variable, but they operate faster by using some mathematically simplified algebras that are suitable for the return of fixed effects.
Here, we don't explain the problem of the algorithm, just as a hint, we can consider a special package for the acceleration of the algorithm when we take the panel data back.
A special panel regression estimation method is In the balance panel,$X$The coefficient can be used first.$Y$and$X$ Less the average of the individual and the time, then estimate the centralized.$Y$It's a centralization.$X$ The multiple regression equation. This algorithm, which is usually used in the regression software, avoids the construction of a collection of all the binary indicator variables.
Standard error for panel regression
Because the panel returns to include time series data, it must be self-relevant, which is the general feature of time series data; therefore, the omission factor associated with the regression error is likely to contain time variability, and they are self-relevant. In general, as long as the omission factor is self-relevant, the error will be self-relevant.
If the regression error is self-relevant, then the original heterogeneity deviation standard error is no longer applicable, just as the original homogeneity difference SE is no longer applicable.
For potential heterogeneity-related errors of the individual, a cluster standard error should be used, with his exclusive return to the panel data, still assuming that the individual is not related, and that he can also be used for the problem of heterogeneity and the difference.
Finally, the return of panel data requires panel data, which is difficult to obtain, so we need to consider other ways of dealing with non-observable variables, i.e., the return of tool variables in the next chapter.
Tool variable returns
Tool Variable Return Introduction
The return of panel data can only address some of the disability and self-variant problems, and sometimes we cannot collect panel data. Similarly, the return of fixed effects has no effect on the dichotomy of the two-way causal factors, and we need new ways to address this.
We still want to solve the regression variable.$X$With disability$e$But at this point in time, we don't think about how this is happening, but we measure him directly by a variable, which is the return of tool variables.
The return of a tool variable (IVR) is a general method to obtain consistent estimates of regression functions when the variable and error items are relevant. Let's put$X$The change is considered to consist of two parts, one not related to the disability and the other related to the disability; we use the separated tool variable (IV) to separate those changes associated with the disability, thus allowing for a consistent estimation of the regression equation.
The return of the tool variable is essentially the introduction of a new variable, but the variable is not used for estimation as before.
Tool variable estimates for single regression and single tool variables
We start with individual regressions from variables.
Tool variable regression model and internality
A standard general regression model takes the form of $$Y_i=\beta_0+\beta_1X_i+u_i,i=1,\cdots,n$$ Current Variable$X$And disability.$u$We need to find a way to fix this.
Tool variable returns with a specific term to distinguish between the general error item$u$is a relevant or unrelated variable. The variables associated with the error items are called inner variables (Endogenous Variables), while those unrelated to the error items are called external variables (Exogenous Variables).
Effective tool variables must meet two conditions, i.e. the tool-related condition (Instruation Relevance condition) and the tool-generated condition (Instruation Analysis condition):
- Tool variables relevant: corr$(Z_i,X_i)\neq0$
- Tool variable external: corr$(Z_i,u_i)=0$
If the tool is relevant, then the change in the tool$X_i$Change is relevant. Besides, if the tool is alien, then the tool variable captures it.$X_i$This part of the change is also alien.
Therefore, relevant and external tools can capture$X_i$The external changes. This external change can be used in turn to estimate the overall coefficient$\beta$
Minimal two-stage multiplication TSLS (one dollar)
If Tools$Z$The condition of relevance and externality is met, then the coefficient$\beta_{\mathrm{l}}$Estimates can be made by means of a tool variable estimate called Two Stage List Squares, TSLS.
As in its name, the minimum two-stage estimate is calculated in two phases. Phase I will be$X$Decompose into two parts: the one relating to and causing problems with regression errors, and the other not related to errors that do not cause problems. Phase II uses unproblematic parts to estimate$\beta_{1}$
Phase 1 from X and$Z$ The general return begins: $$X_i=\pi_0+\pi_1Z_i+v_i$$ The function of this regression is to decompose the original self-variant. of which cut-outs and$Z$ It is external, and this part has nothing to do with the error. The last part.$v_i$It's about the part of the original variable that caused the problem.
The idea behind the minimum double is the part where the use doesn't cause problems.$X_i$i.e.$\pi_0+\pi_1Z_i$, while ignoring$\upsilon_i$I don't know. The only complication is that...$\pi_0$and$\pi_1$The value is unknown, so...$\pi_0+\pi_1Z_i$Can't be calculated.
Therefore, the first stage of the minimum double multiplier applies OLS to the previous equation, using the OLS regression projection, i. e.$\hat{X}_i=\hat{\pi}_0+\hat{\pi}_iZ_i$, where$\hat{\pi}_0$and$\hat{\pi}_1$For OLS estimates. The second stage of the minimum quadrilateral is very simple: using OLS$Y_i$Yeah.$\hat{X}_i$Come back. The estimate for the second stage of return is the lowest 2x2 estimate.0^\mathrm{TSLS}$和$\hat{\beta}\mathrm{l}^\mathrm{TSLS}$。
Sample distribution of TSLS
The precise distribution of TSL estimates in small samples is complex. However, as with OLS estimates, their distribution is relatively simple in large samples: TSL estimates are consistent and subject to normal distribution.
Although two phases of TSLS make the estimates seem more complex, only one regression variable is considered $X$ and a tool variable$Z$The TSLS estimate has a simpler formula, as we assume in this chapter. You! $s_{ZY}$Yes$Z$ and$Y$♪ the sample is the difference between, and ♪ $x_{ZX}$Yes$Z$ and $X$ The difference between the samples. TSLS estimated to contain a one-dollar tool variable What's that?1^{TSLS}=\frac{s{ZY}}{s_{ZX}}$$
More extrapolation work is done with specific instructions from software, and no further description is provided here.
General tool variable returns
General tool variable returns to model form
The general tool variable regression model contains four forms of variable: the explained variable $Y$;the internal regression variable that causes the problem is recorded as$X$; other regression variables referred to as including external variables as$W$; and tool variables$Z$。
Generally, there may be multiple built-in regression variables.$X$), multiple containing external variables ($W$) and several tool variables ($Z$)。
To make it work, the tool variable ()$Z$) number must be at least internal regression variable ( )$W$Just as much. In the previous section, only in-kind regression and monist tool variables were considered. For an IUD variable, a (at least) tool variable is required. Without it, we will not be able to calculate the tool variable estimate: there is no first-stage regression in TSLS.
The relationship between the number of tool variables and the number of internal regression variables has their own specialized terminology. If the number of tools$m$equals the number of internal regression variables ($k$), which is$m=k$, which states that the regression factor is correctly recognized. If the number of tools is greater than the number of inner regression variables, $m>k$,则称系数是过度识别 (Overidentified) 的。如果工具的个数小于内生回归变量的个数,即$m<k, is unrecognized.
If it is to estimate the return of the tool variable, the coefficient must be correctly or over-identified.
Therefore, we should present the model as $$Y_i=\beta_0+\beta_1X_{1i}+\cdotp\cdotp\cdotp+\beta_kX_{ki}+\beta_{k+1}W_{1i}\cdotp\cdotp\cdotp+\beta_{k+r}W_n+u_i,i=1,\cdotp\cdotp,n$$
Minimum two times two stages (general)
If there's only one variable, then it should take the form of $$Y_i=\beta_0+\beta_1X_i+\beta_2W_{1i}+\cdotp\cdotp\cdotp+\beta_{1+r}W_{ri}+u_i$$ The corresponding minimum two times the first stage should be $$X_i=\pi_0+\pi_1Z_{1i}+\cdotp\cdotp\cdotp+\pi_mZ_{mi}+\pi_{m+1}W_{1i}+\cdotp\cdotp\cdotp+\pi_{m+r}W_n+v_i$$ In the second phase, all we have to do is use the first-phase projections.
Extending to the issue of multiple returns requires only the minimum of two times the first of multiple self-variant variables in the first phase, with the second remaining unchanged.
More about the hypothetical tests, the error estimates are not presented here.
ToolVariance Validity Test
Whether or not the tool variable returns works in the given application depends on the effectiveness of these tools, the invalid tool variable produces meaningless results. It is therefore particularly important to evaluate the effectiveness of a set of tools in a given application.
Tool Variable Relevance and Weak Tool
Tool-relevance conditions play a very delicate role in the return of tool variables. One way to see the relevance of the tool is to compare its role to sample capacity: the more relevant the tool variable - the more it is.$X$The change is explained by the tool - meaning that more information can be used in the return of the tool variable.
Less explanation.$X$Change tools are called weak tools. In the case of cigarettes, the distance between the state and the place where the cigarette is produced can prove to be a weak tool: Although the distance increases transport costs (thus moving the supply curve to the left and increasing even prices), transport costs account for only a small portion of cigarette prices because of the low weight of cigarettes. Thus, the part of price changes that is explained by transport costs, i.e. the distance between origin and origin, may be very small.
Let's talk about relevance and weak tools in this section.
In the case of weak tools, the use of normal distributions to approximate the sample distribution of ISLS estimates is not optimal. Thus, despite being a large sample, there is also a lack of theoretical justification for the use of normal statistical extrapolations. In fact, if the tool is weak, the TSL estimate is highly biased in the direction of the OLS estimate.
In addition, the probability of the true value of the coefficient contained in the 95 per cent confidence interval, constructed using a standard error of 1.96 times the TSLS estimate, may be much smaller than 95 per cent. In short, if the tools are weak, TSL is no longer reliable.
Very few cases are encountered where the tool variables are completely irrelevant, but the extent to which the tool variables are relevant can be considered to be comparable. We have an empirical rule: Assuming a return equation of 0 for a minimum 2x2 return in phase I, if the F count is greater than 10, then there is no need to worry about weak tools
If we have few powerful tools and many weak ones, we better ignore the weaker tool variables; while this will increase the standard error of TSLS, the SE itself, which contains the weak tools, will not work.
If the coefficients are correctly identified, even over-identified might not find so many powerful tools available, then we cannot ignore the weak ones. Find some new tool variables or use IVR options for weak tool files
Externality of tool variables
If the tool is not external, then TSL is inconsistent: i.e. TSL estimates yield other values based on probability to non-overall regression factors. After all, the idea that the tool variable returns is that the tool contains an error item.$u_i$It doesn't matter.$X_i$Information on changes.
Is it statistically possible to test the externality of the tool? Yes, but possibly not at the same time. On the one hand, when the coefficient is correctly identified, it is not possible to test the tool as an external hypothesis. On the other hand, if the coefficient is over-identified, then the over-identification constraint can be tested, assuming that there are enough effective tools to identify the factors of interest, so that the “additional” tools are external.
First of all, consider the exact circumstances, when you have the same number of tools and variables as the number of internal regression variables. In that case, it was not possible to conduct statistical tests of the assumptions that the tool was in fact external. This means that empirical evidence cannot be used to answer the question of whether the tool variable meets the external constraints.
In such cases, the only way in which the evaluation tool is external is through expert advice and your experience on the issue.
The externality of the assessment tool variables must be judged professionally on the basis of individual knowledge of the application of the practice. However, if there are more tools than internal regression variables, there are statistical tools that can help with the process: the over-identification of binding tests.
The idea of over-identification tests is to use multiple tool variables for different TSLs, and if they are external, the estimated results must be close, and if they are not, it means that at least one variable has an external problem. We have a special hypothetical test to solve this problem.$J$Statistics
Search for valid tool variables
In practice, the most difficult part of the tool variable estimates is to find both relevant and external tool variables. Two approaches are presented here, reflecting two different perspectives of econometric and statistical modelling.
The first approach is to find tools based on economic theory. For example, Philip Wright ' s knowledge of the agricultural market economy prompted him to find a tool to move the supply curve without moving the demand curve; it also led him to consider the weather conditions in the agricultural region. However, economic theory is abstract and often fails to take into account the small and detailed differences in the data concentration of a specific analysis, so the methodology is not always effective.
The second construction tool variable is to find it.$X$Some of the exogenous causes of change are in fact caused by a random phenomenon leading to the movement of internal regression variables. Such an approach often requires a full understanding of the issues studied, while the details of the data are carefully explored, preferably through specific cases.
We'll use three cases to see how other scholars found the right IV.
Is keeping criminals in prison a deterrent?
This is a question that only economists can ask. After all, criminals are unable to commit crimes outside prison while serving their sentences, while arresting some of them also helps to deter others from committing crimes. But the magnitude of the combined effect — that is, the change in crime rates caused by the 1 per cent increase in the number of people in prison — is an empirical problem.
One strategy for estimating this effect is the return of crime rates (number of offenders per 100,000 population) to prison rates (number of prisoners per 100,000 population) based on data at appropriate levels of jurisdiction (e.g. state of the United States).
This return may include certain measures of economic conditions. When the overall economic situation deteriorates, crime increases. However, there may be serious problems arising from potential two-way causal deviations: If the crime rate increases and the police act impartially, more prisoners will emerge. On the one hand, an increase in the number of prisoners would lead to a decrease in the crime rate; the return of OLS, which established the crime rate against the prison rate, would estimate the complex combination of the two effects, due to the two-way causality. And the problem can't be solved by finding better control variables.
However, we can overcome the two-way causal bias by finding the right tool variables and using TSLS. The tool must be related to the rate of imprisonment (the relevant conditions must be met), but not to the error in the crime rate equation of interest (the external conditions must be met).In other words, the instrument must be capable of influencing the rate of incarceration, but at the same time not related to any determining factor in the unobserved crime rate.
How do we find tools and variables? Because the construction of prisons is time-consuming, short-term content restrictions may force states to release prisoners early or reduce prison rates. For this reason, Levitt, 1966, considered that legal proceedings aimed at reducing prison overcrowding could be used as a tool variable, while he undertook an empirical analysis based on data from the United States State panels of 197211993.
We can feel that this observation of prison overcrowding has nothing to do with crime rates, but it does have a bearing on the rate of incarceration. At the same time, it is relevant and external. Multiple tool variables can be obtained if we continue to dig up more observations of prison overcrowding on this side.
Does reducing class size increase test scores?
As we have done in the case of empirical analysis, small classes produce richer schools, while their students receive more intensive learning opportunities both inside and outside the school.
We have overcome the threat of missing variables by controlling variables such as student wealth, English language proficiency and multiple regressions. However, skeptics will wonder if we are in position: if we still miss something important, then our estimates of the class size effect will remain biased.
This potential omission of variables can be overcome by the way they are correctly controlled, but if they are not available (e.g., difficult to measure out-of-school learning opportunities), the tool variable regression should be used as an alternative. The return requires a tool variable related to class size (relevance), but not to test achievement determinants that constitute errors (e.g. parents ' interest in learning, opportunities for out-of-school learning, teacher level and school facilities, etc.) (externality).
Hoxby, 2000 suggests the use of biological theory. Due to random fluctuations in the timing of birth, the number of new entrants to kindergarten varies from year to year. Although the actual number of children entering kindergarten may be internal (there have been recent reports that schools may affect parents' ability to send their children to private schools), she points out that the number of potential children entering kindergarten — that is, the number of children aged 4 in the school district — is mainly due to random fluctuations in the date of birth of the child.
Can a positive effect on heart disease prolong life?
Active treatment of patients with heart disease (professionally referred to as acute myocardial infarction, AMI) helps to prolong life. Before new treatments can be extended to general applications, clinical experiments, i.e. a series of random control experiments designed to measure their effects and side effects, are required. However, good clinical trials are one thing, and the effects in practical applications are another.
A natural starting point for studying the effectiveness of the treatment is to compare the situation of patients who have received the treatment with those who have not. This entails establishing a re-entry of the patient ' s life expectancy to the binary treatment variable (whether the patient has undergone a heart tube implant) and other control variables affecting mortality (e.g. age, weight, other health conditions, etc.).
The overall coefficient of the indicator variable is the increased life expectancy of the patient receiving the treatment. Unfortunately, the OLS estimate is biased: the operation is not “randomly” performed on the patient; rather, it is performed only when the doctor and the patient believe it may be effective. If the decision depends in part on non-observed factors that are not centralized but are associated with health outcomes, then the treatment decision will be related to regression error. If the most healthy patients are treated, the OLS estimate will be biased (the treatment is related to missing variables), and the treatment will appear to be more effective than its real effects.
We need a tool variable related to treatment but not to health factors that affect life expectancy to address this problem.
McClellan, McNeil, and Newhouse, 1994 believe that geographical location should be used. Most of the hospitals in their data sets are not special hospitals for heart catheters, so many patients go closer to the “conventional” hospital, which does not provide such treatment, than to the heart catheters hospital. MacLelon, McNeil and Newhouse therefore use as a tool variable the distance between the home of a heart disease patient and the nearest heart catheter insulation hospital to the nearest general hospital, and zero if the nearest hospital were a heart catheter insulation hospital, otherwise positive. If the relative distance above affects the probability of treatment, then it is relevant. If relative distance is randomly distributed among heart patients, it is external.
Some lessons learned on IV
- Don't go back two steps manually.
- The first stage must contain all external variables.
- Carefully use the ageing entry as a tool variable It usually does not satisfy the physical assumption.
- The tools are not as good as the variables.
- Tool variables are not a panacea. It's very difficult to find tool variables that simultaneously satisfy strong relevance and strict externalities.
Robust's Return to the Indian Ocean
Source of Information Services
Impacted observationsThat's what we're talking about.Big enough.So much to remove it.Substantive changes in parameter estimates and findingsThis makes conclusions unreliable.
It could come from two sources.
- Leverage Explain Variable$X$Unusual.
- Organisation Because of variables$Y$Unusual.
We can't ignore it.Influential Observations So we need to study his tests and Robust's regression techniques.
Students with disabilities
References Linear regression base The "minimal 2 times estimated disability" section of the study is the most basic tool for studying abnormalities.
Leverage
We know that the magnitude of the impact of the estimates of each of the observations that build the OLS regression equation is in fact different. Leverage is intended to study the magnitude of the impact of the various observations on the regression equation estimates.
The Leverage of OLS returns is defined as $$h_i=\frac{1}{n}+\frac{(x_i-\overline{x})^2}{\sum_j(x_j-\overline{x})^2}$$
For larger leverage points, the slope of the regression line tends more to the slope from that point to the average, i.e., the point of greater leverage is most important in determining the slope of the regression line. Small leverage points are not that many, and we can delete them without changing the regression line.
Cook's distance
The leverage is still not intuitive, and we need to give statistics from generic regression models, that is, Cook's distance. $$D_{i}=\frac{e_{i}^{2}}{k\hat{\sigma}^{2}}\left(\frac{h_{i}}{(1-h_{i})^{2}}\right)$$
$k$is the number of regression variables. It gives a measure of the difference between the estimation parameters and the group after they were deleted.
The empirical approach is to consider those observation groups with Cook statistics larger than one; to see if they are too influential.
Coker's distance is only available at a single impact point, which is theoretically clear.
Breakdown value
The blow-through value is a great robust measure for an estimate; he shows the maximum anomaly required for the estimate to be safe.
For example, as a measure of concentration, his penetration is zero, and any extreme impact sample will destroy our estimated effects.
It is clear that the penetration point of any reasonable estimate cannot exceed 50% (because if more than half of the observations are contaminated, it is impossible to distinguish between potential distribution and contamination distribution)
The OLS returns.
When the error distribution is normal, the minimum binary (LS) is the most efficient regression estimate. However, LS is very sensitive to the abnormalities of high leverage points. As a result, OLS often collapses when such abnormal values exist.
While individual abnormalities can normally be detected through sensitivity analysis, they can be “covered” if there is a set of abnormalities. This may lead to a rewinding error distribution. So we need some of Robust's return technology.
Minimum absolute deviation returns
Change Optimization Method to $$minimise\sum_{i=1}^N|y_i-\beta_1x_{1i}-\beta_2x_{2i}-\ldots-\beta_kx_{ki}|$$ It's possible.$x$(b) Sensitivity; In some cases, it could collapse if there was only one abnormal value with a damaged y value.
Median Returns
$$r_{i}^{2}(\beta)=\left(y_{i}-\beta_{1}x_{1i}-\beta_{2}x_{2i}-\ldots-\beta_{k}x_{ki}\right)^{2}$$ LMS Estimater is looking for minimization $r_{i}^{2}(\beta)$ The median beta (i.e., the median of its minimization of the orderly square difference). LMS Estimator has a high penetration value but is difficult to calculate.
A broad linear model GLM
What's GLM?
The broad linear model (Generalized Linear Model) is a direct extension of the common normal linear model, which can be applied directly to continuous and discrete data; the broad linear model requires that the corresponding variable be linearly dependent on local variables; it maintains the idea of linear variables; and it expands in two ways.
- A linear relationship between the expectations of the responding variable and the interpretation variable is created by a connection function, i.e., a change in expectations for the responding variable.
- By an error function, describe the last part of the random item of the broad linear model; there are different forms of disability.
After the roll-out, we can summarize the three points of the GLM.
- Linear dependency
- Connect Functions
- Error Functions
The model is as follows: Our original linear regression model can be described as $$\mu_Y=\beta_0+\sum_{j=1}^p\beta_jX_j$$ In the traditional linear regression model,$\mu_Y$ It's the observation of the average of conditions for variables, and we're asking...$Y$ Subject to normal distribution
In GLM ' s broad linear model, the ready form becomes $$g(\mu_Y)=\beta_0+\sum_{j=1}^p\beta_jX_j$$ of which$g(\mu_Y)$ It's a function of condition average, we call it.Connect FunctionsAnd you can relax.$Y$For the assumption of normal distribution read$Y$Obey.A distribution in the index distribution groupIt's okay. When you set the connection function and the probability distribution, the parameters can be derived from the maximum seemingly multiple inverted generation.
Selection of connecting functions and distributions
We can see that at the moment we have two important super-parameters to choose for the GLM problem.
- Probability distribution type (because of probability distribution of variables)
- Connection function type (what changes are made)
In fact, different probability distributions have their own default connecting functions, as shown below.
| Distribution Type | Connect Functions | Name of return |
|---|---|---|
binomial |
(link = "logit") |
Logit returns |
gaussian |
(link = "identity") |
Normal linear regression |
gamma |
(link = "inverse") |
GLM Return |
inverse.gaussian |
(link = "1/mu^2") |
GLM Return |
poisson |
(link = "log") |
Porsche returns. |
quasi |
(link = "identity", variance = "constant") |
A quasi-distribution of GLM |
quasibinomial |
(link = "logit") |
Normal distribution Logit |
quasipoisson |
(link = "log") |
It's almost distributed. |
^d089b1
We need to make the right model selection based on the distribution of the variables.
Classic GLM.
We're here.Logistic returnsIt describes in detail the most classic form of GLM return, so that we can understand what we're doing, and so that we can compare to other GLM returns.
- Title: Generalized Linear Regression: Categorical Predictors, Dummy Variables, and Fixed Effects
- Author: Hyacehila
- Created at : 2024-05-24 09:32:12
- Link: https://hyacehila.github.io//blog/2024/05/24/generalized-linear-regression-notes/
- License: This work is licensed under CC BY-NC-SA 4.0.