Prediction method, device, equipment and storage medium for the number of hospital outpatient visits based on two-step regression

By using a two-step regression method to process influencing factors and constructing linear regression and ARIMA models, the difficult problem of hospital outpatient flow forecasting was solved, high-precision future flow forecasting was achieved, and hospitals were supported in rationally allocating resources.

CN114758761BActive Publication Date: 2025-09-12FUDAN UNIVERSITY +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210309065.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-03-28
Publication Date
2025-09-12
Estimated Expiration
2042-03-28

AI Technical Summary

Technical Problem

Existing technologies are unable to effectively predict the flow of people in hospital outpatient departments over the next period of time, resulting in improper allocation of medical resources, which may cause congestion during peak flow periods or waste of resources during low flow periods.

Method used

A two-step regression-based forecasting method is adopted. First, the influencing factors, including the day of the week, holidays, temperature and weather, are processed through principal component analysis to build a linear regression model. Then, the ARIMA model is fitted to the residual sequence and the model parameters are optimized to improve the forecast accuracy.

Benefits of technology

It has achieved relatively ideal prediction accuracy for the number of outpatient visits in hospitals in the next month, with an average error of less than 10%, which facilitates hospitals to make reasonable resource arrangements.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure QLYQS_1
    Figure QLYQS_1
  • Figure QLYQS_2
    Figure QLYQS_2
  • Figure QLYQS_3
    Figure QLYQS_3
Patent Text Reader

Abstract

The present invention provides a method, apparatus, device, and storage medium for predicting the number of hospital outpatient visits based on two-step regression. The method comprises: step S1: constructing a two-step regression-based prediction model for the number of hospital outpatient visits; and step S2: using the above-described prediction model to predict the number of hospital outpatient visits over a future period. The present invention utilizes a regression model with time series error to predict patient flow, capable of predicting patient flow over relatively long periods of time with reasonable accuracy. It performs well for time series data with strong regularity, facilitating management arrangements such as hospital shift scheduling.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of time series analysis, and in particular relates to a method for predicting the number of patients visiting hospital departments. Background Art

[0002] Hospitals experience a massive daily flow of patients, and this number fluctuates constantly due to various factors, posing significant challenges to hospital management systems. Previous staff scheduling models may not be suitable for this changing environment. This necessitates predicting future hospital traffic flows to schedule medical staff in a targeted manner, avoiding congestion during peak hours and wasted human resources during low hours, and ensuring optimal resource allocation and management.

[0003] Hospital staffing arrangements are typically based on experience, which is simple and easy to implement, but sometimes cannot flexibly respond to changes in patient numbers due to changes in certain factors. Building a model can effectively solve this problem, but there is currently no good precedent.

[0004] Numerous factors influence the number of patients visiting a clinic, such as weather, holidays, and temperature. There are also unpredictable, latent factors that cause the time series of patient traffic to fluctuate. Therefore, the difficulty in forecasting lies in understanding the impact of each factor on patient traffic and the correlations between them, thereby building a reasonable and feasible forecasting model. However, existing hospitals do not have the technology to predict outpatient department traffic over a specific period of time. Summary of the Invention

[0005] To address the problem that existing hospitals lack technical means for predicting the flow of patients in outpatient departments in the future, the first aspect of the present invention provides a method for predicting the number of outpatient visits in hospitals based on two-step regression, comprising:

[0006] Step S1: Construct a prediction model for the number of hospital outpatient visits based on two-step regression. The prediction model is:

[0007]

[0008] in

[0009] t=1,2,...,T.

[0010] y t is the number of people on day t;

[0011] D it Indicates whether the tth day is week i. If the tth day is week i, then D it The value is 1, otherwise D it The value is 0, bi is the coefficient before week i;

[0012] Indicates before holidays, Indicates after holidays;

[0013] are the highest and lowest temperatures during the working period respectively;

[0014] W t is the weather on day t. If there is rain or snow, W t =1, other weather conditions are 0;

[0015] a, b, c, d, f, g, h are regression coefficients, representing the effects of the above factors on y t Effect size

[0016] e t Satisfy an ARIMA model: p is the autoregressive order, d is the difference order, and q is the moving average order;

[0017] φ, θ are the coefficients of autoregressive and sliding terms;

[0018] B is the delay operator, which is defined as Be t =e t-1 ;

[0019] ∈ t is a white noise sequence that obeys independent and identical distribution;

[0020] n is the number of working days in a week, for example, n = 5, 6 or 7;

[0021] Step S2: Use the above prediction model to predict the number of outpatient visits to the hospital within a certain period of time in the future.

[0022] Furthermore, step S1 includes:

[0023] Step S1.1: Select several variables that affect the number of outpatient visits to the hospital, including the day of the week, holidays, temperature, and weather;

[0024] Step S1.2: Combining the weekday variables, holiday variables, temperature variables and weather variables into an explanatory variable matrix X = (D1, D2, ..., D n , H before , H after , T high , T low , W), and standardize X to get X * :

[0025] Let X = (x ij ) n×p ,but

[0026] in

[0027] Step S1.3: Set X * Perform principal component analysis:

[0028] 1) Find an orthogonal matrix Γ that satisfies And make is a p×p diagonal matrix

