Displaying 6 results from an estimated 6 matches for "fitglm".
2011 Oct 28
4
Contrasts with an interaction. How does one specify the dummy variables for the interaction
...ou,
John
library(contrast)
# Create 2x2 contingency table.
counts=c(50,50,30,70)
row <- gl(2,2,4)
column <- gl(2,1,4)
mydata <- data.frame(row,column,counts)
print(mydata)
# Show levels of 2x2 table
levels(mydata$row)
levels(mydata$column)
# Models, no interaction, and interaction
fitglm0 <- glm(counts ~ row + column, family=poisson(link="log"))
fitglm <- glm(counts ~ row + column + row*column, family=poisson(link="log"))
# Contrasts for model without interaction works fine!
anova(fitglm0)
summary(fitglm0)
con0<-contrast(fitglm0,list(row=...
2012 Oct 25
2
How to extract auc, specificity and sensitivity
I am running my code in a loop and it does not work but when I run it
outside the loop I get the values I want.
n <- 1000; # Sample size
fitglm <- function(sigma,tau){
x <- rnorm(n,0,sigma)
intercept <- 0
beta <- 0
ystar <- intercept+beta*x
z <- rbinom(n,1,plogis(ystar))
xerr <- x + rnorm(n,0,tau)
model<-glm(z ~ xerr, family=binomial(logit))
int<-coef(model)[1]
slope<-coef(m...
2012 Oct 20
1
Logistic regression/Cut point? predict ??
...new to R and I am trying to do a monte carlo simulation where I
generate data and interject error then test various cut points; however, my
output was garbage (at x equal zero, I did not get .50)
I am basically testing the performance of classifiers.
Here is the code:
n <- 1000; # Sample size
fitglm <- function(sigma,tau){
x <- rnorm(n,0,sigma)
intercept <- 0
beta <- 5
* ystar <- intercept+beta*x*
* z <- rbinom(n,1,plogis(ystar))* *# I believe plogis accepts the a
+bx augments and return the e^x/(1+e^x) which is then used to generate 0
and 1 data*
x...
2012 Oct 26
0
Problems getting slope and intercept to change when do multiple reps.
library(ROCR)
n <- 1000
fitglm <- function(iteration,intercept,sigma,tau,beta){
x <- rnorm(n,0,sigma)
ystar <- intercept+beta*x
z <- rbinom(n,1,plogis(ystar))
xerr <- x + rnorm(n,0,tau)
model<-glm(z ~ xerr, family=binomial(logit))
*int*<-coef(model)[1]
*slope*<-coef(model)[2] # when add error you...
2011 Oct 28
2
Thank you
Dear r-community,
Today I have completed my PhD. I would like to take this opportunity to thank the r-community for helping me with the r-coding. I use r to do data manipulation during my PhD and I benefit a lot through the discussion in the r-forum.
I will continue using R and help the others too.
Thank you so much.
Regards,
Roslina
UniSA.
[[alternative HTML version deleted]]
2008 Dec 09
1
glm error message when using family Gamma(link="inverse")
...windows XP
I am getting an error from glm() that I don't understand. Any help or suggestions would be appreciated. N.B. 1<=AAMTCAREJ<=327900
> summary(data$AAMTCAREJ)
Min. 1st Qu. Median Mean 3rd Qu. Max.
1.0 404.3 1430.0 6567.0 5457.0 327900.0
> fitglm<-glm(AAMTCAREJ~sexcat+H_AGE+SmokeCat+InsuranceCat+MedicadeCat+
+ incomegrp+racecat+MARSTATJS+EdCat+bmiNewjohn,data=data,family=Gamma(link = "inverse"))
Error: no valid set of coefficients has been found: please supply starting values
In addition: Warning message:
NaNs produced in: log(...