SAS. Generalized Linear Models (Лекции 2013)

2020-08-25СтудИзба

Описание презентации

Файл "SAS. Generalized Linear Models" внутри архива находится в папке "Лекции 2013". Презентация из архива "Лекции 2013", который расположен в категории "". Всё это находится в предмете "(ппп соиад) (sas) пакеты прикладных программ для статистической обработки и анализа данных" из 10 семестр (2 семестр магистратуры), которые можно найти в файловом архиве МГУ им. Ломоносова. Не смотря на прямую связь этого архива с МГУ им. Ломоносова, его также можно найти и в других разделах. .

Просмотр презентации онлайн

Текст из слайда

GENERALIZED LINEAR MODELS
Copy right © 2013, SAS I nst it ute I nc . All rights reserved.

GENERALIZED LINEAR MODELS
OVERVIEW
Copy right © 2013, SAS I nst it ute I nc . All rights reserved.

OVERVIEW GENERAL LINEAR MODELS
yi  0  1 x1i 
  k xki   i
2
 i ~ i.i.d . N (0,  )
var( yi ) 
2
Actually, proc glm
Copy right © 2013, SAS I nst it ute I nc . All rights reserved.

OVERVIEW GENERALIZED LINEAR MODELS
g ( E ( yi ))  0  1 x1i  …   k xki X



The distributon of the observatons can come from the
exponental family of distributons.
The variance of the response variable is a specifed
functon of its mean.
X is ft to a functon of E(y) (called a link functon)
suggested by the distributon of the observatons:
g(E(y)) = g() = X
Link functin
Copy right © 2013, SAS I nst it ute I nc . All rights reserved.

OVERVIEW LOGIT LINK FUNCTION FOR BINARY RESPONSE
 p 
logit( p ) log 

1

p


Logit (pi)
pi
Logit
Transform
Predictor
Copy right © 2013, SAS I nst it ute I nc . All rights reserved.
Predictor

OVERVIEW LOG LINK FUNCTION FOR COUNT DATA
Count
Log(count)
Log
Transform
Predictor
Copy right © 2013, SAS I nst it ute I nc . All rights reserved.
Predictor

OVERVIEW EXAMPLES OF GENERALIZED LINEAR MODELS
*Models often use the LOG link in practice.
Copy right © 2013, SAS I nst it ute I nc . All rights reserved.

POISSON REGRESSION
Copy right © 2013, SAS I nst it ute I nc . All rights reserved.

POISSON REGRESSION PROPERTIES AND EXAMPLES
• is one type of generalized linear model
• assumes that the response variable follows a
Poisson distributon conditonal on the values of
the predictor variables
• can be used to model the number of
occurrences of an event of interest or the rate of
occurrence of an event of interest as a functon
of some predictor variables
• is most appropriate for rare events
• Response dist. should have small mean (<10 or even
<5 and ideally ~1)
• If no, gamma and lognormal could be beter choice
Copy right © 2013, SAS I nst it ute I nc . All rights reserved.
Examples include
• number of ear infections in
infants
• number of equipment failures
• colony counts for bacteria or
viruses
• counts of a rare disease in a
population
• number of fatal crashes at an
intersection
• homicide rates in a given state
• rate of insurance claims
• number of infected areas per
unit volume of a tree
• response rates to a marketing
campaign

POISSON REGRESSION POISSON VERSUS NORMAL DISTRIBUTION
Poisson distributon
• is skewed to the right for rare events
• is for nonnegatve integer values
• has only one parameter (the mean)
• has a variance that is equal to the mean
Copy right © 2013, SAS I nst it ute I nc . All rights reserved.
Normal distributon
• is symmetric
• can be for negatve as well as positve real values
• has two unrelated parameters (mean and variance)

POISSON REGRESSION MODEL
log(  )  0  1 X 1   2 X 2  ...   k X k
 e
(  0  1 X1   2 X 2 ...  k X k )
e e
0
Copy right © 2013, SAS I nst it ute I nc . All rights reserved.
1 X1
e
2 X 2
e
k X k

POISSON REGRESSION PARAMETER ESTIMATES
ˆ
e 
multiplicative effect on
̂
for a one-unit change in X.
Example 1, if
ˆ1
e 
1.20, then a one-unit increase in X1 yields
a 20% increase in the estimated mean.
Example 2, if
e
Copy right © 2013, SAS I nst it ute I nc . All rights reserved.
ˆ2

0.80, then a one-unit increase in X2 yields
a 20% decrease in the estimated mean.

POISSON REGRESSION ПРИМЕР: ДАННЫЕ
Number if Self-Diagnised Ear Infectins
Age in Years
Frequent ir Occasiinal
Ocean Swimmer
Typical Swimming
Licatin
Gender
Copy right © 2013, SAS I nst it ute I nc . All rights reserved.

