search for: cutyhat

Displaying 7 results from an estimated 7 matches for "cutyhat".

2008 Sep 16
2
Hosmer- Lemeshow test
...at the following URL        http://www.stat.sc.edu/~hitchcock/diseaseoutbreakdata.txt The R code as mentioned therein is #### # A function to do the Hosmer-Lemeshow test in R. # R Function is due to Peter D. M. Macdonald, McMaster University. # hosmerlem <- function (y, yhat, g = 10) { cutyhat <- cut(yhat, breaks = quantile(yhat, probs = seq(0, 1, 1/g)), include.lowest = T) obs <- xtabs(cbind(1 - y, y) ~ cutyhat) expect <- xtabs(cbind(1 - yhat, yhat) ~ cutyhat) chisq <- sum((obs - expect)^2/expect) P <- 1 - pchisq(chisq, g - 2) c("X^2&quot...
2008 Nov 07
1
two kind of Hosmer and Lemeshow’s test
...n the fixed and pre-determined cut-off points of the estimated probability of success. One of them is calculated based on the percentiles of estimated probabilities. In the previous post,i find that the Hosmer and Lemeshow?s test how to use in R. hosmerlem <- function (y, yhat, g = 10) { cutyhat <- cut(x, breaks = quantile(yhat, probs = seq(0, 1, 1/g)), include.lowest = T) obs <- xtabs(cbind(1 - y, y) ~ cutyhat) expect <- xtabs(cbind(1 - yhat, yhat) ~ cutyhat) chisq <- sum((obs - expect)^2/expect) P <- 1 - pchisq(chisq, g - 2) c("X^2" =...
2011 May 08
1
Hosmer-Lemeshow 'goodness of fit'
...emeshow 'goodness-of-fit' test cd.full_model = glm(formula = Collaterals ~ CHF + Age + CABG + relevel (as.factor (num.obst.vessels),"one") + Current.smoker + DM + HTN + ace.inhibitor + MI, family = binomial(link = "logit")) hosmerlem = function(y, yhat, g=10) { cutyhat = cut(yhat, breaks = quantile(yhat, probs=seq(0, 1, 1/g)), include.lowest=TRUE) obs = xtabs(cbind(1 - y, y) ~ cutyhat) expect = xtabs(cbind(1 - yhat, yhat) ~ cutyhat) chisq = sum((obs - expect)^2/expect) P = 1 - pchisq(chisq, g - 2) return(list(chisq=chisq,p.value=P)) } hosme...
2013 Apr 23
1
Hosmer Lemeshow test
...he right kind of object stopifnot(family(obj)$family=="binomial" && family(obj)$link=="logit") y = obj$model[[1]] # the double bracket (above) gets the index of items within an object if (is.factor(y)) y = as.numeric(y)==2 yhat = obj$fitted.values cutyhat=cut(yhat,quantile(yhat,0:g/g),include.lowest=TRUE) obs = xtabs(cbind(1 - y, y) ~ cutyhat) expect = xtabs(cbind(1 - yhat, yhat) ~ cutyhat) if (any(expect < 5)) # warning("Some expected counts are less than 5. Use smaller number of groups") chisq = sum((obs - expect)^2/...
2010 Jul 07
1
Different goodness of fit tests leads to contradictory conclusions
...F))   > # Option 1: Hosmer-Lemeshow test > mod.fit <- glm(formula = no.NA$repcnd ~  no.NA$svl, family = binomial(link = logit), data =  no.NA, na.action = na.exclude, control = list(epsilon = 0.0001, maxit = 50, trace = F))                >  hosmerlem <- function (y, yhat, g = 10) { cutyhat <- cut(yhat, breaks = quantile(yhat, probs = seq(0, 1, 1/g)), include.lowest = T) obs <- xtabs(cbind(1 - y, y) ~ cutyhat) expect <- xtabs(cbind(1 - yhat, yhat) ~ cutyhat) chisq <- sum((obs - expect)^2/expect) P <- 1 - pchisq(chisq, g - 2) c("X^2" = chisq, Df = g - 2, "...
2010 Jul 09
1
Appropriate tests for logistic regression with a continuous predictor variable and Bernoulli response variable
...85.04  on 216  degrees of freedom   (8 observations deleted due to missingness) AIC: 289.04   Number of Fisher Scoring iterations: 3 ------------------------------------------------------------------------------- > Hosmer-Lemeshow test > > hosmerlem <- function (y, yhat, g = 10) + { + cutyhat <- cut(yhat, breaks = quantile(yhat, probs = seq(0, 1, 1/g)), include.lowest = T) + obs <- xtabs(cbind(1 - y, y) ~ cutyhat) + expect <- xtabs(cbind(1 - yhat, yhat) ~ cutyhat) +  chisq <- sum((obs - expect)^2/expect) + P <- 1 - pchisq(chisq, g - 2) + c("X^2" = chisq, Df = g...
2013 Apr 14
5
Logistic regression
I have a data set to be analyzed using to binary logistic regression. The data set is iin grouped form. My question is: how I can compute Hosmer-Lemeshow test and measures like sensitivity and specificity? Any suggestion will be greatly appreciated. Thank you Endy [[alternative HTML version deleted]]