Displaying 2 results from an estimated 2 matches for "testlogdata".
Did you mean:
testingdata
2009 Aug 05
1
Question with apply function
In my continuing quest to generate some summary data, I've come across
some useful suggestions in pasts posts.
The apply operation returns an error, and I can't figure out why.
Can someone help me fix this?
testlogdata <- cbind(testlogdata, range_group=cut(testlogdata$lrm_score,
breaks=c(.9, .8, .7, .6, .5, .4, .3, .2, .1)))
apply(testlogdata, 2, function(x){tapply(x,
list(testlogdata$range_group), mean)})
From my understanding, this should generate a nice table with rows for
each "break" and a...
2009 Aug 25
1
Clogit or LRM?
...S.E. Wald Z P
Intercept 1.8065 0.05137 35.16 0
val1 0.8105 0.02567 31.57 0
val2 0.5218 0.04308 12.11 0
2) I then calculate a conditional logit:
testdata$log_int <- exp( model$coefficients[2] * model$val1 +
model$coefficients[3] * model$val2)
for(race in testdata$races){
testlogdata$c_prob[testdata$code== race] <-
testdata$log_int[testdata$race== race] /
sum(testdata$log_int[testlogdata$race == race])
}
---------------------------------------------------
Do you have any idea why this might be happening? Did I miss something
in my calculation?
Additionally, please noti...