[0029] Λ=diag(σ1,σ2,...,σ m , 0, ..., 0), m≤p and σ1≥σ2≥σ m >0;

[0030] 2) Calculate the principal component variance contribution rate

[0031]

[0032] And the cumulative contribution rate

[0033] 3) Select i, 1≤i≤p, so that γ i ≥0.95, and take the first i columns of Γ, recorded as And remember That is X * The principal component matrix of

[0034] Step S1.4: Use explanatory variables To fit a linear regression model:

[0035]

[0036] in The number of people in the department every day, First, assume that the independent and identical distribution is satisfied and use the least squares method to get the estimated parameters And calculate the residual

[0037] Step S1.5: Convert the residual sequence Fitting an ARIMA model:

[0038]

[0039] Where p is the autoregressive order, d is the difference order, q is the sliding average order; φ, θ are the coefficients of the autoregressive and sliding terms; B is the delay operator, which is defined as Be t =e t-1 ∈ t is a white noise sequence that obeys independent and identical distribution;

[0040] First, the Hyndman-Khandakar algorithm is used to select the optimal order (p, d, q):

[0041] (1) Determine the differential order d by repeated KPSS tests: 0≤d≤2

[0042] (2) After differencing the data d times, the optimal p and q are selected by minimizing AICc:

[0043]

[0044] AIC = 2k-2log(Likelihood)

[0045] Where n is the sample size, that is, the number of samples, and k is the noise variance removed After the total number of parameters, the calculation steps of the maximum likelihood function refer to the estimation method of coefficients φ and θ in step S1.7 below:

[0046] (1) Fit four initial models: ARIMA(0, d, 0), ARIMA(2, d, 2), ARIMA(1, d, 0), ARIMA(0, d, 1),

[0047] (2) The best model (with the smallest AICc) fitted in step (1) is called the “current model”;

[0048] Consider the following two variants of the "current model":

[0049] 1. Change the value of p and / or q by ±1;

[0050] 2. Including / excluding the constant term c;

[0051] (3) The model with the smallest AICc among the above variants and the original current model is the latest "current model";

[0052] (4) Repeat (3) until there is no model with a smaller AICc;

[0053] Step S1.6: Adjust the original linear regression model to:

[0054]

[0055]

[0056] t=1,2,...,T.

[0057] Step S1.7: Use maximum likelihood estimation to determine the values ​​of the coefficients φ and θ of the autoregressive and sliding terms, thereby estimating the parameters And bring it into the model to complete the construction of the prediction model:

[0058] Assume that each ∈ t are independent of each other and have zero mean and the same standard deviation Then each ∈ t The probability density function (pdf) of is:

[0059]

[0060] By independence, we can get (∈1,∈2,...,∈ T ) is:

[0061]

[0062] This gives the likelihood function Likelihood:

[0063]

[0064] where g t For the general Use y1, ..., y t , functions represented by β, φ, and θ,

[0065] According to the model formula, ∈ t Using the observable y and Express and find So that (∈1,∈2,...,∈ T ) reaches its maximum value:

[0066]

[0067] The estimated parameters Bring it into the model, thus completing the construction of the model.

[0068] Furthermore, step S2 includes: using the constructed prediction model to predict the flow of people in each department in the next k days, the known data includes the flow of people in the previous T days

[0069]

[0070] And the explanatory variable matrix for k days

[0071] X forecast =(D1, D2, ..., D n,H before , H after , Thigh , T low , W)

[0072] Predict the flow of people in each department in the next k days

[0073] First, X l Perform the transformation in the same way as step S1.2 to obtain Then bring it into the regression model:

[0074]

[0075] Here we need to find the predicted value y forecast You need to calculate e first forecast

[0076] According to e forecast Satisfied Model

[0077]

[0078] in

[0079] t=T+1,T+2,...,T+k,

[0080] You can replace t in the model with T+l:

[0081]

[0082] l = 1, 2, ..., k.

[0083] Since the event has already occurred before time T, it is a known event.

[0084]

[0085] The conditional expectation of the above formula is:

[0086]

[0087] The properties of conditional expectations are:

[0088]

[0089] According to the above two formulas, we can find thereby

[0090]

[0091] therefore

[0092]

[0093] Get the predicted value y forecast .

[0094] Furthermore, the above prediction model is used to predict the number of hospital outpatient visits in the next month.

[0095] A second aspect of the present application provides a prediction device for the number of hospital outpatient visits based on two-step regression, comprising: a model construction module and a prediction module, wherein the model construction module includes a variable selection module, a standardization processing module, a principal component analysis module, a linear regression model fitting module, and an ARIMA model fitting module;

[0096] The variable selection module is used to select several variables that affect the number of outpatient visits to the hospital, and the variables are the day of the week, holidays, temperature and weather;

[0097] The standardization processing module is used to combine the week number variables, holiday variables, temperature variables and weather variables into an explanatory variable matrix X=(D1, D2, ..., D n , H before , H after , T high , T low , W), and standardize X to get X * :

[0098] Let X = (x ij ) n×p ,but

[0099] in

[0100] The principal component analysis module is used to convert X * Perform principal component analysis:

