+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 15 of 18

Thread: which regression model for time series?

  1. #1
    Points: 1,740, Level: 24
    Level completed: 40%, Points required for next Level: 60

    Location
    Geneva
    Posts
    32
    Thanks
    7
    Thanked 0 Times in 0 Posts

    which regression model for time series?




    Hi guys, please help. I need to do regression analysis for demographic data. I am not sure whether linear or logistic regression would be appropriate... Also I would like to be able to extrapolate trends...

    can use SPSS or STATA.

    thanks,
    S

  2. #2
    Super Moderator
    Points: 31,766, Level: 100
    Level completed: 0%, Points required for next Level: 0
    bugman's Avatar
    Posts
    2,255
    Thanks
    290
    Thanked 324 Times in 265 Posts

    Re: which regression model for time series?

    Quote Originally Posted by Sylviastat View Post
    I am not sure whether linear or logistic regression would be appropriate...
    S
    I am not sure either, since you haven't given much detail.

    Linear regression for two continuous variables that have approximately normal residuals. If your response is binary, then consider logistic regression.
    The earth is round: P<0.05

  3. #3
    Points: 1,740, Level: 24
    Level completed: 40%, Points required for next Level: 60

    Location
    Geneva
    Posts
    32
    Thanks
    7
    Thanked 0 Times in 0 Posts

    Re: which regression model for time series?

    Thanks. Basically, I am trying to do population projections. So I have data from 1980 till 2010 and I want to project those in the future. I keep reading on the internet and it seems that autocorrelation could be something to consider... not sure... and what if I wanted to add other variables to the model, like economic growth... thanks for helping with the model.

    Sylvia

  4. #4
    Points: 3,724, Level: 38
    Level completed: 50%, Points required for next Level: 76

    Location
    Oslo, Norway
    Posts
    54
    Thanks
    0
    Thanked 15 Times in 10 Posts

    Re: which regression model for time series?

    It's not quite that simple ...

    You could do just normal regression. It probably wouldn't be very wrong. The problem is just that for most time series, the residuals will be autocorrelated (each value correlated with the previous one), so they are not independent, and the regression error will be underestimated (the Durbin-Watson test can be used to check for this condition if I remember correctly).

    So, one solution is to first do a regression,
    then calculate the residuals,
    then estimate their AR(1) coefficient rho (in essence the degree of autocorrelation) by regressing all residuals onto their previous values,
    then use this value to remove the autocorrelation (this is called pre-whitening),
    then regress again (couple of extra tricks there)

    All this has to be done with rather meticulous attention to detail, so unless you feel heroic it would be best to use a standard package for it ... don't know if it's in SPSS or STATA but surely there is a package for R!

  5. #5
    Points: 1,740, Level: 24
    Level completed: 40%, Points required for next Level: 60

    Location
    Geneva
    Posts
    32
    Thanks
    7
    Thanked 0 Times in 0 Posts

    Re: which regression model for time series?

    Quote Originally Posted by ohammer View Post
    It's not quite that simple ...

    You could do just normal regression. It probably wouldn't be very wrong. The problem is just that for most time series, the residuals will be autocorrelated (each value correlated with the previous one), so they are not independent, and the regression error will be underestimated (the Durbin-Watson test can be used to check for this condition if I remember correctly).

    So, one solution is to first do a regression,
    then calculate the residuals,
    then estimate their AR(1) coefficient rho (in essence the degree of autocorrelation) by regressing all residuals onto their previous values,
    then use this value to remove the autocorrelation (this is called pre-whitening),
    then regress again (couple of extra tricks there)

    All this has to be done with rather meticulous attention to detail, so unless you feel heroic it would be best to use a standard package for it ... don't know if it's in SPSS or STATA but surely there is a package for R!
    Thanks for responding Ohammer. I will attempt that tomorrow with SPSS and STATA. Seems a bit complex, so will probably revert with more questions...

  6. #6
    Points: 1,740, Level: 24
    Level completed: 40%, Points required for next Level: 60

    Location
    Geneva
    Posts
    32
    Thanks
    7
    Thanked 0 Times in 0 Posts

    Re: which regression model for time series?

    Quote Originally Posted by ohammer View Post
    It's not quite that simple ...

    You could do just normal regression. It probably wouldn't be very wrong. The problem is just that for most time series, the residuals will be autocorrelated (each value correlated with the previous one), so they are not independent, and the regression error will be underestimated (the Durbin-Watson test can be used to check for this condition if I remember correctly).

    So, one solution is to first do a regression,
    then calculate the residuals,
    then estimate their AR(1) coefficient rho (in essence the degree of autocorrelation) by regressing all residuals onto their previous values,
    then use this value to remove the autocorrelation (this is called pre-whitening),
    then regress again (couple of extra tricks there)

    All this has to be done with rather meticulous attention to detail, so unless you feel heroic it would be best to use a standard package for it ... don't know if it's in SPSS or STATA but surely there is a package for R!
    Dear Ohammer, dear all,

    This indeed is not easy. Is there a way to do something simpler - like doing a normal regression and then extrapolating the trend? (if so what to do with years - can it be treated as independent varaible or does it need to be transformed?)

    and how about a logistic curve? does it make sense to do logistic regression and then extrapolate (how?)

    THANKS

  7. #7
    Points: 3,724, Level: 38
    Level completed: 50%, Points required for next Level: 76

    Location
    Oslo, Norway
    Posts
    54
    Thanks
    0
    Thanked 15 Times in 10 Posts

    Re: which regression model for time series?

    Yes forget the pre-whitening, I don't think it would make any practical difference, and people are regressing time-series without it all the time. (Only, if you are going to publish this, and get one of those pedantic reviewers we all hate, it might be criticized).

    So, all you need then is an ordinary least squares regression with time as independent variable (no transformation). Write down the equation for the modeled function (linear, logit, whatever), plug in the year 2020, and tell us our future

  8. #8
    Points: 1,740, Level: 24
    Level completed: 40%, Points required for next Level: 60

    Location
    Geneva
    Posts
    32
    Thanks
    7
    Thanked 0 Times in 0 Posts

    Re: which regression model for time series?

    Quote Originally Posted by ohammer View Post
    Yes forget the pre-whitening, I don't think it would make any practical difference, and people are regressing time-series without it all the time. (Only, if you are going to publish this, and get one of those pedantic reviewers we all hate, it might be criticized).

    So, all you need then is an ordinary least squares regression with time as independent variable (no transformation). Write down the equation for the modeled function (linear, logit, whatever), plug in the year 2020, and tell us our future
    This is giving me a strange result

    Coefficients(a)
    Unstandardized Coefficients Standardized Coefficients
    Model B Std. Error
    Beta t Sig.
    1 (Constant) -1.631E8 4801028.350 -33.973 .000
    Year 83544.071 2407.111 .989 34.707 .000
    a. Dependent Variable: Singapore



    Beta is 83,544
    how should I treat variable "year" in the equation?

  9. #9
    Points: 3,724, Level: 38
    Level completed: 50%, Points required for next Level: 76

    Location
    Oslo, Norway
    Posts
    54
    Thanks
    0
    Thanked 15 Times in 10 Posts

    Re: which regression model for time series?

    You have done a linear regression with year t as independent variable? It looks like you have slope 83544 and intercept -163100000:

    y=83544*t-163100000

    Plug t=2010 into this, and get about 4.8 million, which is (Wikipedia ... Singapore ... hang on ...) quite close to the 2010 population of Singapore?

    BUT: The population before ca. 1952 was negative according to this model - maybe you need to consider e.g. an exponential instead ...

  10. #10
    Points: 1,740, Level: 24
    Level completed: 40%, Points required for next Level: 60

    Location
    Geneva
    Posts
    32
    Thanks
    7
    Thanked 0 Times in 0 Posts

    Re: which regression model for time series?

    Quote Originally Posted by ohammer View Post
    You have done a linear regression with year t as independent variable? It looks like you have slope 83544 and intercept -163100000:

    y=83544*t-163100000

    Plug t=2010 into this, and get about 4.8 million, which is (Wikipedia ... Singapore ... hang on ...) quite close to the 2010 population of Singapore?

    BUT: The population before ca. 1952 was negative according to this model - maybe you need to consider e.g. an exponential instead ...
    Bless you Ohammer. So it gives around 6.1 mln in 2025 which is very reasonable. But I will add x square to the model as suggested.

    Another way of looking at it would be that for each year we would get 83,544 extra people, correct?

    I will also try logistic reg to compare.

  11. #11
    Devorador de queso
    Points: 95,754, Level: 100
    Level completed: 0%, Points required for next Level: 0
    Awards:
    Posting AwardCommunity AwardDiscussion EnderFrequent Poster
    Dason's Avatar
    Location
    Tampa, FL
    Posts
    12,932
    Thanks
    307
    Thanked 2,629 Times in 2,245 Posts

    Re: which regression model for time series?

    I've sort of been wondering this the entire thread... How are you going to use logistic regression here? What outcome are you modeling?

  12. #12
    Points: 1,740, Level: 24
    Level completed: 40%, Points required for next Level: 60

    Location
    Geneva
    Posts
    32
    Thanks
    7
    Thanked 0 Times in 0 Posts

    Re: which regression model for time series?

    Quote Originally Posted by Dason View Post
    I've sort of been wondering this the entire thread... How are you going to use logistic regression here? What outcome are you modeling?
    Yes, logistic regression doesn't seem to work...as it is for binary variables only. linear regression yielded plausible results. This makes me wonder how do demographers make their logistic curves....

    If you have a suggestion for a not very complex model, please do let me know.

  13. #13
    Points: 3,724, Level: 38
    Level completed: 50%, Points required for next Level: 76

    Location
    Oslo, Norway
    Posts
    54
    Thanks
    0
    Thanked 15 Times in 10 Posts

    Re: which regression model for time series?

    I think maybe there is a confusion about the word "logistic" here: Logistic regression often refers to (GLM) regression of binary data using a logit/probit link, maybe this is what you tried? You may instead be thinking of fitting to a logistic (sigmoid) function often used for population growth, something like

    y=a/(1+b*exp(-cx))

    for parameters a, b and c ?

    This model is difficult to linearize by transformation (at least if all three parameters have to be estimated), so you may have to use a nonlinear regression method .

  14. #14
    Points: 1,740, Level: 24
    Level completed: 40%, Points required for next Level: 60

    Location
    Geneva
    Posts
    32
    Thanks
    7
    Thanked 0 Times in 0 Posts

    Re: which regression model for time series?

    Quote Originally Posted by ohammer View Post
    I think maybe there is a confusion about the word "logistic" here: Logistic regression often refers to (GLM) regression of binary data using a logit/probit link, maybe this is what you tried? You may instead be thinking of fitting to a logistic (sigmoid) function often used for population growth, something like

    y=a/(1+b*exp(-cx))

    for parameters a, b and c ?

    This model is difficult to linearize by transformation (at least if all three parameters have to be estimated), so you may have to use a nonlinear regression method .
    Yes.

    This is the output:

    Logistic
    Model Summary
    R R Square Adjusted R Square Std. Error of the Estimate
    .995 .990 .990 .014
    The independent variable is Year.


    ANOVA
    Sum of Squares df Mean Square F Sig.
    Regression .569 1 .569 2771.558 .000
    Residual .006 27 .000
    Total .575 28
    The independent variable is Year.

    Coefficients
    Unstandardized Coefficients Standardized Coefficients
    B Std. Error Beta t Sig.
    Year .984 .000 .370 3166.533 .000
    (Constant) 537904.449 338891.324 1.587 .124
    The dependent variable is ln(1 / SEAsia).


    Is A- contsant, B- year? where is C?........

  15. #15
    Points: 1,740, Level: 24
    Level completed: 40%, Points required for next Level: 60

    Location
    Geneva
    Posts
    32
    Thanks
    7
    Thanked 0 Times in 0 Posts

    Re: which regression model for time series?


    Quote Originally Posted by ohammer View Post
    I think maybe there is a confusion about the word "logistic" here: Logistic regression often refers to (GLM) regression of binary data using a logit/probit link, maybe this is what you tried? You may instead be thinking of fitting to a logistic (sigmoid) function often used for population growth, something like

    y=a/(1+b*exp(-cx))

    for parameters a, b and c ?

    This model is difficult to linearize by transformation (at least if all three parameters have to be estimated), so you may have to use a nonlinear regression method .
    Yet again, it seems not easy. the book says:

    we used NCSS statistical package to estimate the parameters of the logistic curve because - unlike SPSS - its logaritm does not require a user defined value for the upper asymptote" (A)....

+ Reply to Thread
Page 1 of 2 1 2 LastLast

           




Similar Threads

  1. Time Series Multi-level model????
    By richard_mac87 in forum R
    Replies: 2
    Last Post: 11-02-2010, 09:04 AM
  2. Replies: 2
    Last Post: 09-17-2010, 07:33 PM
  3. Replies: 1
    Last Post: 01-20-2010, 04:59 PM
  4. Methodology for building a model based on available time series
    By tantan in forum Statistical Research
    Replies: 2
    Last Post: 10-26-2009, 12:47 PM
  5. Pooled cross-section time-series model
    By Ramore in forum Statistics
    Replies: 0
    Last Post: 10-14-2009, 01:24 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts






Advertise on Talk Stats