Attachment 'walpiri.R'

Download

   1 data(warlpiri, package="languageR")
   2 
   3 ##--------------------------------------------
   4 # This data set documents the use of ergative 
   5 # case marking in the narratives of native speakers 
   6 # of Lajamanu Warlpiri (8 children, 13 adults) 
   7 # describing events in picture books. 
   8 #
   9 # O'Shannessy, C. (2006) Language contact and 
  10 # child bilingual acquisition: Learning a mixed 
  11 # language and Warlpiri in northern Australia, 
  12 # PhD Thesis, University of Sydney, Australia. 
  13 ##--------------------------------------------
  14 
  15 help(warlpiri, package="languageR")
  16 str(warlpiri)
  17 attach(warlpiri)
  18 
  19 ## this is an unbalanced data set, so we have to
  20 #  be especially carefully to test for collinearity
  21 #  (b/c it's basically bound to be present)
  22 ##
  23 levels(Speaker)
  24 table(Speaker)
  25 
  26 # word order and case marking is also distributed
  27 # heterogeneously 
  28 summary(warlpiri)
  29 
  30 ##--------------------------------------------
  31 # understanding the data
  32 ##--------------------------------------------
  33 plot(WordOrder, AnimacyOfSubject)
  34 plot(WordOrder, AnimacyOfObject)
  35 plot(WordOrder, OvertnessOfObject)
  36 
  37 plot(OvertnessOfObject, WordOrder)
  38 
  39 
  40 ##--------------------------------------------
  41 # Let's have a look at the predictors 
  42 ##--------------------------------------------
  43 library(languageR)
  44 library(rpart)
  45 w.rp = rpart(WordOrder ~ ., data = warlpiri[ , -c(1,2,5,9)])
  46 w.rp
  47 plotcp(w.rp)
  48 
  49 w.pruned = prune(w.rp, cp = 0.021)
  50 plot(w.pruned, margin = 0.1, compress = FALSE)
  51 text(w.pruned, use.n = TRUE, pretty = 0, cex=0.8, fancy=F)
  52 
  53 ##--------------------------------------------
  54 # lrm() in Design is a convenient interface for 
  55 # logistic regression (also glm())
  56 ##--------------------------------------------
  57 library(Design)
  58 wo.lr <- lrm(WordOrder ~ AnimacyOfSubject + AnimacyOfObject + OvertnessOfObject)
  59 vif(wo.lr)
  60 
  61 # non-sequential test of factor impacts
  62 anova(wo.lr)
  63 
  64 ##---------------------------------------------
  65 # plotting ... just like for ols
  66 # (both are Design functions)
  67 ##---------------------------------------------
  68 wo.dd <- datadist(warlpiri)
  69 options(datadist = 'wo.dd')
  70 
  71 # To plot all predicted effects on one panel
  72 # we need to set the graphics parameter par().
  73 # To avoid the cumbersome syntax, let's define
  74 # a function as shortcut.
  75 multiplot <- function (x,y, ...) { par(mfrow=c(x,y), ...) }  
  76 multiplot(2,3, lwd=2, cex=1.2)
  77 plot(wo.lr, adj.subtitle=F)
  78 plot(wo.lr, adj.subtitle=F, fun=plogis, ylim=c(.1,.6))
  79 
  80 
  81 ##---------------------------------------------
  82 # adding an interaction ... just as for ols(), lm(), etc.
  83 ##---------------------------------------------
  84 wo.case.lr <- lrm(WordOrder ~ CaseMarking * (AnimacyOfSubject + AnimacyOfObject + OvertnessOfObject))
  85 wo.case.lr
  86 
  87 # anova() creates separate summaries for interactions
  88 # non-linearities, etc. ... just as for ols()
  89 
  90 ##--------------------------------------------
  91 # how could we test the predictions of harmonic
  92 # alignment/obviation theories (word order should
  93 # be affected, if the patient OUTRANKS the agent
  94 # in terms of saliency, e.g. animacy)
  95 ##--------------------------------------------
  96 wo.int.lr <- lrm(WordOrder ~ AnimacyOfSubject * AnimacyOfObject + OvertnessOfObject)
  97 wo.int.lr
  98 anova(wo.int.lr)
  99 
 100 OSoutrank <- ifelse(AnimacyOfSubject == "inanimate" & AnimacyOfObject != "inanimate", 1, 0)
 101 wo.i.lr <- lrm(WordOrder ~ OSoutrank + OvertnessOfObject)
 102 wo.i.lr
 103 
 104 # what would you decide? 
 105 # 1) pro "animacy of object only matters"
 106 # 2) pro "harmonic alignment theories"

Attached Files

To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.
  • [get | view] (2021-04-22 12:55:33, 491.2 KB) [[attachment:BaayenETAL06.pdf]]
  • [get | view] (2021-04-22 12:55:33, 208.5 KB) [[attachment:case-influence.ppt]]
  • [get | view] (2021-04-22 12:55:33, 8.7 KB) [[attachment:lexdecRT.R]]
  • [get | view] (2021-04-22 12:55:33, 3.4 KB) [[attachment:walpiri.R]]
 All files | Selected Files: delete move to page copy to page

You are not allowed to attach a file to this page.

MoinMoin Appliance - Powered by TurnKey Linux