[0101] (1) Find an orthogonal matrix Γ that satisfies And make is a p×p diagonal matrix Λ=diag(σ1,σ2,...,σ m , 0, ..., 0), m≤p and σ1≥σ2≥σ m >0;

[0102] (2) Calculate the principal component variance contribution rate

[0103]

[0104] And the cumulative contribution rate

[0105] (3) Select i, 1≤i≤p so that γ i ≥0.95, and take the first i columns of Γ, recorded as And remember That is X * The principal component matrix of

[0106] The Fit Linear Regression Model module is used to use explanatory variables To fit a linear regression model:

[0107]

[0108] in The number of people in the department every day, First, assume that the independent and identical distribution is satisfied and use the least squares method to get the estimated parameters And calculate the residual The Fit ARIMA Model module is used to transform the residual series Fitting an ARIMA model:

[0109]

[0110] Where p is the autoregressive order, d is the difference order, q is the sliding average order; φ, θ are the coefficients of the autoregressive and sliding terms; B is the delay operator, which is defined as Be t =e t-1 ∈ t is a white noise sequence that obeys independent and identical distribution;

[0111] First, the Hyndman-Khandakar algorithm is used to select the optimal order (p, d, q):

[0112] (1) Determine the differential order d by repeated KPSS tests: 0≤d≤2

[0113] (2) After differencing the data d times, the optimal p and q are selected by minimizing AICc:

[0114]

[0115] AIC = 2k-2log(Likelihood)

[0116] Where n is the sample size, that is, the number of samples, and k is the noise variance removed After the total number of parameters, the calculation steps of the maximum likelihood function refer to the estimation method of coefficients φ and θ in step S1.7 below:

[0117] (1) Fit four initial models: ARIMA(0, d, 0), ARIMA(2, d, 2), ARIMA(1, d, 0), ARIMA(0, d, 1),

[0118] (2) The best model (with the smallest AICc) fitted in step (1) is called the “current model”;

[0119] (3) Consider the following two variants of the “current model”:

[0120] 1. Change the value of p and / or q by ±1;

[0121] 2. Including / excluding the constant term c;

[0122] The model with the smallest AICc among the above variants and the original current model is the latest "current model";

[0123] (4) Repeat (3) until there is no model with a smaller AICc;

[0124] The Fit ARIMA Model module is also used to adjust the original linear regression model to:

[0125]

[0126]

[0127] t=1,2,...,T.

[0128] The ARIMA model fitting module is also used to determine the values ​​of the coefficients φ and θ of the autoregressive and sliding terms using maximum likelihood estimation, thereby estimating the parameters And bring it into the model to complete the construction of the prediction model:

[0129] Assume that each ∈t is independent of each other and has zero mean and the same standard deviation Then each ∈ t The probability density function (pdf) of is:

[0130]

[0131] By independence, we can get (∈1,∈2,...,∈ T ) is:

[0132]

[0133] This gives the likelihood function Likelihood:

[0134]

[0135] where g t For the general Use y1, ..., y t , functions represented by β, φ, and θ,

[0136] According to the model formula, ∈ tUsing the observable y and Express and find So that (∈1,∈2,...,∈ T ) reaches its maximum value:

[0137]

[0138] The estimated parameters Bring it into the model, thus completing the construction of the model;

[0139] The prediction module is used to predict the number of outpatient visits to the hospital within a certain period of time in the future using the prediction model constructed by the model construction module.

[0140] Furthermore, the prediction module is used to use the constructed prediction model to predict the flow of people in each department in the next k days. The known data include the flow of people in the previous T days.

[0141]

[0142] And the explanatory variable matrix for k days

[0143] X forecast =(D1, D2, ..., D n , H before , H after , T high , T low , W)

[0144] Predict the flow of people in each department in the next k days

[0145] First, According to the processing method of the standardized processing module, the Then bring it into the regression model:

[0146]

[0147] Here we need to find the predicted value y forecast You need to calculate e first forecast

[0148] According to e forecast Satisfied Model

[0149]

[0150] in

[0151] t=T+1,T+2,...,T+k,

[0152] You can replace t in the model with T+l:

[0153]

[0154]

[0155] Since the event has already occurred before time T, it is a known event.

[0156]

[0157] The conditional expectation of the above formula is:

[0158]

[0159] The properties of conditional expectations are:

[0160]

[0161] According to the above two formulas, we can calculate e T (l), thus

[0162]

[0163] therefore

[0164]

[0165] Get the predicted value y forecast .

[0166] The third aspect of the present application provides an electronic device, comprising: a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the computer program, when executed by the processor, implements the steps in the above-mentioned method for predicting the number of hospital outpatient visits based on two-step regression.

[0167] The fourth aspect of the present application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps in the above-mentioned method for predicting the number of hospital outpatient visits based on two-step regression.

[0168] Compared with the existing technology, the above technical solution has the following beneficial effects:

[0169] The present invention constructs a time series model for the number of patients in each department. This model takes into account factors that potentially affect the number of patients and predicts the flow of patients in each department for the next month, achieving relatively ideal prediction accuracy.

