Skip to main content
added 51 characters in body
Source Link
kjetil b halvorsen
  • 82.8k
  • 32
  • 201
  • 663
df <- structure(c(20, 94, 84, 17, 68, 7, 119, 26, 5, 16, 29, 14, 15, 
10, 54, 14), .Dim = c(4L, 4L), .Dimnames = list(c("Black", "Blond", 
"Brunette", "Red"), c("Blue", "Brown", "Green", "Hazel")))

df

         Blue Brown Green Hazel
Black      20    68     5    15
Blond      94     7    16    10
Brunette   84   119    29    54
Red        17    26    14    14
    df <- structure(c(20, 94, 84, 17, 68, 7, 119, 26, 5, 16, 29, 
                      14, 15, 10, 54, 14), .Dim = c(4L, 4L), 
    .Dimnames = list(c("Black", "Blond", 
    "Brunette", "Red"), c("Blue", "Brown", "Green", "Hazel")))

    df
    
             Blue Brown Green Hazel
    Black      20    68     5    15
    Blond      94     7    16    10
    Brunette   84   119    29    54
    Red        17    26    14    14
vcd::assocstats(df)
                    X^2 df P(> X^2)
Likelihood Ratio 146.44  9        0
Pearson          138.29  9        0

Phi-Coefficient   : 0.483 
Contingency Coeff.: 0.435 
Cramer's V        : 0.279
    vcd::assocstats(df)
                        X^2 df P(> X^2)
    Likelihood Ratio 146.44  9        0
    Pearson          138.29  9        0
    
    Phi-Coefficient   : 0.483 
    Contingency Coeff.: 0.435 
    Cramer's V        : 0.279
# prepare to get Krushkes' R codes from his web site
Krushkes_codes <- c(
  "http://www.indiana.edu/~kruschke/DoingBayesianDataAnalysis/Programs/openGraphSaveGraph.R", 
  "http://www.indiana.edu/~kruschke/DoingBayesianDataAnalysis/Programs/PoissonExponentialJagsSTZ.R")

# download Krushkes' scripts to working directory
lapply(Krushkes_codes, function(i) download.file(i, destfile = basename(i)))

# run the code to analyse the data and generate output
lapply(Krushkes_codes, function(i) source(basename(i)))
    # prepare to get Krushkes' R codes from his web site
    Krushkes_codes <- c(
      "http://www.indiana.edu/~kruschke/DoingBayesianDataAnalysis/Programs/openGraphSaveGraph.R", 
      "http://www.indiana.edu/~kruschke/DoingBayesianDataAnalysis/Programs/PoissonExponentialJagsSTZ.R")
    
    # download Krushkes' scripts to working directory
    lapply(Krushkes_codes, function(i) download.file(i, destfile = basename(i)))
    
    # run the code to analyse the data and generate output
    lapply(Krushkes_codes, function(i) source(basename(i)))
df <- structure(c(20, 94, 84, 17, 68, 7, 119, 26, 5, 16, 29, 14, 15, 
10, 54, 14), .Dim = c(4L, 4L), .Dimnames = list(c("Black", "Blond", 
"Brunette", "Red"), c("Blue", "Brown", "Green", "Hazel")))

df

         Blue Brown Green Hazel
Black      20    68     5    15
Blond      94     7    16    10
Brunette   84   119    29    54
Red        17    26    14    14
vcd::assocstats(df)
                    X^2 df P(> X^2)
Likelihood Ratio 146.44  9        0
Pearson          138.29  9        0

Phi-Coefficient   : 0.483 
Contingency Coeff.: 0.435 
Cramer's V        : 0.279
# prepare to get Krushkes' R codes from his web site
Krushkes_codes <- c(
  "http://www.indiana.edu/~kruschke/DoingBayesianDataAnalysis/Programs/openGraphSaveGraph.R", 
  "http://www.indiana.edu/~kruschke/DoingBayesianDataAnalysis/Programs/PoissonExponentialJagsSTZ.R")

# download Krushkes' scripts to working directory
lapply(Krushkes_codes, function(i) download.file(i, destfile = basename(i)))

