1,596 questions
0
votes
1
answer
88
views
How to obtain predicted probabilities from a binomial GLMM?
I am modelling the probability of species presence based on environmental variables. My dataset contains both real presence data and pseudo-absence (randomly generated absence) data. My environmental ...
0
votes
1
answer
71
views
Why does `predict` not work for `lme4::lmer` when NA are present
I found related questions here (
1 (where I made a reference to this question),
2,
3
) but I can't figure out how I can really solve this problem within lme4. Because of an early error
cholmod-factor
...
2
votes
1
answer
77
views
How to bootstrap confidence intervals for predicted probabilities of a glm? [closed]
I am following the Maturity Schedules fishR Vignette by Dr Derek Ogle (https://derekogle.com/fishR/examples/oldFishRVignettes/Maturity.pdf) to generate stock assessments.
Following the code and ...
2
votes
1
answer
63
views
R: predict.glm for a logistic input produces a linear model [duplicate]
I've got a bit of a headscratcher from what I thought was going to be a routine fit. The logistic regression model I fit through the glm function instead gives a linear model when I use the predict ...
0
votes
1
answer
66
views
Terra predict function failing to predict my random forest model
I have a csv. with my data and I put it through a RF to predict sediment type based off of bathymetry data from 24 sample points (and get sediment distribution as an image output), the RF is working ...
0
votes
0
answers
129
views
How to gather predictions aligned with dataset from lightning trainer.predict?
When we use lightning in multigpu setting with strategy ddp,
predictions = trainer.predict(model, dataloaders=predict_dataloader)
the predictions are from a single gpu. From Combining loss, ...
0
votes
1
answer
60
views
Error when trying to predict using a cosinor.lm() model
I am trying to apply a model obtained from the cosinor::cosinor.lm() function to predict values of a dummy dataset by using the predict() function. However, when I run the predict() function, I ...
0
votes
1
answer
49
views
Error predicting with REEMtree model: Number of observations in newdata does not match group identifiers
I am using the REEMtree package in R to build a tree with random effects, but when I attempt to make predictions on the test data, I encounter the following error:
Error in predict.REEMtree(...
0
votes
0
answers
24
views
Interpolating daily persistence probabilities in package carcass
Disclaimer: I am new to R and survival analyses so apologies if I don't use the right terms or coding etiquette-figuring it out.
In the carcass package, I've used function persistence.prob to develop ...
0
votes
1
answer
33
views
predict.svm ignoring new dfm object as x
I am trying to run svm (from e1071 package) on a document-feature matrix produced by the package quanteda. I start by training the svm on training data:
svm_fit <- svm(x=dfm_train, y=as.factor(...
1
vote
3
answers
166
views
Deploying Keras model for prediction in Google Cloud Functions
I've been trying to deploy a very simple toy Keras model to Cloud Functions, which would predict the class of an image, but for reasons unknown, when the execution gets to the predict method, it gets ...
0
votes
0
answers
25
views
How to ensemble list of nn object from result of parallelly and neuralnet
I'm creating a backpropagation neural network in R using neural net
The data I use are montly u and v wind, sea surface, relative humidity data from era5 in netcdf (.nc) format to predict monthly ...
1
vote
1
answer
48
views
Why do scikit-learn predict(X) methods accept a 2D matrix rather than a 1D vector?
Does anyone know why the predict(X) methods of scikit-learn classifiers and regressors expect input X to be a 2D array (matrix) rather than a 1D array (vector)? I'm just curious about the history of ...
1
vote
1
answer
89
views
How to use parameter term names in avg_predictions() or hypotheses() functions?
I am attempting to estimate the difference in predicted probabilities between groups using the avg_predictions() function and the hypothesis argument from the powerful marginaleffects package. However,...
1
vote
0
answers
30
views
I keep getting this 'object not found' error. How do I fix it?
trying to use predict function to find ValueScore (vs in my chart) using different independent variables and a regression. encountered an error I cannot get passed.
sales <- read.csv("...
1
vote
1
answer
44
views
.predict() gives me warning
I made an basic multiple linear regression model and ı wanted predict some values but ı
took this warning
array=np.array([[26,1.5],[27,3]])
multiple_linear_regression.predict(array)
/Users/mali/...
1
vote
1
answer
70
views
Tensorflow predict() timeseries alignment in Python
Suppose I create a sequential input LSTM in Tensorflow along the lines of:
def Sequential_Input_LSTM(df, input_sequence):
df_np = df.to_numpy()
X = []
y = []
for i in range(len(...
0
votes
2
answers
112
views
R: Extracting values of x from a logistic curve fitted with nls [closed]
I'm pretty sure this has a very easy solution but I've been scratching my head at this all day and cannot seem to see where the problem lies.
I am graphing some pharmacological dose-response data (...
0
votes
1
answer
164
views
How to make a graph for average adjusted predictions at the mean using the svyglm
I am trying to figure out what is the most accurate way to plot average adjusted predictions at the mean using the svyglm function from the survey package. I have used two approaches so far. One using ...
3
votes
1
answer
112
views
Non-conformable arguments only when using a "chopped" (g)lmer model object
I am fitting a model with somewhat collinear predictors, and then predicting out of it. This works fine when using the original model object, but for performance reasons, I want to save a "...
0
votes
1
answer
285
views
Error when calculating SHAP value in xgboost model - feature names are different?
I have trained an XGBoost model using caret and now, I am calculating the mean SHAP value of each predictor using the package SHAPforxgboost, using the following code:
library(SHAPforxgboost)
...
1
vote
1
answer
403
views
Offsets in predict.glm(), given that the fitted poisson model already considered offsets - R
I want to predict a fitted poisson glm on newdata, given that it was fitted using offset=log(Exposure), but I get confused with the inclusion of the term "offset" inside of predict.glm(). I ...
1
vote
0
answers
71
views
Standard errors around predictions from Dirichlet regression
I am fitting a Dirichlet regression in R, with the DirichletReg package (version 0.7-1). In short, the Dirichlet regression extends the beta regression to C categories: bounded responses (0, 1) across ...
0
votes
1
answer
61
views
Error to estimate prediction interval in glmm with gamma family
I gathered 3 studies on healthy subjects assessing same biological parameter y.
y is a positive bounded parameter. His distribution follows a gamma distribution.
I have a model glmm wth gamma family
...
2
votes
1
answer
75
views
Generate predictions for GAM (mgcv) using penalised cubic spline forced through a certain point
I am using MGCV to generate predictions for a GAM using a cubic spline forced through a certain point. I have generated the gam exactly as outlined in this post: https://stat.ethz.ch/pipermail/r-help/...
0
votes
1
answer
387
views
Prediction values don't match fitted function from GAM model
I have a presence/absence data for a species occurrence and I did a binomial GAM using sea surface temperature (sst) as a predictor variable.
My df object is a data.frame with the presence/absence ...
0
votes
1
answer
154
views
How to successfully create raster of predicted values from spatial logistic regression? R spaMM package
I am trying to run a spatial logistic regression model using the spaMM package in R. I have a stack of three predictor rasters representing canopy height, canopy layers, and large tree density, and am ...
1
vote
0
answers
64
views
mgcv predict.gam in R version 4 gives error, in R version 3, no error
In R version 3.6.3, my predict.gam function gives a result. When I use R 4.x, I get errors for some types of predict, but not others:
library(gam)
library(dplyr)
gm1 <- predCol ~ s(VCF_nontree) + ...
1
vote
1
answer
75
views
Scaling Out-of-Sample Forecasts in a Model with Normalized Variables: Reverting to Original Scale
I'm working on making forecasts using a model where variables were scaled by $ x_i = \frac{{x_i - \text{mean}(x_i)}}{{\text{sd}(x_i)}} $, and I've saved the mean and standard deviation. Now, for out-...
0
votes
1
answer
134
views
Prediction using arima but showing error in Python
Here's the code using statsmodels.tsa.arima.model.Arima model to predict the store sales
from statsmodels.tsa.arima.model import ARIMA
from datetime import datetime
# fit model
model = ARIMA(ts, ...
0
votes
2
answers
247
views
Create a logit GAM species prediction raster using Terra [closed]
I am trying to predict the occurrence of a species (presence/absence) using a GAM in R. I have fit the GAM, but I get an error when I try to make the prediction to spatial data with terra::predict(). ...
1
vote
1
answer
115
views
Confusion matrix for PLSDA in R: "Error: `data` and `reference` should be factors with the same levels."
I am trying to run a Partial Least Squares Discriminant Analysis (PLSDA) in R, followed by a prediction and confusion matrix, using the mdatools package. The mdatools::plsda function works normally, ...
0
votes
0
answers
78
views
How to calculate predicted probabilites for MNL models estimated with mlogit() in R?
I have estimated a Multinomial Logit (MNL) Model using mlogit() from the R package mlogit:
df_long<- mlogit::mlogit.data(data = df_wide, choice = "vote", shape = "wide")
...
0
votes
3
answers
82
views
Need Guidance on Predictions with rand_forest and h2o with R
I have a random forest model that I'm trying to understand better.
For the sake of the example, lets say we have a grove of blueberry bushes. What we're interested in is predicting the production of ...
1
vote
0
answers
26
views
Error in merging the columns of multiple .csv files during Multiple Linear regression in R [duplicate]
I am trying to apply multiple linear regression between 4 predictors and 1 response variable using R. All these variables exist in separate .csv files , as there are more than 1000 data points in each ...
0
votes
1
answer
105
views
Replicate `margins` from Stata and calculate the difference between two predicted means with 95%CI
I am hoping to replicate what the fabulous Chuck Huber produced here (margins). In this example, he was able to calculate the predicted birthweight for mothers who were smokers and who were non-...
1
vote
0
answers
92
views
Mixed models using ASReml (binomial distribution)
I am fitting the following model using ASReml:
nmod11 <- asreml(fixed = Cocc_Prevalence ~ Sex + Age + Sample_Period +
Sex:Sample_Period,
random = ~ Animal_ID + ...
0
votes
0
answers
229
views
At what point do I transform binomial predicitions on logit scale back to the response scale?
I am working with nest success data. Nests are either successful (1) or not (0), depending on whether or not a nest produces at least 1 hatchling. Because this is binomial data, I am running glmmer ...
1
vote
1
answer
91
views
Trouble doing time series analysis in Python
I am hoping to do an event study analysis, but I cannot seem to properly build a simple predictive mode with time as the independent variable. I've been using this as a guide.
import pandas as pd
...
0
votes
1
answer
98
views
Error while using predict function for h2o.deeplearning model on raster stack
I am trying to use h2o.deeplearning model to predict on raster data. It returns me the following error
Error: Not compatible with requested type: [type=character; target=double].
Here is a minimal, ...
1
vote
1
answer
76
views
Handling Error Propagation Above Biological Thresholds in R with predictNLS
I'm working on a nonlinear regression analysis using R and have encountered an issue with error propagation. Specifically, I'm using predictNLS to estimate the errors of my predictions, but in some ...
0
votes
0
answers
74
views
Why would repeated measures random effects model values from polr() (in MASS package in R) be identical for all data points?
I have survey data involving two categorical IVs (Prompt_Condition and Response_Condition) of three levels each and one ordinal DV (value, a Likert-type ranking 1-7). There are 31 subjects who rated ...
0
votes
0
answers
60
views
Different mean predictions from brms model
I'm trying to plot the density curves from a brms model and add a line showing the mean predicted value. I've calculated the mean in two different ways, and the yeild slightly different results. Am I ...
1
vote
1
answer
591
views
predict values from brm
I have a brm model that I'd like to generate predicted values for a fixed value of one parameter (length). I think I need to do this with the posterior_predict function (or possibly the ...
0
votes
1
answer
136
views
Why can't I use "predict" after I load a gbm computed with gbm.step?
I am creating a boosted regression tree using the function gbm.step:
M <- gbm.step(data = DF,
gbm.x = c("X1","X2","X3","X4","X5",&...
0
votes
1
answer
92
views
Is there a way to use a time series to predict a numeric value different to the time series variable?
Ahoy,
As an example, I have multiple time series of temperature. These times series are of different lengths (1-8 days), and generally from non-overlapping date:time, but the interval between data ...
1
vote
0
answers
99
views
Predict x,y coordinates by z value in point cluster
i have point clusters in my point cloud and want to fit a line though these clusters along the highest density, to predict the x,y coordinate at a certain height. These clusters can mostly be ...
0
votes
1
answer
151
views
Why is ggpredict() not outputting robust standard errors?
I was following the instructions on this page:
https://strengejacke.github.io/ggeffects/articles/practical_robustestimation.html
I did a basic regression without robust standard errors:
data(mtcars)
...
2
votes
0
answers
541
views
YOLO vid_stride parameter is incorrectly cutting processing the video
I aim to make predictions at 30-second intervals within my video. How can I optimize the vid_stride parameter for this purpose? The video has a frame rate of 25 fps, consisting of a total of 7478 ...
1
vote
0
answers
290
views
Log images with DDP strategy in pytorch lightning with WandbLogger object
I'm building a model with pytorch lightning and I'm using the Distributed Data Parallel (DDP) strategy on 2 GPU for accelerating the process. After the fitting of the model, I need to return 4 pairs ...