Linear regression with two subsamples of different number of observations
조회 수: 7 (최근 30일)
이전 댓글 표시
Hi,
I am trying to create a linear regression to test the difference in means across two subsamples between stock prices before and after a market crash.
The problem is that the subsamples are of different observations. The observations before is 334, and after is 374.
I am supposed to create a linear regression yi=β0+β1di where y is containing values from both subsamples, d is a dummy variable equal to 0 for values before, and 1 for values after.
I need to extend my code to estimate β(hat)0 and β(hat)1.
How do I do this when the subsamples are of different observations?
Thank you for all help,
J.
댓글 수: 0
답변 (1개)
Aditya Patil
2020년 9월 22일
As per my understanding, you want to fit a linear regression model, however, the two datasets you are using have different variables.
One way to overcome this would be to see if there is an appropriate value, such as zero, which can be added to missing variables in both datasets. However, this might only make sense if only few variables are different. If all variables are different, then it might not make much sense.
On the other hand, if you're issue is that the observations are not for same stocks, then it might not be useful to compare them, assuming they are independent variables. If you want to test the hypothesis that they are somehow related, then you need to check the relationship between the two sets of variables. You could do this by predicting the after variables based on the before variables.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Linear Regression에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!