I'm running a script that performs automated backwards selection on glmer models. The script runs sequential drop1() commands, automatically removing the predictor with the highest p-value after each step. It's very time-consuming so I want to leave it to run overnight, but R stops running when I leave the computer.
I'm running R 3.1.1 in Snow Leopard. I have already set the System Preferences to prevent the computer from sleeping, and I am also preventing sleep by running "pmset noidle" in Terminal. Despite all this, when I leave my script to run, it silently pauses about 45 minutes after my last activity (in any application), and silently resumes when I start using the computer again in the morning. I can tell approximately when the script is active because it periodically prints timestamps. I've pasted an example fragment of the output at the bottom of this post (mostly so folks can see the timestamps). I recognize that I'm getting some warnings related to the model fitting, but I'm pretty sure these are not causing the 7.5-hour delay!
Has this happened to anyone else? Any suggestions for how to keep my script running while I'm away from the computer? I'm new to the site, so please let me know what additional info I can provide.
[1] "Wed Feb 25 21:31:59 2015"
Single term deletions
Model:
Pref ~ Nut * Subfamily + Nut * Sex + Subfamily * Sex + DrinkDur +
TrialTime + holdDur + FeedOrder + (1 | SpCode/Indiv)
Df AIC LRT Pr(Chi)
<none> 809.07
DrinkDur 1 810.77 3.703 0.05433 .
TrialTime 1 807.06 -0.011 1.00000
holdDur 1 807.37 0.306 0.58036
FeedOrder 1 810.24 3.172 0.07490 .
Nut:Subfamily 32 820.47 75.404 2.315e-05 ***
Nut:Sex 4 843.44 42.375 1.395e-08 ***
Subfamily:Sex 8 809.06 15.995 0.04245 *
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
[1] "Now dropping TrialTime"
[1] "Wed Feb 25 22:39:51 2015"
Single term deletions
Model:
Pref ~ Nut + Subfamily + Sex + DrinkDur + holdDur + FeedOrder +
(1 | SpCode/Indiv) + Nut:Subfamily + Nut:Sex + Subfamily:Sex
Df AIC LRT Pr(Chi)
<none> 807.06
DrinkDur 1 808.72 3.665 0.05556 .
holdDur 1 805.33 0.276 0.59950
FeedOrder 1 808.19 3.134 0.07667 .
Nut:Subfamily 32 818.18 75.125 2.523e-05 ***
Nut:Sex 4 841.42 42.360 1.405e-08 ***
Subfamily:Sex 8 807.18 16.125 0.04062 *
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
[1] "Now dropping holdDur"
[1] "Thu Feb 26 00:39:02 2015"
Single term deletions
Model:
Pref ~ Nut + Subfamily + Sex + DrinkDur + FeedOrder + (1 | SpCode/Indiv) +
Nut:Subfamily + Nut:Sex + Subfamily:Sex
Df AIC LRT Pr(Chi)
<none> 805.33
DrinkDur 1 806.85 3.519 0.06066 .
FeedOrder 1 806.47 3.134 0.07667 .
Nut:Subfamily 32 816.48 75.144 2.508e-05 ***
Nut:Sex 4 839.69 42.357 1.407e-08 ***
Subfamily:Sex 8 805.55 16.220 0.03934 *
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
[1] "Now dropping FeedOrder"
[1] "Thu Feb 26 08:04:21 2015"
There were 50 or more warnings (use warnings() to see the first 50)
Single term deletions
Model:
Pref ~ Nut + Subfamily + Sex + DrinkDur + (1 | SpCode/Indiv) +
Nut:Subfamily + Nut:Sex + Subfamily:Sex
Df AIC LRT Pr(Chi)
<none> 806.47
DrinkDur 1 808.10 3.636 0.05655 .
Nut:Subfamily 32 819.11 76.647 1.574e-05 ***
Nut:Sex 4 840.14 41.678 1.945e-08 ***
Subfamily:Sex 8 806.69 16.222 0.03931 *
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
[1] "Now dropping DrinkDur"
[1] "Thu Feb 26 09:48:59 2015"
Single term deletions
Model:
Pref ~ Nut + Subfamily + Sex + (1 | SpCode/Indiv) + Nut:Subfamily +
Nut:Sex + Subfamily:Sex
Df AIC LRT Pr(Chi)
<none> 808.10
Nut:Subfamily 32 821.02 76.918 1.446e-05 ***
Nut:Sex 4 842.05 41.944 1.713e-08 ***
Subfamily:Sex 8 807.25 15.147 0.05635 .
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
[1] "Now dropping Subfamily:Sex"
[1] "Thu Feb 26 10:02:58 2015"
Single term deletions
Model:
Pref ~ Nut + Subfamily + Sex + (1 | SpCode/Indiv) + Nut:Subfamily +
Nut:Sex
Df AIC LRT Pr(Chi)
<none> 807.25
Nut:Subfamily 32 829.94 86.695 6.160e-07 ***
Nut:Sex 4 849.83 50.576 2.737e-10 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Unless you are running the RStudio server on your laptop, the session should continue running even if log out or close your laptop.
No, putting the laptop to sleep won't continue the download. Sleep is a state in which your current work is saved but no process is running.
To run the entire document press the Ctrl+Shift+Enter key (or use the Source toolbar button).
In RStudio, select "New Script" from the "File" menu. You'll now see a "Script" panel appear. Try typing a command into this panel and then press the "Run" button shown below. You should see the results of running the script appear in the console panel.
I'm not sure why you're having this problem, given the options that you've used to prevent the computer from going to sleep (did you also disable the screensaver?).
Let's just work around the problem instead of trying to figure out why your computer is entering a sleep or idle state despite your attempts to prevent this with settings.
Here's what you should do:
screen
to enable the multiplexing screen program, which is useful for persistence (used mainly when connecting remotely to Linux servers, but also useful here)/usr/bin/Rscript "/Users/usr/Documents/longscript.R"
That should do the trick. If you want to be extra cautious or if you have any trouble, try running Caffeinate
first.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With