Questions tagged [coefficients]

In mathematics, a coefficient is a multiplicative factor in some term of a polynomial, a series or any expression; it is usually a number, but in any case does not involve any variables of the expression.

In mathematics, a coefficient is a multiplicative factor in some term of a polynomial, a series or any expression; it is usually a number, but in any case does not involve any variables of the expression.

495 questions
5
votes
1 answer

Get model estimates from another reference level, without running new model?

I am wondering if there is a simple way to change what values are in the intercept, perhaps mathematically, without re-running large models. As an example: mtcars$cyl<-as.factor(mtcars$cyl) summary( lm(mpg~cyl+hp,data=mtcars) ) Output: …
Dylan_Gomes
  • 2,066
  • 14
  • 29
5
votes
1 answer

Calculate coefficient for all subsets of a data frame

I want to calculate the correlation coefficient of weight and time for each individual in a data frame separately. The data frame consists of about 40 individuals, with 10 or fewer observations per individual. I have been able to calculate the…
5
votes
1 answer

Calculating Standard Error of Coefficients for Logistic Regression in Spark

I know this question has been asked previously here. But I couldn't find the correct answer. The answer provided in the previous post suggests the usage of Statistics.chiSqTest(data) which provides the goodness of fit test (Pearson's Chi-Square…
5
votes
2 answers

Does R always return NA as a coefficient as a result of linear regression with unnecessary variables?

My question is about the unnecessary predictors, namely the variables that do not provide any new linear information or the variables that are linear combinations of the other predictors. As you can see the swiss dataset has six variables. …
BRCN
  • 635
  • 1
  • 12
  • 26
5
votes
1 answer

Why is Numpy inconsistent in ordering polynomial coefficients by degree?

numpy.polynomial.polynomial.Polynomial stores polynomial coefficients in order of increasing degree, while numpy.poly1d stores polynomial coefficients in order of decreasing degree. Is there a reason for this difference? Is there an advantage to…
rlchqrd
  • 519
  • 4
  • 11
5
votes
3 answers

How to adjust scaled scikit-learn Logicistic Regression coeffs to score a non-scaled dataset?

I am currently using Scikit-Learn's LogisticRegression to build a model. I have used from sklearn import preprocessing scaler=preprocessing.StandardScaler().fit(build) build_scaled = scaler.transform(build) to scale all of my input variables…
5
votes
1 answer

Why does Sympy cut off polynomial terms with small coefficients?

I am trying to convert an expression containing terms with various degrees of a symbolic variable z_s into a polynomial in python using sympy.Poly() so that I can then extract the coefficients using .coeffs(). The expression I have is a high-order…
5
votes
2 answers

sympy: How to get zero for absent constant term

On SymPy 0.7.5 (Python 2.7.8-64-bit). I'm unable to get the constant term from an expression when the constant term is zero or absent (an absent constant is the same of a zero constant, right?). I can get the constant term from an expression with…
dariober
  • 8,240
  • 3
  • 30
  • 47
5
votes
1 answer

Extract all standard errors of coefficients from list of logistic regressions

I want to extract the standard errors from a list of logistic regression models. This is the logistic regression function, designed this way so i can run more than one analysis at once: glmfunk <- function(x) glm( ldata$DFREE ~ x ,…
Rene Bern
  • 545
  • 3
  • 10
  • 18
4
votes
2 answers

When and how to use Polynomial.fit() as opposed to polyfit()?

Using Python 3.10.0 and NumPy 1.21.4. I'm trying to understand why Polynomial.fit() calculates wildly different coefficient values from polyfit(). In the following code: import numpy as np def main(): x = np.array([3000, 3200, 3400, 3600, 3800,…
JYPerez
  • 60
  • 4
4
votes
2 answers

Simulate data from regression model with exact parameters in R

How can I simulate data so that the coefficients recovered by lm are determined to be particular pre-determined values and have normally distributed residuals? For example, could I generate data so that lm(y ~ 1 + x) will yield (Intercept) = 1.500…
Jonas Lindeløv
  • 5,442
  • 6
  • 31
  • 54
4
votes
2 answers

Equivalent of nlcom (Stata) in R? Nonlinear transformations of regression coefficients

I would like to perform a nonlinear transformation of a regression coefficient. For example: , or . Stata has a convenient implementation with nlcom this that employs the delta method to estimate standard errors and corresponding confidence…
bpar
  • 383
  • 1
  • 15
4
votes
2 answers

Too many _coef values for LogisticRegression in Pipeline

I'm making use of the sklearn-pandas DataFrameMapper in a sklearn Pipeline. In order to evaluate feature contribution in a feature union pipeline, I like to measure the coefficients of the estimator (Logistic Regression). For the following code…
4
votes
2 answers

How to Get the Coefficients Of A Linear Equation

In this program, I need to get the solutions of a linear system and this system have n variables and n equations. I need to extract the coefficients of the equations in a text file (.txt) and put them on a matrix. The first line of the text file has…
Grandtour
  • 1,127
  • 1
  • 11
  • 28
4
votes
6 answers

Removing and replacing coefficients of polynomials in Python

I´m having some trouble using python´s list function for polynomials. For example, if I write the poynomial p1 = [0, 0, 0, 1, 1], I get the output 1*x^4 + 1*x^3 + 0*x^2 + 0*x + 0 I want to adjust this so that: Terms with coefficient 1 are written…
Alexander West
  • 81
  • 1
  • 1
  • 9
1
2
3
32 33