How to write regression loop over moving window and store data?How do I download a file over HTTP using Python?How do I loop through or enumerate a JavaScript object?How do I break out of nested loops in Java?How do I iterate over a JSON structure?How to break out of jQuery each LoopIterating over dictionaries using 'for' loopsHow do I install pip on Windows?How to move a file in PythonHow do I write JSON data to a file?How to iterate over rows in a DataFrame in Pandas?

SFDX force:org:clone not working

What does the "titan" monster tag mean?

Is all-caps blackletter no longer taboo?

Why is C++ template use not recommended in space/radiated environment?

Is there a term for someone whose preferred policies are a mix of Left and Right?

Someone who is granted access to information but not expected to read it

Is it true that "only photographers care about noise"?

Should I worry about having my credit pulled multiple times while car shopping?

Should I email my professor to clear up a (possibly very irrelevant) awkward misunderstanding?

Do the Shadow Magic sorcerer's Strength of the Grave feature and the half-orc's Relentless Endurance trait work together?

Jam with honey & without pectin has a saucy consistency always

Past vs. present tense when referring to a fictional character

Why is Skinner so awkward in Hot Fuzz?

Difference between grep -R and -r

Why did the AvroCar fail to fly above 3 feet?

What does this circuit symbol mean?

Is it a good security practice to force employees hide their employer to avoid being targeted?

In The Incredibles 2, why does Screenslaver's name use a pun on something that doesn't exist in the 1950s pastiche?

Arrows inside a commutative diagram using tikzcd

Is pointing finger in meeting consider bad?

I sent an angry e-mail to my interviewers about a conflict at my home institution. Could this affect my application?

Why can't we feel the Earth's revolution?

Was the Lonely Mountain, where Smaug lived, a volcano?

Does WiFi affect the quality of images downloaded from the internet?



How to write regression loop over moving window and store data?


How do I download a file over HTTP using Python?How do I loop through or enumerate a JavaScript object?How do I break out of nested loops in Java?How do I iterate over a JSON structure?How to break out of jQuery each LoopIterating over dictionaries using 'for' loopsHow do I install pip on Windows?How to move a file in PythonHow do I write JSON data to a file?How to iterate over rows in a DataFrame in Pandas?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















Trying to write a loop to run a regression on multiple portfolios. It's over a 3 year moving window (so 1990-1993, 1991-1994, 1992-1995,...) and I would like to store the data in another dataframe and be able to access a particular portfolio and year. How can I get the data only from the 3 year window? This is the start I have, any tips? (I am a beginner programmer, thanks for any help!)



for i in range (4):
reg = smf.ols('LS_ret'+str(i)+'~ExMkt+HML+SMB', data=portfolioLS).fit()
reg.summary()
year = 1990
outcome = pd.DataFrame()
outcome = reg['LS_ret'+str(i)+year]
while year in range (1990,2017):
year = year + 1









share|improve this question






















  • Each time the for loop runs, year is reset to 1990.

    – James Phillips
    Mar 25 at 13:18

















0















Trying to write a loop to run a regression on multiple portfolios. It's over a 3 year moving window (so 1990-1993, 1991-1994, 1992-1995,...) and I would like to store the data in another dataframe and be able to access a particular portfolio and year. How can I get the data only from the 3 year window? This is the start I have, any tips? (I am a beginner programmer, thanks for any help!)



for i in range (4):
reg = smf.ols('LS_ret'+str(i)+'~ExMkt+HML+SMB', data=portfolioLS).fit()
reg.summary()
year = 1990
outcome = pd.DataFrame()
outcome = reg['LS_ret'+str(i)+year]
while year in range (1990,2017):
year = year + 1









share|improve this question






















  • Each time the for loop runs, year is reset to 1990.

    – James Phillips
    Mar 25 at 13:18













0












0








0








Trying to write a loop to run a regression on multiple portfolios. It's over a 3 year moving window (so 1990-1993, 1991-1994, 1992-1995,...) and I would like to store the data in another dataframe and be able to access a particular portfolio and year. How can I get the data only from the 3 year window? This is the start I have, any tips? (I am a beginner programmer, thanks for any help!)



for i in range (4):
reg = smf.ols('LS_ret'+str(i)+'~ExMkt+HML+SMB', data=portfolioLS).fit()
reg.summary()
year = 1990
outcome = pd.DataFrame()
outcome = reg['LS_ret'+str(i)+year]
while year in range (1990,2017):
year = year + 1









share|improve this question














Trying to write a loop to run a regression on multiple portfolios. It's over a 3 year moving window (so 1990-1993, 1991-1994, 1992-1995,...) and I would like to store the data in another dataframe and be able to access a particular portfolio and year. How can I get the data only from the 3 year window? This is the start I have, any tips? (I am a beginner programmer, thanks for any help!)



for i in range (4):
reg = smf.ols('LS_ret'+str(i)+'~ExMkt+HML+SMB', data=portfolioLS).fit()
reg.summary()
year = 1990
outcome = pd.DataFrame()
outcome = reg['LS_ret'+str(i)+year]
while year in range (1990,2017):
year = year + 1






python loops while-loop regression






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 25 at 1:29









aceace

11




11












  • Each time the for loop runs, year is reset to 1990.

    – James Phillips
    Mar 25 at 13:18

















  • Each time the for loop runs, year is reset to 1990.

    – James Phillips
    Mar 25 at 13:18
















Each time the for loop runs, year is reset to 1990.

– James Phillips
Mar 25 at 13:18





Each time the for loop runs, year is reset to 1990.

– James Phillips
Mar 25 at 13:18












0






active

oldest

votes












Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55330252%2fhow-to-write-regression-loop-over-moving-window-and-store-data%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55330252%2fhow-to-write-regression-loop-over-moving-window-and-store-data%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Obelisk of Theodosius Contents History Description Notes Bibliography Further reading External links Navigation menuAge of spirituality : late antique and early Christian art, third to seventh centuryOver 60 picturesObelisks of the World41°00′21.24″N 28°58′31.43″E / 41.0059000°N 28.9753972°E / 41.0059000; 28.97539727724550-7235741376235741376

밀양 대씨 역사 각주 함께 보기 둘러보기 메뉴밀양 대씨

1973년 목차 사건 문화 탄생 사망 노벨상 달력 둘러보기 메뉴