POISSON REGRESSION CATEGORICAL
Copy right © 2013, SAS I nst it ute I nc . All rights reserved.
Male
Gender
Female
nonBeach
Typical Swimming
Licatin
Beach
Occasional
Freq
Frequent ir Occasiinal
Ocean Swimmer

POISSON REGRESSION INTERVAL
Age in Years
Copy right © 2013, SAS I nst it ute I nc . All rights reserved.

POISSON REGRESSION ПРИМЕР
proc genmod data=sasuser.earinfection;
class Swimmer (param=ref ref='Freq')
Location (param=ref ref='Beach')
Gender (param=ref ref='Male');
model infections = swimmer location gender age age*age
/ dist=poisson link=log type3;
run;
Copy right © 2013, SAS I nst it ute I nc . All rights reserved.

POISSON REGRESSION ПРИМЕР: PROC GENMOD OUTPUT
Scale = 1*
Copy right © 2013, SAS I nst it ute I nc . All rights reserved.

POISSON REGRESSION OVERDISPERSION
• Poisson regression models assume the
variance is equal to the mean.
• Count data ofen exhibit variability exceeding
the mean.
• Overdispersion leads to underestmates of the
standard errors of parameter estmates.
WHAT TO DO


Use the negatve binomial
distributon [NOW]
Apply a multplicatve adjustment
factor (PSCALE or DSCALE opton in
the MODEL statement) [HW]
• Overdispersion results in overestmates of the
test statstc and liberal p-values.
• Subject heterogeneity due to an under-specifed model
• Outliers in the data
• Positve correlaton between the responses in clustered data
Copy right © 2013, SAS I nst it ute I nc . All rights reserved.

NEGATIVE BINOMIAL REGRESSION
Copy right © 2013, SAS I nst it ute I nc . All rights reserved.

NEGATIVE BINOMIAL
DISTRIBUTION AND MODEL
REGRESSION
The negatve binomial distributon
• is the distributon for count data that permits the variance to exceed
the mean
• enables the model to have greater fexibility in modeling the
relatonship between the mean and the variance of the response
variable than the Poisson model
Response
Variable
Distribution
Link
Function
Count
Negative
Binomial
Natural Log
Copy right © 2013, SAS I nst it ute I nc . All rights reserved.
Variance
Function
  k
2

NEGATIVE BINOMIAL
DISPERSION PARAMETER K
REGRESSION
• The dispersion parameter k is not allowed to vary over observatons.
• The limitng case when the parameter k is equal to 0 corresponds to a
Poisson regression model.
• When the parameter is greater than 0, overdispersion is evident and
the standard errors will increase. The fted values are similar, but the
larger standard errors refect the overdispersion uncaptured with the
Poisson model.
Copy right © 2013, SAS I nst it ute I nc . All rights reserved.

NEGATIVE BINOMIAL
ПРИМЕР
REGRESSION
proc genmod data=sasuser.earinfection;
class Swimmer (param=ref ref='Freq')
Location (param=ref ref='Beach')
Gender (param=ref ref='Male');
model infections = swimmer location gender age age*age
/ dist=negbin link=log type3;
run;
Copy right © 2013, SAS I nst it ute I nc . All rights reserved.

NEGATIVE BINOMIAL
ПРИМЕР: PROC GENMOD OUTPUT
REGRESSION
Copy right © 2013, SAS I nst it ute I nc . All rights reserved.

POISSON REGRESSION FOR RATES
Copy right © 2013, SAS I nst it ute I nc . All rights reserved.

POISSON REGRESSION:
RATES DATA: DEFINITION & EXAMPLES
RATES
• When events occur over tme, space, or
some other index of exposure, it is more
relevant to model the rate at which they
occur rather than the number of events.
• Rates provide the necessary
standardizaton to make the outcomes
comparable.
• You use the OFFSET= opton in the
MODEL statement in PROC GENMOD.
Copy right © 2013, SAS I nst it ute I nc . All rights reserved.
• How crime rates are related to the
city’s unemployment rate
• How melanoma incidence rates are
related to demographic variables
• How the rate of loan defaults is
related to region of the country
• How response rates to marketing
campaigns relate to known
characteristics of the recipients

POISSON REGRESSION:
RATES DATA: OFFSET
RATES

log    0  1 x1  …  k xk
T 
log(  ) log(T )   0  1 x1  …   k xk
OFFSET = Variable
 T * e
Copy right © 2013, SAS I nst it ute I nc . All rights reserved.
(  0  1 x1  …  k xk )

Log(T) is called the ofset variable
that has a coefcient equal to 1.

The ofset variable makes the
fted rate proportonal to the
index of exposure.

For example, using the log of the
populaton as an ofset variable is
the same as modeling the mean
number of events proportonal to
populaton size.

