{"action":"opened","issue":{"url":"https://api.github.com/repos/hturner/PlackettLuce/issues/32","repository_url":"https://api.github.com/repos/hturner/PlackettLuce","labels_url":"https://api.github.com/repos/hturner/PlackettLuce/issues/32/labels{/name}","comments_url":"https://api.github.com/repos/hturner/PlackettLuce/issues/32/comments","events_url":"https://api.github.com/repos/hturner/PlackettLuce/issues/32/events","html_url":"https://github.com/hturner/PlackettLuce/issues/32","id":379446204,"node_id":"MDU6SXNzdWUzNzk0NDYyMDQ=","number":32,"title":"predict Deviance not working","user":{"login":"kauedesousa","id":29840771,"node_id":"MDQ6VXNlcjI5ODQwNzcx","avatar_url":"https://avatars0.githubusercontent.com/u/29840771?v=4","gravatar_id":"","url":"https://api.github.com/users/kauedesousa","html_url":"https://github.com/kauedesousa","followers_url":"https://api.github.com/users/kauedesousa/followers","following_url":"https://api.github.com/users/kauedesousa/following{/other_user}","gists_url":"https://api.github.com/users/kauedesousa/gists{/gist_id}","starred_url":"https://api.github.com/users/kauedesousa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kauedesousa/subscriptions","organizations_url":"https://api.github.com/users/kauedesousa/orgs","repos_url":"https://api.github.com/users/kauedesousa/repos","events_url":"https://api.github.com/users/kauedesousa/events{/privacy}","received_events_url":"https://api.github.com/users/kauedesousa/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-11-10T18:12:48Z","updated_at":"2018-11-10T18:12:48Z","closed_at":null,"author_association":"NONE","body":"I figured out that function deviance() return the same result when used with or without the argument newdata. Is that correct? Here a example from \"beans\" data.\r\n\r\n`\r\nlibrary(PlackettLuce)\r\n\r\nexample(\"beans\", package = \"PlackettLuce\")\r\nG <- grouped_rankings(R, rep(seq_len(nrow(beans)), 4))\r\nformula <- as.formula(\"G ~ maxTN\")\r\nd <- cbind(G, beans)\r\n\r\n#split the data into a training and test sample\r\nn <- nrow(d)\r\ns <- sample(1:n, n*0.7)\r\ntrain <- d[s, ]\r\ntest <- d[-s, ]\r\n\r\n#fit the model with training data\r\nmod <- pltree(formula, data = train)\r\n\r\n#predict estimates on test data based on fitted model\r\npredict(mod, newdata = test)\r\n\r\n#the AIC of fitted model\r\nAIC(mod)\r\n\r\n#the AIC predicted using the test data\r\nAIC(mod, newdata = test) #different than value above (prediction is working)\r\n\r\n#the deviance of fitted model\r\ndeviance(mod)\r\n\r\n#the deviance predicted using the test data\r\ndeviance(mod, newdata = test) #same as the value above (prediction not working)\r\n\r\n#Does deviance, when using a test data for prediction, should be like this?: \r\nAIC <- AIC(mod, newdata = test)\r\ndf <- attr(logLik(mod), \"df\")\r\nAIC - (2*df) \r\n`"}}
{"actor":{"display_login":"kauedesousa"}}