# run the code to analyse the data and generate output
lapply(Krushkes_codes, function(i) source(basename(i)))
    df <- structure(c(20, 94, 84, 17, 68, 7, 119, 26, 5, 16, 29, 
                      14, 15, 10, 54, 14), .Dim = c(4L, 4L), 
    .Dimnames = list(c("Black", "Blond", 
    "Brunette", "Red"), c("Blue", "Brown", "Green", "Hazel")))

    df
    
             Blue Brown Green Hazel
    Black      20    68     5    15
    Blond      94     7    16    10
    Brunette   84   119    29    54
    Red        17    26    14    14
    vcd::assocstats(df)
                        X^2 df P(> X^2)
    Likelihood Ratio 146.44  9        0
    Pearson          138.29  9        0
    
    Phi-Coefficient   : 0.483 
    Contingency Coeff.: 0.435 
    Cramer's V        : 0.279
    # prepare to get Krushkes' R codes from his web site
    Krushkes_codes <- c(
      "http://www.indiana.edu/~kruschke/DoingBayesianDataAnalysis/Programs/openGraphSaveGraph.R", 
      "http://www.indiana.edu/~kruschke/DoingBayesianDataAnalysis/Programs/PoissonExponentialJagsSTZ.R")
    
    # download Krushkes' scripts to working directory
    lapply(Krushkes_codes, function(i) download.file(i, destfile = basename(i)))
    
    # run the code to analyse the data and generate output
    lapply(Krushkes_codes, function(i) source(basename(i)))
Notice removed Improve details by CommunityBot
Bounty Ended with no winning answer by CommunityBot
Notice added Improve details by Ben
Bounty Started worth 300 reputation by Ben
Notice removed Authoritative reference needed by CommunityBot
Bounty Ended with no winning answer by CommunityBot
Tweeted twitter.com/#!/StackStats/status/447552998294945792
Notice added Authoritative reference needed by Ben
Bounty Started worth 100 reputation by Ben
added 10 characters in body
Source Link
Ben
  • 769
  • 9
  • 24
# prepare to get Krushkes'_codes'sKrushkes' R codes from his web site
Krushkes_codes <- c(
  "http://www.indiana.edu/~kruschke/DoingBayesianDataAnalysis/Programs/openGraphSaveGraph.R", 
  "http://www.indiana.edu/~kruschke/DoingBayesianDataAnalysis/Programs/PoissonExponentialJagsSTZ.R")

# download Krushkes' scripts to working directory
lapply(Krushkes_codes, function(i) download.file(i, destfile = basename(i)))

# run the code to analyse the data and generate output
lapply(Krushkes_codes, function(i) source(basename(i)))
# prepare to get Krushkes'_codes's R codes
Krushkes_codes <- c(
  "http://www.indiana.edu/~kruschke/DoingBayesianDataAnalysis/Programs/openGraphSaveGraph.R", 
  "http://www.indiana.edu/~kruschke/DoingBayesianDataAnalysis/Programs/PoissonExponentialJagsSTZ.R")

# download Krushkes' scripts to working directory
lapply(Krushkes_codes, function(i) download.file(i, destfile = basename(i)))

# run the code to analyse the data and generate output
lapply(Krushkes_codes, function(i) source(basename(i)))
# prepare to get Krushkes' R codes from his web site
Krushkes_codes <- c(
  "http://www.indiana.edu/~kruschke/DoingBayesianDataAnalysis/Programs/openGraphSaveGraph.R", 
  "http://www.indiana.edu/~kruschke/DoingBayesianDataAnalysis/Programs/PoissonExponentialJagsSTZ.R")

# download Krushkes' scripts to working directory
lapply(Krushkes_codes, function(i) download.file(i, destfile = basename(i)))

# run the code to analyse the data and generate output
lapply(Krushkes_codes, function(i) source(basename(i)))
added 8 characters in body
Source Link
Ben
  • 769
  • 9
  • 24

Here's the self-contained example from the book (coded in R), just in case the answer is hidden from me in plain sight...

Here's the self-contained example from the book (coded in R), just in case the answer is hidden in plain sight...

Here's the self-contained example from the book (coded in R), just in case the answer is hidden from me in plain sight...

Source Link
Ben
  • 769
  • 9
  • 24
Loading