简体   繁体   中英

How to glm on a linear model?

null <- glm(Status ~ Idade, family = "binomial", data = train_data)

Error in model.frame.default(formula = Status ~ Age, data = train_data, : variable lengths differ (found for 'Age')

When I run glm I get no errors. All the variables are in a single dataset and there are no missing values. I divided de file in:

dim(train_data)
dim(test_data)

The error only occurs when i use the train_data and the test_data . When I use the whole file, I don't have errors.

How do I solve the problem?

Did you use anything like

attach(data)

If so, your response Status would be based on the full dataset.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM