Dutta_Assignment_03

Author

Tanisha Dutta

Introduction

The following data investigates how the genitive form “s-genitive” versus “of-genitive” is influenced by the animacy of the possessor and possessive entities. For our analysis we will look at the following variables:

  • POSSESSOR: The animacy of the possessor.
  • POSSESSED: The animacy of the possessed entity.
  • GENITIVE: The genitive form used in the sentence, either “s-genitive” or “of-genitive”.

We want to investigate the interactions of POSSESSOR and POSSESSED with GENITIVE.

Let’s load the data and prepare it for modeling.

rm(list=ls(all.names=TRUE))
library(car); library(effects); library(magrittr); library(multcomp); library(stats); library(dplyr)
source("~/Downloads/web4LING105/_helpers/R2s.r"); source("~/Downloads/web4LING105/_helpers/C.score.r"); source("~/Downloads/web4LING105/_helpers/cohens.kappa.r")
summary(d <- read.delim(
  file="~/Downloads/web4LING105/_input/genitivesem.csv",
  stringsAsFactors=TRUE))
      CASE        GENITIVE    POSSESSOR      POSSESSED  
 Min.   :  1.00   of:150   abstract:139   abstract:206  
 1st Qu.: 75.75   s :150   animate :118   animate : 20  
 Median :150.50            concrete: 43   concrete: 74  
 Mean   :150.50                                         
 3rd Qu.:225.25                                         
 Max.   :300.00                                         

Linear regression

Deviance & baselines

Baselines for GENITIVE

(baselines <- c(
   "baseline 1"=max(
      prop.table(
         table(d$GENITIVE))),
   "baseline 2"=sum(
      prop.table(
         table(d$GENITIVE))^2)))
baseline 1 baseline 2 
       0.5        0.5 

Deviance of null model

m_00 <- glm(GENITIVE ~ 1, family=binomial, data=d, na.action=na.exclude)
deviance(m_00)
[1] 415.8883

Exploration & Preparation

Categorical Predictors

The predictors/response on their own.

A table for POSSESSOR.

table(d$POSSESSOR)

abstract  animate concrete 
     139      118       43 

A table for POSSESSED.

table(d$POSSESSED)

abstract  animate concrete 
     206       20       74 

A table for GENITIVE.

table(d$GENITIVE)

 of   s 
150 150 

The predictors with the response.

A table for GENITIVE ~ POSSESSOR.

table(d$POSSESSOR, d$GENITIVE)
          
            of   s
  abstract  92  47
  animate   16 102
  concrete  42   1

A table for GENITIVE ~ POSSESSED.

table(d$POSSESSED, d$GENITIVE)
          
            of   s
  abstract 111  95
  animate    9  11
  concrete  30  44
ftable(d$POSSESSOR, d$POSSESSED, d$GENITIVE)
                   of  s
                        
abstract abstract  80 37
         animate    3  2
         concrete   9  8
animate  abstract   9 58
         animate    6  9
         concrete   1 35
concrete abstract  22  0
         animate    0  0
         concrete  20  1

Modeling and numerical interpretation

Maximal model

summary(m_01 <- glm(      
   GENITIVE ~ 1 +         
   POSSESSOR*POSSESSED,
   family=binomial,       
   data=d,                
   na.action=na.exclude))

Call:
glm(formula = GENITIVE ~ 1 + POSSESSOR * POSSESSED, family = binomial, 
    data = d, na.action = na.exclude)

Coefficients: (1 not defined because of singularities)
                                    Estimate Std. Error z value Pr(>|z|)    
(Intercept)                          -0.7711     0.1988  -3.879 0.000105 ***
POSSESSORanimate                      2.6343     0.4097   6.429 1.28e-10 ***
POSSESSORconcrete                   -16.7950   843.4605  -0.020 0.984114    
POSSESSEDanimate                      0.3656     0.9343   0.391 0.695525    
POSSESSEDconcrete                     0.6533     0.5250   1.244 0.213352    
POSSESSORanimate:POSSESSEDanimate    -1.8234     1.1309  -1.612 0.106895    
POSSESSORconcrete:POSSESSEDanimate        NA         NA      NA       NA    
POSSESSORanimate:POSSESSEDconcrete    1.0388     1.1969   0.868 0.385441    
POSSESSORconcrete:POSSESSEDconcrete  13.9170   843.4613   0.016 0.986836    
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

