library(DBI)
library(RPostgreSQL)
library(readr)
library(tidyverse)
library(dplyr)
library(lubridate)
library(rpart)
library(rpart.plot)
library(caret)
library(RANN)
library(readxl)
library(mice)
data <- read_excel("Dataset - LBP RA.xlsx", sheet = "Training Dataset") %>%
mutate(Treatment = as.factor(Treatment))%>%
mutate(Age = as.factor(Age))%>%
select(-c('Response_totaal'))
sapply(data, function(x) sum(is.na(x)))
LogReg <- data
LogReg <- LogReg %>% mutate_if(is.numeric, as.factor)
LogReg <- LogReg %>% mutate(Decreased_mobility = as.numeric(Decreased))
str(LogReg)
init = mice(LogReg, maxit=0)
meth = init$method
predM = init$predictorMatrix
predM[, c("Treatment")]=0
meth[c("Earlier_hospitalization", "Age", "Neurogenic_signals", "arm_right_pain_intensity", "Paidwork", "Stress", "Uses_analgesics", "Continuous_pain", "neck_pain_intensity", "leg_left_pain_intensity", "Familiy_history", "Decreased_mobility", "low_back_pain_intensity", "leg_right_pain_intensity", "Sick_leave", "Depression", "Nocturnal_pain", "Failure_symptoms", "arm_left_pain_intensity")]=""
meth[c("Extremely_nervous", "Irrational_thoughts_work", "Weightloss_per_year", "Coping_strategy", "Duration_of_pain", "Relationship_with_colleagues", "Kinesiophobia_physical_exercise", "Irrational_thoughts_risk_lasting", "Kinesiophobia_pain_stop", "working_ability")]="polyreg"
meth[c("Incoordination", "Fever", "Workoverload", "Loss_muscle_strength", "Uses_corticosteroids", "Trauma", "Serious_disease")]="logreg"
view(meth)
set.seed(1003)
imputed = mice(LogReg, method=meth, predictorMatrix=predM, m=5, maxit=24000000)
imputed <- complete(imputed)
При попытке запустить вмененный код = Mouse (...). Я получаю:
переменная iter imp 1 1 Fever Duration_of_painError в nnet.default (X, Y, w, маска = маска, размер = 0, пропуск = TRUE, softmax = TRUE,: слишком много (2400)weights
Как ошибка. Поскольку я относительно новичок в R, я был бы рад, если бы кто-то мог помочь мне с решением этой ошибки