[0170] The present invention mainly adopts two models to predict the number of people, the main model is a linear regression model, and the factors affecting the flow of people such as weather, day of the week, holidays, and temperature are selected in the model.

[0171] For regression explanatory variables X=(D1,D2,...,D n , H before , H after , T high , T low , W), we use principal component analysis to simplify variables and extract effective information to avoid the problem of multicollinearity. The main step is to find an orthogonal matrix Γ such that It is a diagonal matrix. The main components are selected according to the proportion of each diagonal element in the total, so that the new explanatory variable of the regression analysis is X * Γ, avoiding the problem of multicollinearity.

[0172] For the residuals after regression, the present invention does not adopt the residual assumption in general linear regression analysis, i.e., independent normal distribution, but uses ARIMA time series model to fit the residuals. In this way, the impact of the flow of people in the previous few days (e.g., within 2 weeks) on the flow of people on that day can be taken into account. The present invention uses linear regression model and ARIMA time series model to nest each other, which can improve the precision of data fitting and prediction, while a single model cannot reach the current accuracy. The order determination of ARIMA model is completed in a way that minimizes AICc, specifically using Hyndman-Khandakar algorithm. AICc is an improved AIC criterion, which is also applicable when the sample size is small compared to AIC.

[0173] The Hyndman-Khandakar algorithm can automatically determine the optimal order, reducing the uncertainty of manual judgment. Currently, the algorithm has been used by various statistical and data analysis software (such as R and Python).

[0174] In summary, the present invention uses a regression model with time series error to predict pedestrian flow. Its advantages include being able to predict pedestrian flow over a relatively long period of time (e.g., within a month) within an appropriate accuracy (e.g., an error of less than 10%); it performs well for time series data with strong regularity, which facilitates management arrangements such as scheduling in hospitals. BRIEF DESCRIPTION OF THE DRAWINGS

[0175] Figure 1-Figure 5 This is a comparison chart of the predicted and actual number of outpatient visits in the morning of each department in May 2019. Figure 1-Figure 5 The vertical axis is named "number of patients (unit: person)", and the horizontal axis is named "visiting time".

[0176] Figures 6-10 This is a comparison chart of the predicted and actual number of outpatient visits in the afternoon of May 2019 in each department. Figures 6-10The vertical axis is named "number of patients (unit: person)", and the horizontal axis is named "visiting time". DETAILED DESCRIPTION

[0177] The advantages of the present invention are further described below with reference to the accompanying drawings and specific embodiments. Those skilled in the art should understand that the following specific description is illustrative rather than restrictive and should not be used to limit the scope of protection of the present invention.

[0178] Exemplary embodiments will be described in detail herein, with examples illustrated in the accompanying drawings. In the following description, when referring to the drawings, identical numerals in different figures represent identical or similar elements, unless otherwise indicated. The embodiments described in the following exemplary embodiments are not intended to represent all possible embodiments consistent with the present disclosure. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present disclosure, as detailed in the appended claims.

[0179] The terms used in this disclosure are for the purpose of describing specific embodiments only and are not intended to limit the disclosure. As used in this disclosure and the appended claims, the singular forms "a," "an," "the," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. As used herein, the term "including" and its variations denote an open-ended inclusion, i.e., "including but not limited to." Depending on the context, the term "if," as used herein, can be interpreted as meaning "upon," "when," or "in response to determining." In the description of the present invention, unless otherwise specified or limited, it should be noted that the terms "mounted," "connected," and "connected" are to be interpreted broadly. For example, they can refer to mechanical or electrical connections, internal communication between two components, direct connection, or indirect connection through an intermediary. Those skilled in the art will readily understand the specific meanings of these terms based on the specific circumstances. In the subsequent description, suffixes such as "module," "component," or "unit" used to designate components are used solely to facilitate the description of the present invention and do not inherently have specific meanings. Therefore, "module" and "component" may be used interchangeably.

[0180] Example

[0181] In one embodiment of the present application, the prediction device for the number of hospital outpatient visits based on two-step regression of the present application includes: a model construction module and a prediction module, and the model construction module includes a variable selection module, a standardization processing module, a principal component analysis module, a fitting linear regression model module, a fitting ARIMA model module, a linear regression model adjustment module, a maximum likelihood estimation module and a training module.

[0182] The functional modules in the present application may be integrated together to form an independent part, or each module may exist independently, or two or more modules may be integrated to form an independent part.

[0183] The method for predicting the number of outpatient visits to a hospital using the above-mentioned prediction device comprises the following steps:

[0184] Step S1: The model building module builds a prediction model for the number of hospital outpatient visits based on two-step regression, specifically including steps S1.1-S1.7:

[0185] Step S1.1: The variable selection module selects several variables that affect the number of outpatient visits to the hospital, wherein the variables are day of the week, holidays, temperature, and weather;

[0186] Based on the impact of external factors on hospital patients, factors such as day of the week, holidays, temperature, and weather were selected:

[0187] 1) For example, the number of weeks is calculated based on the 6 working days of the hospital, which are 6 vectors D i , i=1,2,...,6.D i =(D i1 , D i2 ,...,D iT ) T , if day t is week i, then D it =1, otherwise D it = 0. For the case where there are 5 working days in the afternoon, take i = 1, 2, ..., 5.

