All Questions
44 questions
1
vote
1
answer
37
views
Binary predictive classification in R, with predictors consisting of multiple values
I am struggling currently with constructing a binary glm predictive classifier, due to an issue with dimensionality.
I have a dataset of N samples where each sample has values for M entries (genes) ...
2
votes
0
answers
17
views
Force GLM through zero [duplicate]
I am working on a glm model using a binomial distribution. I want to force the intercept through zero, as I know that biologically this makes sense. I have used the formula to ...
0
votes
1
answer
98
views
How can I calculate residuals of a dependent binary variable, using a glm (logistic) model that was fit on a different sample?
I have a data frame D1 in R with a dependent binary variable Response (0/1) and a set of covariates like age and gender. I want to know how "typical" ...
0
votes
1
answer
216
views
Prediction of Pure Premium with offset
I'm modeling a pure premium with glm and using an offset term equal to log(exposure).
My question is, in R, what does ...
1
vote
2
answers
821
views
If I use 'quasipoisson' as family to GLM on non-integer data, can it be treated as poisson?
I'm trying to build a model based a data from package GLMsData
library(GLMsData)
data(lime)
my model is,
...
0
votes
0
answers
89
views
Ensemble model predicts negative and extreme values for a non-negative response variable
I am using SuperLearner() in R to create an ensemble model composed of GLM, GAM, randomForest, gradient boosting model, and multivariate regression spline models. My response variable is tree density, ...
0
votes
0
answers
661
views
What plot should I use? (glm predicted vs actual)
I have made a linear regression model (using the glm function) to predict the number of medals a country will win based on GDP. I have the data for the actual number of medals won.
I can't seem to ...
2
votes
2
answers
407
views
Which coefficients to include in out-of-sample prediction?
I am estimating a logistic regression on a subset of my data and predicting the outcome for the whole sample.
In the regression only some data are statistically significant at the chosen level. ...
5
votes
1
answer
6k
views
How to use a GAM to predict the probability in binomial data as a function of predictors
I'd like to predict the probability of success as an unknown function of predictor variables. For example, consider the following fake data
...
0
votes
0
answers
260
views
How to calculate the survey mean with a categorical auxiliary variable in R "survey"?
When I use a continuous auxiliary varaible in svyglm, I can predict the mean of the dependent variable from the mean of the auxiliary variable (MRE below). How do I ...
0
votes
0
answers
24
views
Predict the injury time of a football match?
I have a project which requires me to predict the injury time of a football match. And I have the relevant information, such as goals, corners, referee, 2 team names and the injury time for each half.
...
2
votes
1
answer
2k
views
Error: coef/vcov not consistent with basis matrix
I am trying to understand predictions from distributed lag no linear models. I use trial data from R and I run a glm model with crossbasis matrix from DLNM package. When I am trying to get the ...
0
votes
0
answers
59
views
Including interaction term without main term with possible aliasing
I'd like to model an interaction term between a continuous variable and categorical variable, while accounting for possible aliasing in the variables. I was wondering what the best way to do this was.
...
1
vote
2
answers
3k
views
Compare predicted versus actual outcomes in a GLM
I read somewhere that you could compute a "residual value" for a GLM by taking the actual values of your response variable divided by the predicted value of that response variable.
For example, ...
0
votes
1
answer
774
views
Predicting outcomes with categorical predictors
My dataset is formulated in a contingency table. My predictor variables are categorical and my dependent variable is the number of observations observed. How do I predict outcomes and find residuals?
...
2
votes
0
answers
153
views
Why Standard Deviation equal to 0 by GLM prediction?
This is my dataset:
...
4
votes
1
answer
6k
views
Get equation from glm coefficients: calculate y manually?
I am trying to understand the math behind the glm(). Specifically, how to apply equation based on model predictors to calculate my ...
3
votes
0
answers
346
views
R predictive plot with cplot and GLM
I am using the cplot() command from the margins package to analyze predictive outcomes across different model specifications while coming across two issues. Below ...
1
vote
0
answers
2k
views
GLM Frequency and Severity Models. How Do I improve from here? (R code) [closed]
Background:
I've been tasked with creating a rating model by Peril using GLMs. It's commercial lines property, so the data is pretty sparse. The carriers have been asking for Premiums by peril, so we'...
1
vote
2
answers
735
views
Logistic regression and prediction
I'm following this tutorial to fit a logistic regression model on to my data which has a binary response. I've understood the reasoning behind each step, apart from why the author checks the first 5 ...
0
votes
0
answers
538
views
Fit, AIC and deviation of my generalized linear model (poisson)
I need to fit a GLM (generalized linear model) in R, something like
...
1
vote
1
answer
49
views
When and during what criteria do we use interaction variables in R for modelling?
What if I run a lm() and it shows no variable as significant what do I do? If I have to use interaction variables how do I decide the interaction between the ...
1
vote
2
answers
699
views
Replicating R glm
Trying to replicate the scoring of the glm function in R.
Preparing the data
...
0
votes
0
answers
2k
views
Degrees of freedom for total sum of squares in Linear model without intercept
When we run a linear model with and without intercept, in case of without intercept model we have degrees of freedom for TSS exactly total number of observations in the response variable. Why is it so?...
4
votes
1
answer
618
views
GLM Equation Interpretation
I have developed a glm Poisson model in R and would like to extract the formula so that I can do the computation in another software language. When I write out the equation I am getting different ...
0
votes
1
answer
2k
views
(R) How could I predict the result of a new dataset based on the results on an old dataset
I have a historical dataset which tells who bought our products. This dataset contains
ID,
Age
Gender
Salary.
I have another set of data which contains the four fields above.
How should I use <...
0
votes
0
answers
2k
views
What's the reason for getting NaN values when predicting Tweedie GLM response?
Question is in the title.
Not asking an R question, but the NaN result was in R. I just wonder why this happens for Tweedie GLMs. Example code in R, where ...
0
votes
0
answers
117
views
race dataset in R how to improve the predictions
I have a dataset from 2002 to 2016 with information about the results of a road bike race. I am trying to predict the results after applying different models but the results are not great and I am ...
5
votes
1
answer
9k
views
What glm family for continuous positive data
I'm currently building a prediction model in R. My output variable is the market price of an item, so the value should be greater than 0.
I am using a GLM and ...
1
vote
1
answer
165
views
Logistic regression doesn't fit this Infection risk analysis. Wrong model?
I am looking at a logistic regression model for predicting hospital acquired infection likelihood (HAI) from predictors of whether germs are found on the x number of patients (Patient), x number of ...
0
votes
0
answers
53
views
Confusion about predicting using `glm()` logistic regression
I have been provided a sample logistic regression as follows:
...
1
vote
1
answer
3k
views
Which model should I use to predict pass/fail scenario?
I am new to predictive modelling. I am unable to choose the correct model for predicting if a student will pass or fail a particular exam.
My data set :
Input variables: Total_tests_Taken , ...
3
votes
2
answers
9k
views
How to validate my glm model
probably the title is not very clear but here goes :
a built a gml model on my train set with
model=glm(y~x1+x2)
and now i'm predicting the output on the test ...
25
votes
3
answers
9k
views
Can a model for non-negative data with clumping at zeros (Tweedie GLM, zero-inflated GLM, etc.) predict exact zeros?
A Tweedie distribution can model skewed data with a point mass at zero when the parameter $p$ (exponent in the mean-variance relationship) is between 1 and 2.
Similarly a zero-inflated (whether ...
0
votes
2
answers
1k
views
Getting fitted values same as observed values(actual values) after performing glm() in R
i have some sample testing data as shown below.
...
9
votes
1
answer
5k
views
Poisson regression for count data - predictions
This is probably an elementary error in either my understanding or my R implementation: I am trying use a Poisson model to make some predictions. The original data is discrete count data. I would ...
1
vote
1
answer
5k
views
I was expecting 0 and 1 as an answer of a predict function in r
I'm doing a binomial family with method="glm" in train function (caret package) and as result I'm getting predicted numbers like "0.62325028 0.51807017 0.67119878 ..." and I was expecting vector ...
4
votes
1
answer
2k
views
Is it possible to get a covariance matrix of fitted values for a GLM model in R?
I would like to get a covariance matrix of fitted probabilities for a logistic regression model in R. I would like to do this because I want to find the variance of the difference between the two ...
9
votes
2
answers
24k
views
SE of fit versus SE of prediction
I would like to get the standard error on a prediction. Using R glm, I can get the SE of the fit for a specific prediction:
...
6
votes
3
answers
7k
views
How to specify/restrict the sign of coefficients in a GLM or similar model in R
The situation: I'm struggling with a predictive analysis of food sales prices using a generalized linear model. My dataset contains different kinds of food (cheeses, vegetables, meats, spices etc.) ...
4
votes
0
answers
560
views
Plot prediction for covariates from GLM
I have run GLMs and got my final model that fits my data. Now I would like to plot each of my important covariate versus the predicted values. I would like to keep all the other covariates of the ...
6
votes
2
answers
2k
views
What is behind JAGS (Just Another Gibbs Sampler)?
I have been using JAGS but I am not quite sure how it actually simulates it values. I need to know in a general sense what's going on in the background.
7
votes
0
answers
9k
views
Prediction with CI - predict.glm doesn't have interval option [closed]
I have a model and a graph:
n1 = glm(formula = cbind(ml, ad) ~ x1, family = "quasibinomial")
plot(x1, ml/(ml+ad))
And I would like to plot a predicted line with ...
12
votes
1
answer
13k
views
Predict GLM poisson with offset
I know this is probably a basic question... But I don't seem to find the
answer.
I'm fitting a GLM with a Poisson family, and then tried to get a
look at the predictions, however the offset does seem ...