Why is this error message coming up? - r

When I run a regression on a data set:
ord_reg<- clm(as.factor(Resp)~log10(Dose), data=dataframe, link="probit")
I get the following error message:
Error in qr.default(X, tol = tol, LAPACK = FALSE) :
NA/NaN/Inf in foreign function call (arg 1)
What is the reason for this? Note that the titles of the data set being called in the regression are the same as that of the data set (i.e. "Dose" and "Resp").

Look at summary(dataframe), as well as summary(log10(dataframe$Dose)).
You may see some NA/NaN reported, possibly because of negative values being given to log10().

Related

How do I fix a dissimilarities error in an adonis2 test in r?

I've just tried to carry out an adonis2 test using the following code
adonis2(abundance.data~Site, data=df, method="bray") as in a previous post How can I fix an error with adonis2 test?
However I keep getting this error message
Error in if (any(lhs < -TOL)) stop("dissimilarities must be non-negative") :
missing value where TRUE/FALSE needed
In addition: Warning messages:
1: In vegdist(as.matrix(lhs), method = method, ...) :
you have empty rows: their dissimilarities may be
meaningless in method “bray”
2: In vegdist(as.matrix(lhs), method = method, ...) :
missing values in results
Just wondering why this may be and how I can fix this issue

Calibration plot error - Non-Numeric argument to binary operator

I am unable to produce a calibration plot for my logistic classification model, and I am unsure of why I am getting this error / how to fix it.
For the purposes of reproducibility, here is a made up example:
library(tidyverse)
library(classifierplots)
test.df <- as_tibble(data_frame(y = factor(c(0,0,0,0,1,1,0,1,0,1)),pred = c(0.1,0.15,0.2,0.05,0.6,0.7,0.2,0.85,0.1,0.75)))
calibration_plot(test.y = test.df$y,pred.prob = test.df$pred)
When I run this, I get the following error:
Error in alpha * 255 : non-numeric argument to binary operator
Similarly, when I run the code with my actual model, I receive the same error. Any ideas?

Error message when using psych::ICC: argument is of length zero

I would like to compute the ICC for a regression model (done using lmer function), but I always get this error message:
Error in if (n.obs < n.obs.original) message("Warning, missing data were found for ", :
argument is of length zero
Here is the function I used:
ICC(model1, missing = TRUE, alpha = .05,lmer = TRUE,check.keys = FALSE)
What I don't understand is that the ICC function should be able to handle missing values. This is why I have used the package "psych and not the package irr`...
Thank you very much for your help :)

Fitting a student t distribution in R using fitdistr() yields error “non-finite finite-difference value”

Reproducable example which will give the mentioned error code every time is:
(Note that even without set.seed, the error comes up every time)
library(MASS)
set.seed(seed = 1)
data<-rnorm(n = 10000,mean = 0.0002,sd = 0.001)
fitdistr(x = data,densfun = "t")
The error message is:
Error in stats::optim(x = c(-0.000426453810742332, 0.000383643324222082, :
non-finite finite-difference value [2]
In addition: Warning message:
In log(s) : NaNs produced
The problem is the "non-finite finite-difference value". Fitdistr does not give me a result.
My knowledge:
I researched and apparently this could mean that a parameter is negative during the iteration. And that the solution could be to provide a better or at least different starting value. But I could not figure out how to do this and I am not sure if this is the issue.
MY QUESTION:
a) Why do I get this error message
and
b)how can I fix it in R, so that I can fit the student-t distribution to my normally distributed data?

Error for predict() with lmer

I'm using a leave-one-out method to evaluate how well a model with one datapoint excluded predicts that datapoint (rotating through all datapoints). The code below has successfully run on essentially the same data with a slightly different DV, so I'm stumped as to why I'm getting the error that I'm getting. Here's the relevant chunk of code:
dataPennTrim.lmer <- lmer(logDur.PENN~cNewNounDen*ContextCode+
Vowel.Contrasts+BlockCode+
(1|subject)+(0+ cNewNounDen +ContextCode|subject)+
(1|word)+(0+ContextCode|word),
data=pennTrim,
control = lmerControl(optimizer = "bobyqa"),REML=FALSE)
pennPred <- predict(dataPennTrim.lmer, newdata = dataFull2)
dataFull2 has the same columns as pennTrim, it just has more rows. Pretty standard use of the predict() function. I get this error:
Error in t(.Call(Csparse_dense_crossprod, y, x)) :
error in evaluating the argument 'x' in selecting a
method for function 't': Error: Cholmod error 'X and/or Y
have wrong dimensions' at file ../MatrixOps/cholmod_sdmult.c, line 90
Any thoughts about what might be causing this error? I can use essentially the same code with the same dataframes swapping out logDur.PENN for logDur.Manual (measurements from a different source) and the code gives no errors.

Resources