[0188] 2) Holiday variables are divided into before and after holidays. Holidays are statutory holidays other than normal weekends. Two vectors H before , H after express.

[0189] If t is the day before a holiday, then otherwise

[0190] 3) Temperature variables are divided into the highest temperature during the working hours of the day, T high , and the maximum temperature during working hours T low ,like

[0191] 4) The weather variable W indicates the weather conditions, If there is precipitation on day t, then W t =1, otherwise W t =0.

[0192] Step S1.2: The standardization processing module combines the week number variables, holiday variables, temperature variables and weather variables into an explanatory variable matrix X = (D1, D2, ..., D n , H before , H after , T high , T low , W), in this embodiment, the explanatory variable matrix is ​​X=(D1, D2, ..., D n , H before , H after , T high , T low , W), and standardize X to get X * :

[0193] Let X = (x ij ) n×p ,but

[0194] in

[0195] Step S1.3: The principal component analysis module converts X * Perform principal component analysis:

[0196] 1) Find an orthogonal matrix Γ that satisfies And make is a p×p diagonal matrix

[0197] Λ=diag(σ1,σ2,...,σ m , 0, ..., 0), m≤p and σ1≥σ2≥σ m >0;

[0198] 2) Calculate the principal component variance contribution rate

[0199]

[0200] And the cumulative contribution rate

[0201] 3) Select i, 1≤i≤p, so that γ i ≥0.95, and take the first i columns of Γ, recorded as And remember That is X * The principal component matrix of

[0202] Step S1.4: The Fit Linear Regression Model module uses explanatory variables To fit a linear regression model:

[0203]

[0204] in The number of people in the department every day, First, assume that the independent and identical distribution is satisfied and use the least squares method to get the estimated parameters And calculate the residual Step S1.5: The Fit ARIMA Model module converts the residual series Fitting an ARIMA model:

[0205]

[0206] Where p is the autoregressive order, d is the difference order, q is the sliding average order; φ, θ are the coefficients of the autoregressive and sliding terms; B is the delay operator, which is defined as Be t =e t-1 ∈ t is a white noise sequence that obeys independent and identical distribution;

[0207] First, the Hyndman-Khandakar algorithm is used to select the optimal order (p, d, q). The Hyndman-Khandakar algorithm can automatically determine the optimal order, reducing the uncertainty of manual judgment. Currently, this algorithm has been used by various statistical and data analysis software (such as R language and Python):

[0208] (1) Determine the differential order d by repeated KPSS tests: 0≤d≤2

[0209] (2) After differencing the data d times, the optimal p and q are selected by minimizing AICc:

[0210]

[0211] AIC = 2k-2log(Likelihood)

[0212] Where n is the sample size, that is, the number of samples, and k is the noise variance removed After the total number of parameters, the calculation steps of the maximum likelihood function are as follows: The estimation method of the coefficients φ and θ in step S1.7 below:

[0213] (1) Fit four initial models: ARIMA(0, d, 0), ARIMA(2, d, 2), ARIMA(1, d, 0), ARIMA(0, d, 1),

[0214] (2) The best model (with the smallest AICc) fitted in step (1) is called the “current model”;

[0215] (3) Consider the following two variants of the “current model”:

[0216] 1. Change the value of p and / or q by ±1;

[0217] 2. Including / excluding the constant term c;

[0218] The model with the smallest AICc among the above variants and the original current model is the latest "current model";

[0219] (4) Repeat (3) until there is no model with a smaller AICc. AICc is an improved AIC criterion. Compared with AIC, this criterion is also applicable when the sample size is small.

[0220] Step S1.6: The Fit ARIMA Model module is also used to adjust the original linear regression model to:

[0221]

[0222]

[0223] t=1,2,...,T.

[0224] Step S1.7: The ARIMA model fitting module is also used to determine the values ​​of the coefficients φ and θ of the autoregressive and sliding terms using maximum likelihood estimation, thereby estimating the parameters And bring it into the model to complete the construction of the prediction model:

[0225] Assume that each ∈ t are independent of each other and have zero mean and the same standard deviation Then each ∈ t The probability density function (pdf) of is:

[0226]

[0227] By independence, we can get (∈1,∈2,...,∈ T ) is:

[0228]

[0229] This gives the likelihood function Likelihood:

[0230]

[0231] where g t For the general Use y1, ..., y t , functions represented by β, φ, and θ,

[0232] According to the model formula, ∈t Using the observable y and Express and find So that (∈1,∈2,...,∈ T ) reaches its maximum value:

[0233]

[0234] The estimated parameters Bring it into the model, thus completing the construction of the model.

[0235] Step S2: The prediction module uses the following prediction model constructed by the model construction module to predict the number of outpatient visits to the hospital within a certain period of time in the future:

[0236] The constructed prediction model is used to predict the flow of people in each department in the next k days. The known data includes the flow of people in the previous T days.

[0237]

[0238] And the explanatory variable matrix for k days

[0239] X forecast =(D1, D2, ..., D n , H before , H after , T high , T low , W)

[0240] Predict the flow of people in each department in the next k days

[0241] First, X l Perform the transformation in the same way as step S1.2 to obtain Then bring it into the regression model:

[0242]

[0243] Here we need to find the predicted value y forecast You need to calculate e first forecast

[0244] According to e forecast Satisfied Model

[0245]

[0246] in

[0247] t=T+1,T+2,...,T+k,

[0248] You can replace t in the model with T+l:

[0249]

[0250] l = 1, 2, ..., k.

[0251] Since the event has already occurred before time T, it is a known event.

[0252]

[0253] The conditional expectation of the above formula is:

[0254]

[0255] The properties of conditional expectations are:

[0256]

[0257] According to the above two formulas, we can find thereby

[0258]

[0259] therefore

[0260]

[0261] Get the predicted value y forecast .

[0262] In another embodiment, the present application also provides an electronic device comprising: a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the computer program, when executed by the processor, implements the steps in the above-mentioned method for predicting the number of hospital outpatient visits based on two-step regression.

[0263] Electronic devices include, but are not limited to, user devices, network devices, or devices formed by integrating user devices and network devices via a network. Network devices include, but are not limited to, computers, network hosts, single network servers, multiple network server clusters, or a cloud consisting of multiple servers. Here, a cloud is composed of a large number of computers or network servers based on cloud computing. Cloud computing is a type of distributed computing, consisting of a group of loosely coupled computers forming a virtual supercomputer.

[0264] In another embodiment, the present application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps in the above-mentioned method for predicting the number of hospital outpatient visits based on two-step regression.

[0265] A computer-readable storage medium may be a tangible device that can hold and store instructions for use by an instruction execution device. A computer-readable storage medium may be, for example, but not limited to, an electrical storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination thereof. More specific examples (a non-exhaustive list) of computer-readable storage media include: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a static random access memory (SRAM), a portable compact disc read-only memory (CD-ROM), a digital versatile disc (DVD), a memory stick, a floppy disk, a mechanical encoding device, such as a punch card or a raised structure in a groove on which instructions are stored, and any suitable combination thereof. The computer program instructions for performing the operations of the present disclosure may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-dependent instructions, microcode, firmware instructions, state setting data, or source code or object code written in any combination of one or more programming languages, including object-oriented programming languages ​​such as Smalltalk, C++, and conventional procedural programming languages ​​such as "C" language or similar programming languages. Computer-readable program instructions may be executed entirely on a user's computer, partially on a user's computer, as an independent software package, partially on a user's computer, partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., utilizing an Internet service provider to connect via the Internet). In some embodiments, an electronic circuit, such as a programmable logic circuit, a field programmable gate array (FPGA), or a programmable logic array (PLA), may be personalized by utilizing the state information of the computer-readable program instructions. The electronic circuit may execute the computer-readable program instructions, thereby realizing various aspects of the present disclosure.

[0266] Verification of prediction accuracy of effect cases

[0267] 1) Experimental methods

[0268] Predicted value: Based on the actual number of patients from May 2018 to April 2019, the prediction model of this application is used to predict the number of patients visiting different outpatient departments in the morning and afternoon in May 2019;

[0269] True value: The actual number of patients visiting different outpatient departments in the morning and afternoon in May 2019 was counted based on the hospital's registration information.

[0270] 2) Experimental results

[0271] Figure 1-Figure 5 The following is a comparison chart of the predicted and actual number of outpatient visits in the morning of May 2019 for each department. The mean absolute error of the predicted values ​​of each department (|predicted value - true value| / true value) is:

[0272] Cardiology 7.47%, gastroenterology 6.21%, endocrinology 6.70%, urology 6.18%, neurology 8.43%.

[0273] In addition, if the prediction model of this application is used to predict the number of people in each department in the morning for 9 consecutive months after March 2019, the average relative error per day is approximately 8.46%.

[0274] Figures 6-10 This chart compares the predicted and actual number of outpatient visits in the afternoon for each department in May 2019. The mean absolute error (|predicted value - true value| / true value) for each department's predictions was: 8.87% for cardiology, 8.83% for gastroenterology, 8.36% for endocrinology, 9.26% for urology, and 12.38% for neurology.

[0275] In addition, if the forecast is made separately for each department in the afternoon of May 2019 for 6 months, the average relative error for each day is 10.69%.

[0276] It should be noted that the embodiments of the present invention have better practicability and do not impose any form of limitation on the present invention. Any technician familiar with the field may use the technical content disclosed above to change or modify it into an equivalent effective embodiment. However, any modification or equivalent changes and modifications made to the above embodiments based on the technical essence of the present invention without departing from the content of the technical solution of the present invention are still within the scope of the technical solution of the present invention.

Claims

