Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [r]

Use this tag for any *on-topic* question that (a) involves `R` either as a critical part of the question or expected answer, & (b) is not *just* about how to use `R`.

1
vote
1answer
29 views

How to correctly model repeated-measures random effects in a linear mixed effects model

I have a mixed design data set where participants respond to each of three interventions and also report various demographics. The intervention is thus repeated-measures and each demographic measure ...
0
votes
0answers
7 views

Initial simplex for the Nelder-Mead algorithm in R using the “optim” function

How does R create the initial simplex when using the "optim" function? Is it different to the method applied in Matlab's "fminsearch"? Are there any other differences in the implementation? I have ...
0
votes
0answers
15 views

Jaccard Index for Binary Data in R using dist function

I have a presence/absence table of 0s and 1s and I would like to cluster this data. I want to create a pairwise matrix using R's dist function which has a binary ...
0
votes
0answers
24 views

How to calculate coverage probability in R for cauchy distribution?

I know that the coverage probability is $P(|\hat{\theta}-\theta|\leq\epsilon)$. My task is to compare estimators of the Cauchy distribution for the location $\theta$. I've plotted the estimators and ...
0
votes
0answers
19 views

How are these two power law fitting glm models different?

I have some data that I thought I'd try fitting with a power law (in R). ...
0
votes
0answers
10 views

Effect size on the difference between group differences (ΔA-B vs ΔA-C) using R

I am trying to calculate effect sizes, but all I can find on the web relates only to the effect size of the difference between two groups. What I am interested in, is the effect size of the difference ...
0
votes
0answers
35 views

How do I set up the data for a Friedman Test?

Below is a small sample of a very large data set (over 10,000 records). All I'm trying to do is determine if there's a statistically significant difference found in the ordering of supplies among ...
0
votes
0answers
11 views

problems in plotting decimal value distribution with bin width normalization in r using hist()

I am plotting data distribuiton. I get the expected plot with data which are only integer numbers. But I didn't get appropriate plot for decimal data sets. The code with integer numbers data as ...
0
votes
0answers
21 views

Regression line equation [on hold]

How i can get the equation of regression line on my plot just like in excel? I can't figure it out... Here's my code: dane<-read.table(file="+.csv", sep=";", dec=",", header=TRUE) dane dane$Q.nC. ...
0
votes
0answers
5 views

Size of serialized object of class recipe [on hold]

Using the R package recipes to preprocess our data. Even with the retain=FALSE argument in the prep function. This recipe takes up more than 450 mb when serialized on disk. It is most likely not a ...
0
votes
0answers
17 views

Automating data preparation and model fit steps for multiple products

My question is in continuation to the these questions: Question 1 Question 2 Question 3 Question 4 I am also attempting to automate the forecasting of financial parameters of multiple products in the ...
0
votes
0answers
5 views

How we can extract vcov from MSwM R package [on hold]

Please is there any method to extract variance covariance matrix from MSwM R package or to calculate it by hand. Best
0
votes
0answers
20 views

Additivie vs multiplicative time series in R

Is there a function, or a way, in R that helps me know if my time series should be decomposed into an additive model or multiplicative model?
0
votes
0answers
7 views

How to calculate eigenvalue from inverse correlation matrix (I mean mathematically & conceptually , not using R in eigenvalue decomposition) [on hold]

