I need to make a prediction model based on some historical data from a website's user login system. Suppose my dataset has some features like user login time and logout time for each day for a specific user. Login and logout times can be multiple in a day for a specific user. Suppose, If the user login 5 times in the website in a day, there will be five entry points as rows to the dataset for that user, logout also works like this. Now from the login and logout time, I need to find out the active time that user was logged in to the website as well as predicting the inactive time in which user is not available/present in the website. How can I do this? Which algorithm should I use and which prediction model (Linear regression/Logistic Regression/Time series) need to choose in this case? It will be very much helpful if you can suggest me for this specially to implement in R. Thanks.


Actually I need to find out/predict a time in which the user is active in a website during the day. I have a dataset with 3 columns listed as "user_id", "login_time" and "logout_time". Now I am trying to make another column "active_time" in which I'm trying to compute the user's active time in the website by subtracting the login time from logout time and it can be multiple as user can access website multiple times in a day. Now I need to predict the time in which the user is active in the website where active time is the target variable and login, logout time as predictor. I also trying to make a linear regression model for this prediction. But I don't know whether my process is correct or not for this problem. Can anyone please let me know which type of model I need to build for this prediction? Is it will be Linea regression, logistic regression or time series ?

Just to clarify as long as you specify inactive time, as the user being logged out, not logged in and not doing anything, you might have a couple approaches. If you define inactive as them being logged in it seems you don't have the features to determine if they are active or not.

What comes to my mind first would to model their log in and log outs as a poission distribution. So maybe use something like poission regression to fit a model for your data.

  • I am considering the time between login and logout as active time and active time can be multiple time in a day as he/she can access the website multiple time in a day. And rest of the time except the active time in that day will be considered as inactive/idle time. How can I make a model on this principle and predict the time in which the user will be offline/inactive in next day? – Nuibb Nov 9 at 10:38
  • You have the time between users, so the simplest is fit a poission distribution. After that if you want to be predicative to type of user you're going to need to collect features and train some type of regression model. – ASS466uiuc yesterday

Your Answer


By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.