1. A method for predicting the number of outpatient visits in hospitals based on two-step regression, characterized in that: include: Step S1: Construct a prediction model for the number of hospital outpatient visits based on two-step regression. The prediction model is: in t=1, 2, ..., T; y t is the number of people on day t; D it Indicates whether the tth day is week i. If the tth day is week i, then D it The value is 1, otherwise D it The value is 0, b i is the coefficient before week i; Indicates before holidays, Indicates after holidays; are the highest and lowest temperatures during the working period respectively; W t is the weather on day t. If there is rain or snow, W t =1, other weather conditions are 0; a, b, c, d, f, g, h are regression coefficients, representing D it 、 and W t For y t the size of the effect; e t Satisfy an ARIMA model: p is the autoregressive order, d is the difference order, and q is the moving average order; φ,θ are the coefficients of autoregressive and sliding terms; B is the delay operator, which is defined as Be t =e t-1 ; ∈ t is a white noise sequence that obeys independent and identical distribution; n is the number of working days per week, n ​​= 5, 6 or 7; Step S2: using the above prediction model to predict the number of outpatient visits in the hospital within a certain period of time; Step S1 includes: Step S1.1: Select several variables that affect the number of outpatient visits to the hospital, including the day of the week, holidays, temperature, and weather; Step S1.2: Combine the weekday variables, holiday variables, temperature variables, and weather variables into an explanatory variable matrix X=(D1,D2,...,D n , H before , H after , T high , T low , W), and standardize X to get X * : Let X = (x ij ) n×p ,but in Step S1.3: Set X * Perform principal component analysis: 1) Find an orthogonal matrix Γ that satisfies And make is a p×p diagonal matrix Λ=diag(σ1,σ2,...,σ m , 0, ..., 0), m≤p and σ1≥σ2≥σ m >0; 2) Calculate the principal component variance contribution rate And the cumulative contribution rate 3) Select i, 1≤i≤p, so that γ i ≥0.95, and take the first i columns of Γ, recorded as And remember That is X * The principal component matrix of Step S1.4: Use explanatory variables To fit a linear regression model: in The number of people in the department every day, First, assume that the independent and identical distribution is satisfied and use the least squares method to get the estimated parameters And calculate the residual Step S1.5: Convert the residual sequence Fitting an ARIMA model: Where p is the autoregressive order, d is the difference order, q is the sliding average order; φ, θ are the coefficients of the autoregressive and sliding terms; B is the delay operator, which is defined as Be t =e t-1 ∈ t is a white noise sequence that obeys independent and identical distribution; First, the Hyndman-Khandakar algorithm is used to select the order (p, d, q): (1) Determine the differential order d by repeated KPSS tests: 0≤d≤2 (2) After differencing the data d times, select p and q by minimizing AICc: AIC = 2k-2log(Likelihood) Where n is the sample size, that is, the number of samples, and k is the noise variance removed After the total number of parameters, the calculation steps of the maximum likelihood function are as follows. See the estimation method of the coefficients φ and θ in step S1.7 below: (1) Fit four initial models: ARIMA(0, d, 0), ARIMA(2, d, 2), ARIMA(1, d, 0), ARIMA(0, d, 1), (2) The model with the smallest AICc fitted in step (1) is called the "current model"; (3) Examine the following two variants of the "current model":

1. Change the value of p and / or q by ±1; 2. Including / excluding the constant term c; The model with the smallest AICc among the above variants and the original current model is the latest "current model"; (4) Repeat (3) until there is no model with a smaller AICc; Step S1.6: Adjust the original linear regression model to: t=1, 2, ..., T; Step S1.7: Use maximum likelihood estimation to determine the values ​​of the coefficients φ and θ of the autoregressive and sliding terms, thereby estimating the parameters And bring it into the model to complete the construction of the prediction model: Assume that each ∈ t are independent of each other and have zero mean and the same standard deviation Then each ∈ t The probability density function pdf is: By independence, we can get (∈1,∈2,...,∈ T )’s joint probability density function pdf is: This gives the likelihood function Likelihood: where g t For the general Use y1, ..., y t , functions represented by β, φ, and θ, According to the model formula, ∈ t Using the observed y and Express and find So that (∈1,∈2,...,∈ T ) reaches its maximum value: The estimated parameters Bring it into the model, thus completing the construction of the model; Step S2 includes: The constructed prediction model is used to predict the flow of people in each department in the next k days. The known data includes the flow of people in the previous T days. And the explanatory variable matrix for k days X forecast =(D1,D2,...,D n ,H before ,H after ,T high ,T low ,W) Predict the flow of people in each department in the next k days First, Perform the transformation in the same way as step S1.2 to obtain Then bring it into the regression model: Here we need to find the predicted value y forecast You need to calculate e first forecast According to e forecast Satisfied Model in t=T+1,T+2,...,T+k, Use t in the model replace: Since the event has already occurred before time T, it is a known event. The conditional expectation of the above formula is: The properties of conditional expectations are: According to the above two formulas, we can find thereby therefore Get the predicted value y forecast .

2. The method for predicting the number of hospital outpatient visits based on two-step regression according to claim 1, characterized in that: The above prediction model is used to predict the number of hospital outpatient visits in the next month.

