Bottom Page

• 0 Vote(s) - 0 Average
• 1
• 2
• 3
• 4
• 5
 Newbie question: how to generate dataframe and use multiple regression zydjohn Silly Frenchman Posts: 32 Threads: 19 Joined: Dec 2017 Reputation: 0 Likes received: 1 #1 Dec-10-2017, 09:49 AM Hello: I have some code, which is not finished yet: ```from scipy.stats import linregress x0 = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15] y = [2,3,4,5,6,7,8,9,10,11] def genList1(x, n, offset): list1 = [] if (n + offset) <= len(x): list1 = x[offset:(offset + n)] return(list1) x1 = genList1(x0, 10, 5) x2 = genList1(x0, 10, 4) x3 = genList1(x0, 10, 3) x4 = genList1(x0, 10, 2) x5 = genList1(x0, 10, 1) ```I have one original list X0 with 15 items, and another list y with 10 items. I would like to generate other 5 lists with 10 items each, the way how to generate each list is in function: genList1. Now, I want to know how I can use the 6 lists to generate a dataframe or whatever is required to do Multiple Regression using Statsmodels or whatever python packages. The corresponding R linear model expression is: fit <- lm(y ~ x1 + x2 + x3 + x4 + x5, data=dataframe1) And I want to print coefficients for each variable (x1, x2, x3, x4, x5) How I can do this in python? Thanks, « Next Oldest | Next Newest »

Top Page

 Possibly Related Threads... Thread Author Replies Views Last Post Python & Dataframe basic question georgialtr 0 646 Apr-06-2020, 03:59 PM Last Post: georgialtr Dividing a single column of dataframe into multiple columns based on char length darpInd 2 395 Mar-14-2020, 09:19 AM Last Post: scidam newbie: loop, modify dataframe cells expat_th 5 472 Mar-03-2020, 09:05 PM Last Post: jefsummers Simple pandas dataframe question popohoma 1 931 Jan-03-2019, 05:00 PM Last Post: ashlardev Newbie question to return only the index of a dataframe zydjohn 0 971 Jan-22-2018, 03:40 PM Last Post: zydjohn Question for dataframe to replace INF value zydjohn 0 3,606 Jan-15-2018, 10:00 PM Last Post: zydjohn very simple dataframe question really_this_dumb 0 864 Jan-02-2018, 11:30 AM Last Post: really_this_dumb Newbie question how to find the coefficient for each variable zydjohn 10 5,048 Dec-14-2017, 05:01 PM Last Post: j.crater Newbie question on how to use pandas.rolling_mean zydjohn 5 9,507 Dec-09-2017, 08:42 PM Last Post: j.crater Newbie question for using map, lambda zydjohn 2 1,437 Dec-09-2017, 07:18 PM Last Post: zydjohn

Forum Jump:

Users browsing this thread: 1 Guest(s)