POISSON REGRESSION:
SKIN CANCER IN TEXAS AND MINNESOTA
RATES
City: Minneapolis-St. Paul
Dallas-Fort Worth
Incidence if
ninmelanima
skin cancer
Copy right © 2013, SAS I nst it ute I nc . All rights reserved.
Age_ 15-24
Group: 25-34
35-44
45-54
55-64
65-74
75-84
85+

POISSON REGRESSION:
ПРИМЕР
RATES
proc genmod data=sasuser.skin;
class City (param=ref ref='MSP')
Age (param=ref ref='85+');
model cases = city age
/ offset=log_pop dist=poisson link=log type3;
run;
Copy right © 2013, SAS I nst it ute I nc . All rights reserved.

ZERO-INFLATED POISSON MODEL
Copy right © 2013, SAS I nst it ute I nc . All rights reserved.

ZIP PURPOSE

In some setngs, the incidence of zero counts will be much greater
than expected for the Poisson distributon.

Poisson regression models will exhibit overdispersion when they are
ft to data with an excess number of zeros.

Zero-infated Poisson (ZIP) models might be a beter ft to the data.
Copy right © 2013, SAS I nst it ute I nc . All rights reserved.

ZIP MODEL

The populaton that can be modeled with the zero-infated Poisson distributon
is considered to consist of two types of responses.

The frst type gives Poisson distributed counts, which can produce the zero
outcome or some other positve outcome.

The second type always gives a zero count.

Therefore, the relevant distributon is a mixture of a Poisson distributon and a
distributon that is constant at zero.
Copy right © 2013, SAS I nst it ute I nc . All rights reserved.

ZIP COMPONENTS
g (i )  xi
MODEL statement
h(i )  zi
ZEROMODEL statement
proc genmod data=sasuser.roots;
class bap photoperiod;
model roots = photoperiod | bap
/ dist=zip link=log type3;
zeromodel photoperiod;
run;
Copy right © 2013, SAS I nst it ute I nc . All rights reserved.

ZIP ПРИМЕР: ДАННЫЕ
photoperiod
(hour)
8
16
Copy right © 2013, SAS I nst it ute I nc . All rights reserved.
concentration (M)
2.2
4.4
8.8
17.6
Number of
roots
Number of
roots
Number of
roots
Number of
roots
Number of
roots
Number of
roots
Number of
roots
Number of
roots

8 hours
16 hours
ZIP ПРИМЕР
Copy right © 2013, SAS I nst it ute I nc . All rights reserved.

ZIP ПРИМЕР: РЕЗУЛЬТАТЫ
dist=zinb
Copy right © 2013, SAS I nst it ute I nc . All rights reserved.

GAMMA REGRESSION
Copy right © 2013, SAS I nst it ute I nc . All rights reserved.

GAMMA DISTRIBUTION



is a skewed distributon for positve values
has a variance that is proportonal to the squared mean
has lighter tails than a lognormal distributon
gamma
Var(y)  [E(y)]2
Copy right © 2013, SAS I nst it ute I nc . All rights reserved.

DISTRIBUTIONS COMPARISON
Distribution
Variance
 Normal (truncated)
constant*
 Poisson
 E(Y)
 Gamma
 (E(Y))2
 Lognormal
 (E(Y))2
100x
Copy right © 2013, SAS I nst it ute I nc . All rights reserved.

GAMMA REGRESSION ПРИМЕР
proc univariate data=car;
var price;
histogram / gamma (alpha=est sigma=est theta=est color=blue w=2)
vaxis=0 to 14 by 2 midpoints=8 to 50 by 2;
run;
Copy right © 2013, SAS I nst it ute I nc . All rights reserved.

GAMMA REGRESSION REG AND GENMOD RESULTS: RESIDUAL
proc genmod data=car;
model price = hwympg hwympg2 horsepower
/ dist=gamma link=log /*identity*/ obstats id=model;
run;
PROC REG
PROC GENMOD, link=lig
Copy right © 2013, SAS I nst it ute I nc . All rights reserved.
PROC GENMOD, link=identty

SUMMARY


Problem:
• nonconstant variance
PROBLEM fir OLS
Approaches:

Transform the dependent variable Price (log).

Fit a gamma regression model with the log link functon.

Fit a gamma regression model with the identty link functon.
Copy right © 2013, SAS I nst it ute I nc . All rights reserved.
?

СТРАХОВАНИЕ
CASE STUDY
Copy right © 2013, SAS I nst it ute I nc . All rights reserved.

GENMOD СТРАХОВАНИЕ
• Frequency - how ofen claims are made
• Severity
• A typical way to model severity (claim amount) is
by using a gamma distributon with a log link
functon
• Pure premium - it is the porton of the company’s
expected cost that is “purely” atributed to loss
• does not include the general expense of doing
business
• Tweedie distributon
Copy right © 2013, SAS I nst it ute I nc . All rights reserved.

