Skip to main content
The 2024 Developer Survey results are live! See the results

All Questions

Tagged with
1 vote
1 answer
57 views

Finding largest root of a function in R

I have a function that is data generated and not a polynomial. For most data, it only has one root, but it can also have two roots, as in in the following plot: uniroot() tends to fail because the ...
cdalitz's user avatar
  • 1,235
2 votes
1 answer
45 views

What is the problem with my R code for solving and plotting a coupled system of ODE's?

I'm reasonably new to R and have this system of ODEs \frac{dS}{dT} = -\beta(1-\mu)S(t)\frac{I(t))}{1-D(t))} \frac{dI}{dT} = -\beta(1-\mu)S(t)\frac{I(t))}{1-D(t))}-\delta I(t))-\phi I(t)) \frac{dR}{dT}=...
Tom FitzGerald-Jones's user avatar
1 vote
0 answers
24 views

Ask a coding problem for the equivalence of unconstrained Optimization with L1 Regularization [migrated]

I recently read a statistics paper. It has an unconstrained problem: $$\min_\theta F(\theta)+\lambda || \theta||_1$$, where $$F(\theta)=L(\theta)+\frac{\rho}{2}|h(W(\theta))|^2+ \alpha h(W(\theta))$$ $...
PiVoyager's user avatar
1 vote
0 answers
65 views

Why are different variations of wrapping base R functions faster/slower?

I am wrapping a number of R functions in a library (purely for syntax consistency with other systems, not performance or anything else). Something like: ABS_1 <- function (x) { abs(x) } ABS_2 <- ...
FISR's user avatar
  • 63
0 votes
0 answers
25 views

R script for Bernoulli Equation from reservoir to pipe outlet with friction loss

I was able to write a script that used height as a function for resulting flow out of a pipe. Script attached. However, I am having issues adapting the script to account for friction loss within the ...
Blake Burkard's user avatar
0 votes
0 answers
29 views

How to solve error in TukeyHSD (R language) [duplicate]

I always get this error when I want to run the TukeyHSD() for my 2x2 ANOVA. Here`s the ANOVA I did: anova_result <- aov(mean_rt ~ congruency * coloring + Error(participant / congruency), data = ...
Selina 's user avatar
1 vote
1 answer
43 views

I am trying to draw a curve and showing it with a single line . Here I face the issue that instead of joining with a single line it shows many

I want to join this curve with single line. But theses points are merging with one another \lamda =1.8268470 beta= 0.6806978 delta=3.8760680 y<-c(2.01, 6.32, 3.52, 2.15, 5.42, 2.04, 2.77, 2.26, ...
Anu's user avatar
  • 11
0 votes
0 answers
50 views

How to find out the function of a negatively skewed curve to solve for Y based on X in R?

I would like to find the function of the following plot so that I may find the Y value for any given X. This data frame is supposed to look like a negatively skewed distribution curve in order to ...
Dan Pritchard's user avatar
0 votes
1 answer
66 views

R Lottery function: What's wrong with my work?

I have here a question from an online quiz set by my university (already submitted, so I'm just curious to know what the discrepancy is) As you can see, there is a set.seed which I have put s into (...
Ultima DoombotMK1's user avatar
0 votes
0 answers
50 views

One math problem for one row and 3 columns

I am a beginner and am confused; What I have so far I am supposed to use this data to find: 3e^-x-y^5+2z How do I combine all these math functions into one to solve? I'm supposed to calculate that ...
roseydream's user avatar
3 votes
1 answer
214 views

How can I compute a dual norm?

Suppose I have a norm ||x||. Is there an R function or method that allows me to calculate the dual norm ||y||_* = \max_{x} x^Ty : ||x|| ≤ 1 ? My initial thought is that this falls under a constrained ...
Sparsity's user avatar
  • 197
0 votes
1 answer
97 views

finding the median of a PDF with r

so i was messing around in r and i was trying to make a function that finds the mean, variance and median (also possibly bounds) of a function. i've been able to get the mean and variance working but ...
Nabil's user avatar
  • 13
0 votes
0 answers
25 views

Error in match.arg(opt.crit) : 'arg' must be NULL or a character vector

I have an code but it have an error In R, I do not know how to run it. enter image description here And here should be run out like this enter image description here library(forecast) library(itsmr) ...
zehao li's user avatar
0 votes
0 answers
52 views

How can I remove rows with N/A values after tabulating the database?

This is the code itself. The issue arises when I tabulate the information; the table contains 'Na' values for species that are not found in the sample area. Therefore, I need to find a way to ...
Darthgigas's user avatar
4 votes
2 answers
97 views

R: Plotting a Combinatorial Function

I am working in the R programming language. I am trying to make a plot from n=0 to n = 1000 for the following function (link: https://www.youtube.com/watch?v=iH2kATv49rc&t=7s): First, I tried to ...
stats_noob's user avatar
  • 5,705

15 30 50 per page
1
2 3 4 5
43