(Dispersion parameter for binomial family taken to be 1)

    Null deviance: 415.89  on 299  degrees of freedom
Residual deviance: 266.49  on 292  degrees of freedom
AIC: 282.49

Number of Fisher Scoring iterations: 16

Model Selection

pchisq(              
   q =m_01$null.deviance-m_01$deviance,
   df=m_01$df.null-m_01$df.residual,
   lower.tail=FALSE)
[1] 5.436467e-29

m_01

drop1(m_01,
   test="Chisq")
Single term deletions

Model:
GENITIVE ~ 1 + POSSESSOR * POSSESSED
                    Df Deviance    AIC    LRT Pr(>Chi)
<none>                   266.49 282.49                
POSSESSOR:POSSESSED  3   270.87 280.87 4.3788   0.2234

m_02

m_02 <- update(
   m_01, .~.
   - POSSESSOR:POSSESSED)
drop1(m_02,
   test="Chisq")
Single term deletions

Model:
GENITIVE ~ POSSESSOR + POSSESSED
          Df Deviance    AIC     LRT  Pr(>Chi)    
<none>         270.87 280.87                      
POSSESSOR  2   411.78 417.78 140.908 < 2.2e-16 ***
POSSESSED  2   281.02 287.02  10.153  0.006241 ** 
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

m_final

m_final <- m_02

Confidence Intervals

Confint(m_final); rm(m_02); invisible(gc())
                    Estimate      2.5 %      97.5 %
(Intercept)       -0.7727572 -1.1605580 -0.40223460
POSSESSORanimate   2.6046969  1.9385770  3.34300676
POSSESSORconcrete -3.5492529 -6.4720122 -1.89397104
POSSESSEDanimate  -1.0466006 -2.1942747  0.09971993
POSSESSEDconcrete  0.9720345  0.1465628  1.85316205

Model Significance

anova(m_00, m_final,
   test="Chisq") 
Analysis of Deviance Table

Model 1: GENITIVE ~ 1
Model 2: GENITIVE ~ POSSESSOR + POSSESSED
  Resid. Df Resid. Dev Df Deviance  Pr(>Chi)    
1       299     415.89                          
2       295     270.87  4   145.02 < 2.2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Predictions

d$PRED_PP_S <- predict(
   m_final,
   type="response")
d$PRED_CAT <- factor(
   ifelse(d$PRED_PP_S>=0.5,
      levels(d$GENITIVE)[2],
      levels(d$GENITIVE)[1]))
(c_m <- table(
   "OBS"  =d$GENITIVE,
   "PREDS"=d$PRED_CAT))
    PREDS
OBS   of   s
  of 125  25
  s   40 110

Confusion Matrix

c(
   "Prec. for s"     =c_m[ "s", "s"] / sum(c_m[    , "s"]),
   "Acc./rec. for s" =c_m[ "s", "s"] / sum(c_m[ "s",    ]),
   "Prec. for of"    =c_m["of","of"] / sum(c_m[    ,"of"]),
   "Acc./rec. for of"=c_m["of","of"] / sum(c_m["of",    ]),
   "Acc. (overall)"  =mean(d$GENITIVE==d$PRED_CAT))
     Prec. for s  Acc./rec. for s     Prec. for of Acc./rec. for of 
       0.8148148        0.7333333        0.7575758        0.8333333 
  Acc. (overall) 
       0.7833333 
c(R2s(m_final),
  "Cohen's kappa"=cohens.kappa(c_m)[[1]],
  "C"=C.score(d$GENITIVE, d$PRED_PP_S))
  McFadden R-squared Nagelkerke R-squared        Cohen's kappa 
           0.3486931            0.5110820            0.5666667 
                   C 
           0.8509556 

Visual Interpretation

Visualize the effect of POSSESSOR.

pogen = effect("POSSESSOR", m_final)
pogen_d <- data.frame(pogen)
plot(pogen,
   type="response",
   ylim=c(0, 1),
   multiline=TRUE,
   confint=list(style="auto"),
   grid=TRUE)

Visualize the effect of POSSESSED.