GLM СТРАХОВАНИЕ: FREQUENCY & PURE PREMIUM
• ZIP
Copy right © 2013, SAS I nst it ute I nc . All rights reserved.
• Tweedie distributon –
• PROC SEVERITY SAS/ETS

СПАСИБО!
Copy right © 2013, SAS I nst it ute I nc . All rights reserved.
sas.com

Свежие статьи
Популярно сейчас
Почему делать на заказ в разы дороже, чем купить готовую учебную работу на СтудИзбе? Наши учебные работы продаются каждый год, тогда как большинство заказов выполняются с нуля. Найдите подходящий учебный материал на СтудИзбе!
Ответы на популярные вопросы
Да! Наши авторы собирают и выкладывают те работы, которые сдаются в Вашем учебном заведении ежегодно и уже проверены преподавателями.
Да! У нас любой человек может выложить любую учебную работу и зарабатывать на её продажах! Но каждый учебный материал публикуется только после тщательной проверки администрацией.
Вернём деньги! А если быть более точными, то автору даётся немного времени на исправление, а если не исправит или выйдет время, то вернём деньги в полном объёме!
Да! На равне с готовыми студенческими работами у нас продаются услуги. Цены на услуги видны сразу, то есть Вам нужно только указать параметры и сразу можно оплачивать.
Отзывы студентов
Ставлю 10/10
Все нравится, очень удобный сайт, помогает в учебе. Кроме этого, можно заработать самому, выставляя готовые учебные материалы на продажу здесь. Рейтинги и отзывы на преподавателей очень помогают сориентироваться в начале нового семестра. Спасибо за такую функцию. Ставлю максимальную оценку.
Лучшая платформа для успешной сдачи сессии
Познакомился со СтудИзбой благодаря своему другу, очень нравится интерфейс, количество доступных файлов, цена, в общем, все прекрасно. Даже сам продаю какие-то свои работы.
Студизба ван лав ❤
Очень офигенный сайт для студентов. Много полезных учебных материалов. Пользуюсь студизбой с октября 2021 года. Серьёзных нареканий нет. Хотелось бы, что бы ввели подписочную модель и сделали материалы дешевле 300 рублей в рамках подписки бесплатными.
Отличный сайт
Лично меня всё устраивает - и покупка, и продажа; и цены, и возможность предпросмотра куска файла, и обилие бесплатных файлов (в подборках по авторам, читай, ВУЗам и факультетам). Есть определённые баги, но всё решаемо, да и администраторы реагируют в течение суток.
Маленький отзыв о большом помощнике!
Студизба спасает в те моменты, когда сроки горят, а работ накопилось достаточно. Довольно удобный сайт с простой навигацией и огромным количеством материалов.
Студ. Изба как крупнейший сборник работ для студентов
Тут дофига бывает всего полезного. Печально, что бывают предметы по которым даже одного бесплатного решения нет, но это скорее вопрос к студентам. В остальном всё здорово.
Спасательный островок
Если уже не успеваешь разобраться или застрял на каком-то задание поможет тебе быстро и недорого решить твою проблему.
Всё и так отлично
Всё очень удобно. Особенно круто, что есть система бонусов и можно выводить остатки денег. Очень много качественных бесплатных файлов.
Отзыв о системе "Студизба"
Отличная платформа для распространения работ, востребованных студентами. Хорошо налаженная и качественная работа сайта, огромная база заданий и аудитория.
Отличный помощник
Отличный сайт с кучей полезных файлов, позволяющий найти много методичек / учебников / отзывов о вузах и преподователях.
Отлично помогает студентам в любой момент для решения трудных и незамедлительных задач
Хотелось бы больше конкретной информации о преподавателях. А так в принципе хороший сайт, всегда им пользуюсь и ни разу не было желания прекратить. Хороший сайт для помощи студентам, удобный и приятный интерфейс. Из недостатков можно выделить только отсутствия небольшого количества файлов.
Спасибо за шикарный сайт
Великолепный сайт на котором студент за не большие деньги может найти помощь с дз, проектами курсовыми, лабораторными, а также узнать отзывы на преподавателей и бесплатно скачать пособия.
Популярные преподаватели
Нашёл ошибку?
Или хочешь предложить что-то улучшить на этой странице? Напиши об этом и получи бонус!
Бонус рассчитывается индивидуально в каждом случае и может быть в виде баллов или бесплатной услуги от студизбы.
Предложить исправление
Добавляйте материалы
и зарабатывайте!
Продажи идут автоматически
5139
Авторов
на СтудИзбе
441
Средний доход
с одного платного файла
Обучение Подробнее