3. A device for predicting the number of outpatient visits in hospitals based on two-step regression, characterized in that: include: Model construction module and prediction module; the model construction module includes a variable selection module, a standardization processing module, a principal component analysis module, a linear regression model fitting module and an ARIMA model fitting module; the variable selection module is used to select several variables that affect the number of outpatient visits to the hospital, and the variables are the day of the week, holidays, temperature and weather; The standardization processing module is used to combine the week number variables, holiday variables, temperature variables and weather variables into an explanatory variable matrix X=(D1, D2, ..., D n , H before , H after , T high , T low , W), and standardize X to get X * : Let X = (x ij ) n×p ,but in The principal component analysis module is used to convert X * Perform principal component analysis: 1) Find an orthogonal matrix Γ that satisfies And make is a p×p diagonal matrix Λ=diag(σ1,σ2,...,σ m , 0, ..., 0), m≤p and σ1≥σ2≥σ m >0; 2) Calculate the principal component variance contribution rate And the cumulative contribution rate 3) Select i, 1≤i≤p, so that γ i ≥0.95, and take the first i columns of Γ, recorded as And remember That is X * The principal component matrix of The Fit Linear Regression Model module is used to use explanatory variables To fit a linear regression model: in The number of people in the department every day, First, assume that the independent and identical distribution is satisfied and use the least squares method to get the estimated parameters And calculate the residual The Fit ARIMA Model module is used to transform the residual series Fitting an ARIMA model: Where p is the autoregressive order, d is the difference order, q is the sliding average order; φ, θ are the coefficients of the autoregressive and sliding terms; B is the delay operator, which is defined as Be t =e t-1 ∈ t is a white noise sequence that obeys independent and identical distribution; First, the Hyndman-Khandakar algorithm is used to select the order (p, d, q): (1) Determine the differential order d by repeated KPSS tests: 0≤d≤2 (2) After differencing the data d times, select p and q by minimizing AICc: AIC = 2k-2log(Likelihood) Where n is the sample size, that is, the number of samples, and k is the noise variance removed After the total number of parameters, the calculation steps of the maximum likelihood function refer to the estimation method of coefficients φ and θ in step S1.7 below: (1) Fit four initial models: ARIMA(0, d, 0), ARIMA(2, d, 2), ARIMA(1, d, 0), ARIMA(0, d, 1), (2) The model with the smallest AICc fitted in step (1) is called the "current model"; (3) Examine the following two variants of the "current model":

1. Change the value of p and / or q by ±1; 2. Including / excluding the constant term c; The model with the smallest AICc among the above variants and the original current model is the latest "current model"; (4) Repeat (3) until there is no model with a smaller AICc; The Fit ARIMA Model module is also used to adjust the original linear regression model to: t=1,2,...,T;The fitting ARIMA model module is also used to determine the values ​​of the coefficients φ and θ of the autoregressive and sliding terms using maximum likelihood estimation, thereby estimating the parameters And bring it into the model to complete the construction of the prediction model: Assume that each ∈ t are independent of each other and have zero mean and the same standard deviation Then each ∈ t The probability density function pdf is: By independence, we can get (∈1,∈2,...,∈ T )’s joint probability density function pdf is: This gives the likelihood function Likelihood: where g t For the general Use y1, ..., y t , functions represented by β, φ, and θ, According to the model formula, ∈ t Using the observed y and Express and find So that (∈1,∈2,...,∈ T ) reaches its maximum value: The estimated parameters Bring it into the model, thus completing the construction of the model; The prediction module is used to predict the number of hospital outpatient visits within a certain period of time in the future using the prediction model constructed by the model construction module; The prediction model is: in t=1, 2, ..., T; y t is the number of people on day t; D it Indicates whether the tth day is week i. If the tth day is week i, then D it The value is 1, otherwise D it The value is 0, b i is the coefficient before week i; Indicates before holidays, Indicates after holidays; are the highest and lowest temperatures during the working period respectively; W t is the weather on day t. If there is rain or snow, W t =1, other weather conditions are 0; a, b, c, d, f, g, h are regression coefficients, representing D it 、 and W t For y t the size of the effect; e t Satisfy an ARIMA model: p is the autoregressive order, d is the difference order, and q is the moving average order; φ,θ are the coefficients of autoregressive and sliding terms; B is the delay operator, which is defined as Be t =e t-1 ; ∈ t is a white noise sequence that obeys independent and identical distribution; n is the number of working days per week, n ​​= 5, 6 or 7; The prediction module is used to use the constructed prediction model to predict the flow of people in each department in the next k days. The known data includes the flow of people in the previous T days. And the explanatory variable matrix for k days X forecast =(D1,D2,...,D n ,H before ,H after ,T high ,T low ,W) Predict the flow of people in each department in the next k days First, According to the processing method of the standardized processing module, the Then bring it into the regression model: Here we need to find the predicted value y forecast You need to calculate e first forecast According to e forecast Satisfied Model in t=T+1,T+2,...,T+k, Use t in the model replace: Since the event has already occurred before time T, it is a known event. The conditional expectation of the above formula is: The properties of conditional expectations are: According to the above two formulas, we can find thereby therefore Get the predicted value y forecast .

4. An electronic device, characterized in that: include: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the computer program is executed by the processor, the steps of the method for predicting the number of hospital outpatient visits based on two-step regression as described in claim 1 or 2 are implemented.

5. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps in the method for predicting the number of hospital outpatient visits based on two-step regression as claimed in claim 1 or 2.

Citation Information

Patent Citations

  • Analytical prediction module of disease incidence affected by environmental change

    CN104809335A

  • Hospital outpatient clinic medical consultation prediction method based on Xgboost frame

    CN108877905A