gened = effect("POSSESSED", m_final)
gened_d <- data.frame(gened)
plot(gened,
   type="response",
   ylim=c(0, 1),
   multiline=TRUE,
   confint=list(style="auto"),
   grid=TRUE)

Excursus

Prediction and Slope

nd <- expand.grid(
    POSSESSOR = levels(d$POSSESSOR),
    POSSESSED = levels(d$POSSESSED)
)
nd$PREDS_LO_S <- predict(m_final, newdata=nd, type="link")
nd$PRED_PP_S <- predict(m_final, newdata=nd, type="response")

Most Likely to be Inaccurate Predictions

d$PRED_PP_OBS <- ifelse(
   d$GENITIVE=="s",
     d$PRED_PP_S,
   1-d$PRED_PP_S)
d$CONTRIBS2LL <- -log(d$PRED_PP_OBS)
head(d)
  CASE GENITIVE POSSESSOR POSSESSED PRED_PP_S PRED_CAT PRED_PP_OBS CONTRIBS2LL
1    1       of  abstract  abstract 0.3158830       of   0.6841170   0.3796263
2    2       of  abstract  abstract 0.3158830       of   0.6841170   0.3796263
3    3       of  abstract   animate 0.1395110       of   0.8604890   0.1502544
4    4       of  abstract  abstract 0.3158830       of   0.6841170   0.3796263
5    5       of  abstract  abstract 0.3158830       of   0.6841170   0.3796263
6    6       of   animate   animate 0.6868297        s   0.3131703   1.1610081
plot(ecdf(d$CONTRIBS2LL)); grid()
   abline(h=0.9)

par(mfrow=c(2,3))
with(d, {
   plot(CONTRIBS2LL ~ POSSESSOR)
   plot(CONTRIBS2LL ~ POSSESSED)})
with(d[d$CONTRIBS2LL>1,], {
   plot(CONTRIBS2LL ~ POSSESSOR)
   plot(CONTRIBS2LL ~ POSSESSED)})

Prototypes

qwe <- nd[order(nd$PRED_PP_S),]
qwe %>% head(15)
  POSSESSOR POSSESSED PREDS_LO_S   PRED_PP_S
6  concrete   animate -5.3686107 0.004638981
3  concrete  abstract -4.3220101 0.013099307
9  concrete  concrete -3.3499756 0.033895964
4  abstract   animate -1.8193578 0.139510953
1  abstract  abstract -0.7727572 0.315882975
7  abstract  concrete  0.1992774 0.549655128
5   animate   animate  0.7853392 0.686829682
2   animate  abstract  1.8319398 0.861992645
8   animate  concrete  2.8039743 0.942890210
qwe %>% tail(15)
  POSSESSOR POSSESSED PREDS_LO_S   PRED_PP_S
6  concrete   animate -5.3686107 0.004638981
3  concrete  abstract -4.3220101 0.013099307
9  concrete  concrete -3.3499756 0.033895964
4  abstract   animate -1.8193578 0.139510953
1  abstract  abstract -0.7727572 0.315882975
7  abstract  concrete  0.1992774 0.549655128
5   animate   animate  0.7853392 0.686829682
2   animate  abstract  1.8319398 0.861992645
8   animate  concrete  2.8039743 0.942890210

Model Diagnostics

Amount of data

m <- m_final %>% model.frame %>% model.response %>% length
p <- m_final %>% logLik %>% attr("df")
m > (p*20)
[1] TRUE

Since m is greater than p×15, there are enough data points in the sample, so the model is safe.

Write Up

To determine whether the choice of a genitive construction (of vsn s) varies as a function of the degree/kind of animacy of the possessor and the possessed entity (abstract vs. animate vs. concrete); A generalized linear model selection process was undertaken (using backwards stepwise model selection of all predictors and controls based on significance testing). The final model resulting from the elimination of predictors contained the effects of POSSESSOR and POSSESSED and was highly significant (LR=140.908, df=4, p<0.0001) with a good amount of explanatory/predictive power (McFadden’s R2=0.349, Nagelkerke’s R2=0.511, C=0.851). The results indicate that both the animacy of the possessor and the animacy of the possessed significantly affect the choice of genitive construction, but particularly the animacy of the possessor, as seen by the excursus slope predictions and plotting.