Questions tagged [linearmodels]

A python package which provides estimation and inference in some common linear models including panel data and instrumental variables estimators. For questions related to implementation or interpretation of a linearmodels estimator.

linearmodels is a package which provides some more complex linear estimation techniques to Python, based around numpy and pandas.

Common linear models such as Two-stage least squares, Generalized Method of Moments etc. are missing from the popular statsmodels package and this package fills that gap.

141 questions
1
vote
0 answers

Defining reference levels in generalised linear models

I am using function traitglm() in library(mvabund) to conduct a fourth-corner analysis equivalent to a GLM analysis. I use the following code: TraitTGLM = traitglm(AbundanceSO, EnvironmentSO, TraitsSO, method="manyglm",…
tabtimm
  • 411
  • 3
  • 6
  • 17
1
vote
1 answer

Function manyglm() on species abundance and trait data

I am attempting to run a glm analysis using the following code: ftP <- manyglm(AbundVec ~ as.matrix(traitVec)*trV, family = "poisson") I currently receive the following error message: Error in [[<-.data.frame(*tmp*, i, value = c(54L, 54L, 54L, 54L,…
tabtimm
  • 411
  • 3
  • 6
  • 17
0
votes
0 answers

Linear mixed model

I want to run linear mixed-effect model with one categorical feature as independent variable and numerical and continuous data as target data. Should I use dummy variabel for categorical data or hot encoding or none of them for running the model.
0
votes
0 answers

Three classes, two features classification using LinearSVC(one-to-rest)

mglearn.discrete_scatter(X[:, 0], X[:, 1], y) line = np.linspace(-15, 15) for coef, intercept, color in zip(linear_svm.coef_, linear_svm.intercept_, ['b', 'r', 'g']): plt.plot(line, -(line * coef[0] +…
0
votes
0 answers

I need a graphical display of the influence of yearly income on the relationship of working hours and life satisfaction

model3 <- lm(lsat ~ (wwhours + I(wwhours^2))*jahreslohn + age + I(age^2) + female + employed + log(jahreslohn) + hhsize, data = d) this is my linear model. "jahreslohn" = yearly income. i want to plot this function but I am not able to. I…
0
votes
0 answers

Why is the r2 square so low in my PanelOLS model? Could there be any issues with the data or the model structure?

enter image description here Here is the output result of my PanelOLS model, why is the r2 square so small? Does it mean there is something wrong with my data or features or model itself? model = PanelOLS.from_formula(formula='counts ~ 1 +…
mephet
  • 1
0
votes
0 answers

Heteroskedacity in longitudinal data

plot of residuals vs predicted Hi all, I have a linear mixed random intercept model in r. I have applied this model to longitudinal/panel data of customers of a time period. For each customer, i have a different intercept. As i want to obtain their…
Rutger
  • 1
  • 2
0
votes
0 answers

getting predicted values linearmodels (Python)

I am studying the Python library linearmodels to estimate panel models. In this regard, I have a problem in getting the predicted values from the estimated model. After fitting the model, I used the fitted_values function, but the result that I get…
statsfa
  • 1
  • 2
0
votes
0 answers

How do I apply a filter to a predictor variable in a linear model in R?

I'm learning R and having trouble with one of the questions I've been asked to answer on my course. I need to run a linear model where I need to control for variables A and B, X is the dependent variable (e.g. Ppt's height), and the main predictor…
0
votes
0 answers

How can I tell R to use a specific reference level in a linear model?

I am trying to change the reference level for a linear model. R thinks my distance variable (entered as a character string) is "ordered" based on alphabetical order as follows: 10m, 15m, 20m(post), 20m(pre), 3m, 5m. But I'm really just analyzing…
Stephen R
  • 1
  • 1
0
votes
0 answers

Generalised MixedLM cannot be used for ANOVA?

I am successfully fitting a GLIMMIX with a particular formula on some dummies variables like below, but once fitted, I can't perform an ANOVA on that same model because the L1 norm isn't the right dimensions (I think based on the error prompt). Any…
0
votes
0 answers

construct formula for linear mixed efects model in MATLAB (fitlme) and understand output

I have a research question and am unsure about the linear mixed effects model in Matlab. The data are firing rates of neurons during trials of an experiment (firing_rate, averages per recording session, see below). Subjects perform a task and their…
Xena
  • 1
  • 1
0
votes
0 answers

How to calculate adjusted variances from linear models?

I would like to perform post-hoc analysis on adjusted variances rather than on adjusted means (lsmeans or emmeans). Is it possible to calculate adjusted variances? and to compare them? I have two different linear models: model1 = lm((Phenotype)~…
0
votes
1 answer

Linear mixed models with missing cells

I am helping another researcher with their coding in R. I did not work with them during the planning of the experiment design and now I could really use some help with this tricky design. I have four fixed factor: FactorA, FactorB, FactorC, and…
Biomol
  • 3
  • 2
0
votes
0 answers

Linear Non-Linear Modeling

So I've included code for 1 question for reference below. Question 3 asks me to assume that the linear predictor, takes the values between −5 and 5 equally spaced by 0.01. If the link function is logit, log (μi/(1-μi)) = x_i^t β, then compute and…
slycooper
  • 9
  • 2