[R] How to calculate the "McFadden R-square" for LOGIT model?

Christofer Bogaso bogaso.christofer at gmail.com
Thu Apr 12 13:26:31 CEST 2012


Dear all, can somebody please help me how to calculate "McFadden
R-square" for a LOGIT model? Corresponding definition can be found
here:

http://publib.boulder.ibm.com/infocenter/spssstat/v20r0m0/index.jsp?topic=%2Fcom.ibm.spss.statistics.help%2Falg_plum_statistics_rsq_mcfadden.htm


Here is my data:

Data <- structure(c(1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1,
0, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1,
0, 1, 1, 0, 1, 0, 47, 58, 82, 100, 222, 164, 161, 70, 219, 81,
209, 182, 185, 104, 126, 192, 95, 245, 97, 177, 125, 56, 85,
199, 298, 145, 78, 144, 178, 146, 132, 98, 120, 148, 123, 282,
79, 34, 104, 91, 199, 101, 109, 117, 1.1, 0.92, 1.72, 2.18, 1.75,
2.26, 2.07, 1.43, 1.92, 1.82, 2.34, 2.12, 1.81, 1.35, 1.26, 2.07,
2.04, 1.55, 1.89, 1.68, 0.76, 1.96, 1.29, 1.81, 1.72, 2.39, 1.68,
2.29, 2.34, 2.21, 1.42, 1.97, 2.12, 1.9, 1.15, 1.7, 1.24, 1.55,
2.04, 1.59, 2.07, 2, 1.84, 2.04, 51.2, 48.5, 50.8, 54.4, 52.4,
56.7, 54.6, 52.7, 52.3, 53, 55.4, 53.5, 51.6, 48.5, 49.3, 53.9,
55.7, 51.2, 54, 52.2, 51.1, 54, 55, 52.9, 53.7, 55.8, 50.4, 58.8,
54.5, 53.5, 48.8, 54.5, 52.1, 56, 56.2, 53.3, 50.9, 53.2, 51.7,
54.3, 53.7, 54.7, 47, 56.9, 0.321, 0.224, 0.127, 0.063, 0.021,
0.027, 0.139, 0.218, 0.008, 0.012, 0.076, 0.299, 0.04, 0.069,
0.33, 0.017, 0.166, 0.003, 0.01, 0.076, 0.454, 0.032, 0.266,
0.018, 0.038, 0.067, 0.075, 0.064, 0.065, 0.065, 0.09, 0.016,
0.061, 0.019, 0.389, 0.037, 0.161, 0.127, 0.017, 0.222, 0.026,
0.012, 0.057, 0.022, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1,
1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1,
0, 1, 1, 0, 1, 0, 0, 1, 0), .Dim = c(44L, 6L), .Dimnames = list(
    c("Obs 1", "Obs 2", "Obs 3", "Obs 4", "Obs 5", "Obs 6", "Obs 7",
    "Obs 8", "Obs 9", "Obs 10", "Obs 11", "Obs 12", "Obs 13",
    "Obs 14", "Obs 15", "Obs 16", "Obs 17", "Obs 18", "Obs 19",
    "Obs 20", "Obs 21", "Obs 22", "Obs 23", "Obs 24", "Obs 25",
    "Obs 26", "Obs 27", "Obs 28", "Obs 29", "Obs 30", "Obs 31",
    "Obs 32", "Obs 33", "Obs 34", "Obs 35", "Obs 36", "Obs 37",
    "Obs 38", "Obs 39", "Obs 40", "Obs 41", "Obs 42", "Obs 43",
    "Obs 44"), c("Y", "X 1", "X 2", "X 3", "X 4", "X 5")))


AND, my model is:

glm(Data[,1] ~ Data[,-1], binomial(link = logit))

Thanks,



More information about the R-help mailing list