BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
pauliet987
Calcite | Level 5

Hello, 

I need assistance with a linear regression code I am working. Essentially, I am trying to predict how many positive cases will occur the next week based on number of labs performed in previous weeks. Example:

Week_Start   Laboratory.   Labs_Performed  Number_of_Positive_Cases

11/04/2018.   Lab1.            230                        31

11/04/2018.   Lab2.            300.                       40

11/11/2018.   Lab1.             260                        45

11/11/2018.   Lab2.             325.                       46

I have a lot more variables than this. How would I go about doing a linear regression for just lab1 values and another linear regression with just lab2 values for the next week (week start 11/18/2018)? 

 

Thank you for any help you can give! 

1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26

@pauliet987 wrote:

I am trying to predict the number of positive cases from all the previous weeks labs performed. This would go back about 6 months.


This seems like a time series model, rather than a linear regression. To perform a linear regression, the number of previous weeks used in the prediction would have to be the same for every record, and that is not the case, based on your statement above.

--
Paige Miller

View solution in original post

3 REPLIES 3
PaigeMiller
Diamond | Level 26

@pauliet987 wrote:

Hello, 

I need assistance with a linear regression code I am working. Essentially, I am trying to predict how many positive cases will occur the next week based on number of labs performed in previous weeks. Example:

Week_Start   Laboratory.   Labs_Performed  Number_of_Positive_Cases

11/04/2018.   Lab1.            230                        31

11/04/2018.   Lab2.            300.                       40

11/11/2018.   Lab1.             260                        45

11/11/2018.   Lab2.             325.                       46

I have a lot more variables than this. How would I go about doing a linear regression for just lab1 values and another linear regression with just lab2 values for the next week (week start 11/18/2018)? 

 

Thank you for any help you can give! 


I think some clarification would be helpful.

 

Are you trying to predict the number of positive cases for 11/18/2018 using just labs performed in the week of 11/11/2018? Or  does the prediction depend on both 11/04/2018 and 11/11/2018? How far back in time do we use the number of labs performed to get a prediction? 

 

Why linear regression and not some sort of time series?

--
Paige Miller
pauliet987
Calcite | Level 5

I am trying to predict the number of positive cases from all the previous weeks labs performed. This would go back about 6 months.

PaigeMiller
Diamond | Level 26

@pauliet987 wrote:

I am trying to predict the number of positive cases from all the previous weeks labs performed. This would go back about 6 months.


This seems like a time series model, rather than a linear regression. To perform a linear regression, the number of previous weeks used in the prediction would have to be the same for every record, and that is not the case, based on your statement above.

--
Paige Miller

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 3 replies
  • 522 views
  • 0 likes
  • 2 in conversation