我想要給予給定數據集glm,但summary(model1)
沒有給我正確的輸出,它沒有給出Estimate Std. Error z value Pr(>|z|)
等的係數值,它只是給我NA
作爲輸出個體屬性元素。glm總結不給係數值
TEXT <- c('Learned a new concept today : metamorphic testing. t.co/0is1IUs3aW','BMC Bioinformatics BioMed Central: Detecting novel ncRNAs by experimental #RNomics is not an easy task... http:/t.co/ui3Unxpx #bing @MyEN','BMC Bioinformatics BioMed Central: small #RNA with a regulatory function as a scientific ... Detecting novel… http:/t.co/wWHOEkR0vC#bing','True or false? link(#Addition, #Classification) http:/t.co/zMJuTFt8iq #Oxytocin','Biologists do have a sense of humor, especially computational bio people http:/t.co/wFZqaaFy')
NAME <- c('QSoft Consulting','Fabrice Leclerc','Sungsam Gong','Frederic','Zach Stednick')
SCREEN_NAME <-c ('QSoftConsulting','rnomics','sunggong','rnomics','jdwasmuth')
FOLLOWERS_COUNT <- c(734,1900,234,266,788)
RETWEET <- c(1,3,5,0,2)
FRIENDS_COUNT <-c(34,532,77,213,422)
STATUSES_COUNT <- c(234,643,899,222,226)
FAVOURITES_COUNT <- c(144,2677,445,930,254)
df <- data.frame(TEXT,NAME,SCREEN_NAME,RETWEET,FRIENDS_COUNT,STATUSES_COUNT,FAVOURITES_COUNT)
mydata<-df
mydata$FAVOURITES_COUNT <- ifelse(mydata$FAVOURITES_COUNT >= 445, 1, 0) #converting fav_count to binary values
拆分數據
library(caret)
split=0.60
trainIndex <- createDataPartition(mydata$FAVOURITES_COUNT, p=split, list=FALSE)
data_train <- mydata[ trainIndex,]
data_test <- mydata[-trainIndex,]
GLM模型
library(e1071)
model1 <- glm(FAVOURITES_COUNT~.,family = binomial, data = data_train)
summary(model1)
我想作進一步的分析的p值到目前爲止,我認爲我的代碼是正確的,我怎麼能得到正確的輸出?
嘗試使用CrossValidated來代替:http://stats.stackexchange.com – noumenal
您是否將因變量as.factor()'分解了? – noumenal
確定。不,除了我剛剛發佈的代碼外,我沒有做任何事情。爲什麼我們應該使用as.factor()作爲名義變量? – hyeri