0

I am trying to use lme() function for a repeated measure regression (outcome is a continuous variable "asdate_regdate"). First I posted this question for an error that I received after f1 line. The issue was solved and I faced a new error after lme line.

I have 30 variables and 66872 rows of data. I have both categorical and numerical predictors. I have multiple rows of data per patient. "ikn" is the ID variable for each patient. I replaced missing values in the dataset and I only have few missing data in two of the variables and that's why I used na.action=na.omit. When I run the code I received the following error after lme function.

Error: C stack usage 7969204 is too close to the limit.

my code is as follows:

vars1 <- colnames(d.train)[-c(1,30)]

f1 <- as.formula(paste("asdate_regdate~", paste(vars1, collapse= "*")))
f2 <- as.formula(paste("~1|ikn"))

library(nlme)
model <- lme(f1, random=f2, data=d.train, method="ML", na.action=na.omit)

please find colnames(d.train) as follow:

  [1] "ikn"                                         
  [2] "charlson"                                           
  [3] "sex"                                                
  [4] "age"                                                
  [5] "incquint"                                           
  [6] "rural"                                              
  [7] "death"                                              
  [8] "Tired"                                              
  [9] "Nausea"                                             
 [10] "Depression"                                         
 [11] "Anxious"                                            
 [12] "Drowsy"                                             
 [13] "Appetite"                                           
 [14] "Wellbeing"                                          
 [15] "ShortBreath"                                        
 [16] "Pain"                                               
 [17] "triage"                                             
 [18] "daysInpatient_cihi"                                 
 [19] "hcd_count_in30days"                                 
 [20] "hcd_count_before30days"                             
 [21] "hcd_nursing"                                        
 [22] "hcd_personal"                                       
 [23] "hcd_else"                                                  
 [24] "ohip_count_in30days"                                
 [25] "palliative.care.codes_count_in30days"               
 [26] "house.calls.codes_count_in30days"                   
 [27] "Acodes_count_in30days"                              
 [28] "Wcodes_count_in30days" 
 [29] "cancertype"
 [30] "asdate_regdate"
Mahsa
  • 531
  • 1
  • 5
  • 9
  • If you really want specific help you need to make a [reproducible example](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example). We don't need your real data, but at the very least we need the values of `vars1` and `vars2`. Did you explicitly change the column names at any point? Are you sure all the column names are valid "names" (see `?make.names` help page) – MrFlick Jun 10 '15 at 15:59
  • yes I changed the column names and that's what I did before as well. everything is same as before. I don't have access to internet with the system that I am working with. So, I am trying to find a way to share the vars1 and vars2 with you. vars1 and vars2 are prettymuch the same. vars2 only has few less variables. – Mahsa Jun 10 '15 at 16:22
  • I added vars1 to the post. – Mahsa Jun 10 '15 at 18:25
  • Values like "incode_nacrs_c: 3JY" are not proper names in R and shouldn't be allowed as column names for data.frames. They can not be used in formulae. You can make them proper names with `colnames(d)<-make.names(colnames(d))` – MrFlick Jun 10 '15 at 18:28
  • I changed the names as you suggested but I still get the same error. – Mahsa Jun 10 '15 at 18:37
  • Did you do that for all the data frames? We still need a reproducible example. Try to share the dput of vars1 (see the link I originally posted for reproducibility). I can't easily test with that you shared – MrFlick Jun 10 '15 at 18:40
  • I closed R and run the code once again from the first and I applied your suggestion and everything work well. Thanks a lot for your help :) – Mahsa Jun 10 '15 at 18:54

0 Answers0