To the question posted, I find this below note extract but could not find further explanations and hence stuck here, hopefully someone would be nice to lend a help. Appreciated a lot! (Italic parts ...
0
votes
0answers
8 views

How to fit a Poisson-Tweedie model with power parameter fixed with mcglm

I'd like to fit a Poisson-Tweedie model with power parameter fixed (particularly, p=2). I`m using the following code, according to Case number 7 - Set of examples 1 - Univariate models - Author: ...
0
votes
1answer
18 views

How to use Cullen and Frey graphs for downstream statistical analysis?

How to use Cullen and Frey graphs for downstream statistical analysis? I do not see any difference in normalized and raw data Cullen and Frey plots! Raw data ...
0
votes
0answers
8 views

R glmmadmb continuous vs categorical interaction multiple comparisons

I'm running a model using glmmadmb and I'm not sure how to do multiple comparisons on an interaction between categorical and continuous predictors. Here are details on the model and data: My ...
0
votes
0answers
9 views

Need database set on annual income effect on weight with other variables [closed]

looking for a database set with the effect of annual income on weight along with other variables including region, gender, height, etc.
2
votes
1answer
40 views

Fitting model without the intercept [on hold]

Suppose I collected data of crop yield at a location for mutliple years and constrcut a model of the form lm(yield ~ drought_index + solar_radiation + heat_stress) ...
0
votes
0answers
29 views

Calculate Gini coefficient by hand

I have been asked to calculate the Gini coefficient (dispersion of allocation weighting) in 18 sectoral ETFs with historical data available since 2000. Here is an excerpt: ...
2
votes
1answer
85 views

Bootstrap for goodness of fit

Suppose I want to test whether a die is fair. I toss 60 times with outcome $X = (40,20,0,0,0,0)$ where $i$th coordinate denotes times of $i$th face occurs.Consider Hypothest test($\alpha = 0.05$): $$...
0
votes
2answers
30 views

R - Help interpreting GLM and ANOVA output

Am I correct in understanding that the effects of flood.level and plant.species are significant predictors of Inv.Simpson (my measure of diversity)? Is it also correct to say that the effect of ...
0
votes
0answers
17 views

Predicting whether a potential business agreements will be won or lost [on hold]

I am currently working on a project using a sales system and trying to come up with a way to use the current pipeline of potential sales to predict if the business agreements will win or lost based on ...
1
vote
1answer
63 views

Model for forecasting daily page views of a web page in R

I have to forecast daily page views of a web portal. We have the daily page views of the data for the last 2 years. We have to forecast for next 90 days. I am using a multi-seasonal (with season ...
0
votes
0answers
5 views

Assign variable name to desired parts in a function in R [closed]

I am new to R and here. Sorry If I am complicated. I created a function by trial name. There are some functions from my own function below. ...
0
votes
0answers
7 views

Is there a R package of text mining which does string matching using “CTE+CDAM” http://www.vldb.org/pvldb/vol7/p1167-londhe.pdf? [closed]

I try to use string matching algorithm to calculate string distance, i.e, how similar two strings are. I am using two R packages: tm and stringdist. But I found there is a paper "matching titles with ...
2
votes
1answer
51 views

How to choose “family” in Generalized Additive Model (GAM)

When modelling a GAM model using mgcv in R, we need to define the family = . I tried some families (e.g., Gaussian, Gamma), R ...
0
votes
0answers
12 views

R Replicate observations in Dataframe [closed]

I have 3 factors, the first one is call cat1, range from 'a' to 'd', and the second factor, cat2, has two levels, 'Y'/'N', and the 3rd, cat3, have 3 levels, 0/1/2, i would like to generate below data ...
0
votes
1answer
13 views
0
votes
0answers
27 views

How to add covariate x time interaction term in poisson model in R(relsurv package)

I tried to do relative survival analysis specifically poisson regression in relsurv package. And I want to include covariate x time interaction term since the hazard (or excess hazard) in my model is ...
-2
votes
0answers
16 views

How to make a loop skip the space between words in R [closed]

i need to write caesar cipher function, and it doesnt work on strings with space. ...
0
votes
1answer
124 views

Time series forecast - ARIMA/ARIMAX with daily data [on hold]

I am working on a project to analyse and forecast time series for sales and revenue of a client. There are various models that i want to test for accuracy purposes - namely Holt Linear Method, Holt ...
-1
votes
0answers
15 views

Including all rows for an ID if ID meets a condition once in panel data in R [migrated]

I'm sorry if a similar question has been answered already but I can't seem to find any posts helping me. I wish to define two separate intervention groups (linked to this previous question I asked ...
-2
votes
1answer
17 views

I need to do the Caesar chipher code. it doesnt work well [closed]

my code works only on numbers between 1-26 and only on string of one word. ...
0
votes
0answers
10 views

I want to do a vector of string [closed]

How can I do that space between words will not be count? For example: ...
0
votes
1answer
17 views

Mixed effect zero inflated negative binomial model: “the leading minor of order 1 is not positive definite”

I am having trouble fitting a mixed effect zero inflated negative binomial model to my data using the GLMMadaptive package: ...
0
votes
0answers
17 views

static random effect probit model [closed]

I am novice in R language and need help I need help in R language to code static random effect probit model. Requirement for model is Y and X are observable and fixed effect & beta are to be ...
0
votes
0answers
14 views

Likelihood ratio test function- manually in R [closed]

I am trying to write a function in R, which implements the likelihood ratio test for all well known densities. The input must contain datas, the density function, and the H0 parameter, with its name. ...
2
votes
1answer
28 views

problem regarding time series modeling using R

I have this time series data and my aim is to fit a time series model. When i plot the time series data , it seems to be data is not stationary. These are the plots based on the first difference, ...
1
vote
1answer
15 views

What does linear regressor output mean? I am using tensorflow estimator in R

I try the code at tensorflow in R tutorial (https://tensorflow.rstudio.com/tfestimators/) but I cannot understand the output what the code produces. Code: ...
0
votes
0answers
15 views

Weighting of the mean [closed]

I have this kind of data: z x y 1 A 50 2 B 10 3 B 30 4 C 20 5 C 30 6 C 5 x is a provider of a product and ...
1
vote
1answer
27 views

Splitting panel data into subgroups

I have a (an unbalanced) panel dataset of individuals over different periods of time (one time period = one month). I'm attempting to analyse the effect on the level of activity of the individuals of ...
0
votes
1answer
19 views

R: Methodologically sound way to determine which interaction effects to include in logistic regression? glmulti()?

I ran a logistic regression (in R using the glm function) and didn't find significance for a variable I expected to be significant (numerous articles have found significance). When I examined my data ...
0
votes
1answer
25 views

Optimisation by using directional derivative

So I’ve seen the code of an R package where a two dimensional optimisation (actually MLE, finding the minimum of the negative log likelihood) is performed with the optim function and also two optimise ...
-1
votes
0answers
46 views

Error message: Error in colMeans(x, na.rm = TRUE) : 'x' must be numeric [closed]

I'm new to R, and have been trying to run PCA on all the variables. I've included a screenshot of my ...
0
votes
1answer
35 views

Understanding the example in ?prcomp (R)

I'm trying to understand, in simple terms, the following example copied from prcomp in R: ...
2
votes
1answer
76 views

Ripley K function value in a specific radius and dataset using R's Kest function

I'm having general trouble with calculating Ripley's K function values. The following is a simple spatial point pattern, where both X and Y range from 0 to 200: Here's its corresponding Ripley K ...
0
votes
1answer
50 views

My P-value Manually Calculated is Different from when I use the Prop-Test, in R Studio

Trying to calculate the p-value manually and then demonstrate it using the Prop test but I keep getting different P-values. ...
0
votes
0answers
22 views

Intra-Day Time Series Forecasting w/ non-continuous data

I have 8 sample frames taken at the end of each quarter starting in 2017Q2 and ending in 2019Q1 for a stock ticker. Each sample frame consists of 2 trading days worth of stock data (open, high, low, ...
0
votes
0answers
18 views

How to do random simulations on R [closed]

Draw 1000 Uniform random variable. You know the true mean. You can use the standard deviation of your data or you can calculate the true standard deviation and use that. How often does your data fall ...