简体   繁体   English

OLS 回归与 statsmodels 给出许多系数

[英]OLS Regression with statsmodels giving many coefficients

I'm trying to make a simple regression on encryption time for a given datasize from a dataset.我正在尝试对数据集中给定数据大小的加密时间进行简单的回归。 I'm a beginner with python and statsmodels but I think I'm getting strange results with OLS regression since it provides me a coefficient for every datasize like :我是 python 和 statsmodels 的初学者,但我认为 OLS 回归得到了奇怪的结果,因为它为我提供了每个数据大小的系数,例如:

DataSize[T.1024] 0.0001
DataSize[T.1040] 0.0003
DataSize[T.1056] 0.0004
DataSize[T.1072] 0.0006
DataSize[T.1088] 0.0007

here is the code I developed:这是我开发的代码:

    encrypt_key_16 = select_total_encrypt_time.loc[select_total_encrypt_time['KeySize'] == 16]
    y4, X4 = dmatrices('Measure ~ DataSize', data=encrypt_key_16, return_type='dataframe')
    mod4 = sm.OLS(y4, X4)
    result4 = mod4.fit()

Am I doing something wrong ?难道我做错了什么 ?

Thank you in advance for your answer.预先感谢您的回答。

Okay I think I found what the problem is.好的,我想我找到了问题所在。 When I print the dataframe X4 I'm getting the following output:当我打印数据帧 X4 时,我得到以下输出:

Output when printing X4打印 X4 时输出

So I need to somehow make it only one column of DataSize.所以我需要以某种方式使它只有一列 DataSize。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Statsmodels - Wald检验线性回归模型(OLS)中系数趋势的显着性 - Statsmodels - Wald Test for significance of trend in coefficients in Linear Regression Model (OLS) 是否有可能使用 statsmodels 中的 OLS 以手动声明某些系数的方式指定线性回归? - Is there possibility to specify a linear regression using a OLS from statsmodels in way that some coefficients are declare manually? Python numpy statsmodels OLS回归特定值 - Python numpy statsmodels OLS Regression specific value Python statsmodels中缺少OLS回归模型的拦截 - Missing intercepts of OLS Regression models in Python statsmodels Statsmodels OLS函数可用于多个回归参数 - Statsmodels OLS function for multiple regression parameters 使用statsmodel忽略多个OLS回归中的缺失值 - Ignoring missing values in multiple OLS regression with statsmodels 如何在 statsmodels/python 中计算 OLS 系数的同时置信区域? - How to compute simultaneous confidence region of OLS coefficients in statsmodels/python? Pandas Statsmodels使用DF预测器进行回归预测? - Pandas Statsmodels ols regression prediction using DF predictor? 检验回归系数等于 statsmodels OLS 中的非零值的零假设 - Test null hypothesis that regression coefficient equals a nonzero value in statsmodels OLS Statsmodels OLS回归:对数似然,用法和解释 - Statsmodels OLS Regression: Log-likelihood, uses and interpretation
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM