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`.

learn more… | top users | synonyms

0
votes
0answers
6 views

Calling predict after training with polr on multicollinear data

Take a look at the code below. This question has been asked before but shut down - presumably for lack of R code to reproduce the problem. Basically, when there is multicollinearity in the data, ...
0
votes
0answers
12 views

Good way to weight some data based on inverse probability of occurence

I am trying to weight some observations from some data (this kind of thing is new for me). Basically it is observational data not designed as a weighted survey, but I want to use inverse weights to ...
1
vote
0answers
25 views

Fit truncated Poisson distribution in R

I am trying to fit a Poisson distribution with zero-truncated, imperfectly observed data. I have a set of samples for which I can observe 1 counts and >1 counts, although I don't know what the >1 ...
0
votes
1answer
28 views

How to calculate ideal amount of reps needed for good average in R

Basically, I have some samples I'm processing to get moisture results on and I want to get a good average on the readings based on the ideal amount of repetitions. Duplicates is not enough and 10 ...
0
votes
0answers
17 views

Interpreting the output of additive model

The gam package of R can be used to fit additive models. I'm trying to understand the output of the summary() function. This is ...
1
vote
1answer
32 views

Identity of residual distribution, and identification of correct model in multiple categorical linear regression

I am using R for this analysis, and so examples and graphics will be produced in this language. I am willing to provide equivalent examples in similar languages if it will help someone, and am willing ...
1
vote
0answers
32 views

Fitting ARIMA+GARCH in R [closed]

I have a line of code in R: ...
0
votes
0answers
30 views

How to calculate the sample size for proportions using Effect Size?

I need to determine the sample size for my experiment. In my experiment I will select a set of x projects, from a population of N project. For the sample x projects will apply a treatment to know the ...
2
votes
1answer
31 views

Gstat: Modelled semivariogram values not matching plotted model using the variogramLine function

I am trying to extract the semivariance values associated with a given semivariogram model developed in gstat, the end goal being to compare modelled semivariance with observed semivariance at defined ...
0
votes
0answers
41 views

Test of Equal Proportions with exact p-values [duplicate]

The question "Test of Equal Proportions with zero successes" showed me that using a test of equal proportions with very low or very high numbers of successes doesn't give an accurate p-value. Below is ...
0
votes
0answers
17 views

lmer with very small sample size [duplicate]

Can lmer be performed with random slopes and intercepts when n=3?
0
votes
0answers
7 views

Understanding divisive clustering code

I came across divisive clustering algorithm (Cichosz, P. (2015) Data mining algorithms: Explained using R; page 262), which is implemented in R. The appropriate function is pasted below. Actually, I ...
0
votes
0answers
13 views

Fitting a Fractional Logistic Model using GLM in R

I have a response variable that is a proportion bound between 0 and 1. I would like to fit a fractional logit model using R. I've consulted a few posts on crossvalidated and stackexchange and came up ...
0
votes
0answers
12 views

Gower Distance, Ordinal Variable, R, Error?

I am trying to implement the CritCF function from http://www.sciencedirect.com/science/article/pii/S0031320310004905 for feature selection in clustering. I need to compute the distance from cluster ...
5
votes
2answers
178 views

Poisson GLM with non-count data (rate data)

My question is related, but not the same as the following question: Fitting a Poisson GLM in R - issues with rates vs. counts Here's some fake data: ...
0
votes
0answers
7 views

Sorting by lift and confidence using arules package in R [migrated]

Is there a way to sort rules by confidence and lift at the same time? I got: rules_order <- sort(rules, decreasing=TRUE,by="confidence") but I cannot order ...
0
votes
0answers
11 views
1
vote
1answer
58 views

Percent of variation explained by individual covariates

I understand total variance and R squared in linear regression outputs, but I have difficulty to understand the percent of variation explained by each covariates in a multiple regression analysis. I ...
4
votes
1answer
56 views

Is an ANOVA applicable for these data?

I have a data set from 7 groups, with 20 fish in each group. Measurement of a parameter is made on 25 cells from each fish (so each observation in the data-set is completely independent, right?). ...
0
votes
0answers
40 views

Should I ignore negative prediction values?

I have the following time series of count data: ...
0
votes
0answers
8 views

Zero-inflated negative binomial model with interactions between categorical variables

I need assistance with interpreting interaction effects for a zero-flated negative binomial model with categorial predictors. The IVs are gender (0=male, 1=female) and diagnosis type (ED_type ...
0
votes
0answers
8 views

The fit of latent class analysis

The results section of a study investigating disease pattern using latent class analysis states that The drop in likelihood ratio G2 relative to the drop in degrees of freedom is substantial ...
1
vote
1answer
33 views

Interpreting interaction effects in probit regression model

I have run a probit regression model with one 2-way interaction and am having trouble interpreting the results. Both variables are categorical and so one level of ...
0
votes
0answers
16 views

Why the weighted least square $R^2$ from R summary doesn't match my manual calculation

I have a weighted least square model and I wanted to calculate $R^2$ manually, but my results don't match the R summary. Why is that? ...
1
vote
1answer
60 views

Probability of an unknown distribution

I have the sample of a variable $X$ whose distribution is unknown and I would like to know how to estimate the probability of $X$ taking some values. How can I do that? I assume that there's a non ...
1
vote
0answers
25 views

Polynomial regression providing odd p-values

I have the data: ...
0
votes
1answer
12 views

Lattice formula syntax for 'calibration' function in caret

I would like to use the function 'calibration' from the caret package to produce calibration plots for a few classifiers that I have. Unfortunately I am having trouble understanding the documentation ...
0
votes
1answer
26 views

Types or Methods of Testing Correlation

Suppose I have two variables, which have over 500 data points per variable (though they are not continuous on timeline). what other kind of methods or test in can use in R to test the correlation? ...
0
votes
1answer
16 views
0
votes
0answers
10 views

Time varying covariate in within-subject factor

A researcher will collect data of dependent variable Y (from 100 subjects). Variable Y is continuous and reflects consumption measured in grams. The dependent variable is measured at three occurrences ...
0
votes
1answer
31 views

Fitted values from regression on first differences

I wish to predict variable $y$, and so I am tempted to estimate $$ y_t = \beta_0 + \beta_1 x_t+ u_t $$ Looking at a plot of $y$, the series does not seem stationary. Instead I regress like so: $$ ...
0
votes
0answers
16 views

Cox Regression Hazard Ratio in Percentiles

I computed a Cox proportional hazards regression in R. cox.model <- coxph(Surv(time, dead) ~ A + B + C + X, data = df) Now, I got the hazard ratio (HR, or ...
0
votes
1answer
33 views

Interpreting Marginal Effects

I am running a probit glmer, with a binary response varaible and a categorical explanatory variable with three dummy levels and have tried to calculate the marginal effect using the following code: ...
0
votes
0answers
12 views

Partial db-RDA factor disappearing

I analysed my data with capscale() an used a Condition() argument in the formula, to address pseudo-replication. And it happens most of the time, that i get the following output, when performing ...
0
votes
0answers
16 views

Data transformed in order to satisfy regression assumptions but no effect

I am trying to use "Cursor" , "PostCursor" and "CTLE" to predict "left", and I added interactions and quandratic in the model. ...
0
votes
1answer
24 views

Same result for post-hoc test and probit regression

I am getting the exact same results for a probit regression and post-hoc tests (simultaneous tests for linear hypotheses) - is this because I have used a dummy variable in the probit model and so it ...
0
votes
1answer
22 views

Is it necessary to report standard errors with marginal effects?

I've run a probit regression in R with a random effect and can find no way to get the marginal effects with s.e. and p values. I have therefore tried to calculate the marginal effects 'by hand' by ...
0
votes
1answer
23 views

causal impact R package- finding individual day values

In the causal impact R package is there a way to get the counterfactual values and confidence intervals for each day rather than average or cumulative?
0
votes
1answer
33 views

Calculate probability of event from ecdf in R

I'm using R and would like to calculate the probability of an event happening. I used the ecdf function on daily revenue (month-to-date). I have a target and a daily number necessary to hit target ...
-1
votes
2answers
46 views

How to define clustering in R

The data contains information about the genes causing breast cancer in our body. My aim is to find the most effective gene on breast cancer in our body. The code that I have first divides my sample by ...
0
votes
0answers
8 views

How do you create new grouping variables when restructuring longitudinal data in R? [migrated]

I've been reading through the documentation on the reshape2 package in R and other packages for restructuring data from the wide to long formats and vice versa. ...
0
votes
0answers
32 views

Fitting a VARMAX model using MTS library in R

I am trying to fit a VARMAX (vector autoregressive moving-average with exogenous variables) model to some synthetically generated data using the MTS library available in R. I found that there is only ...
0
votes
0answers
19 views

colons equals operator in R? new syntax? [migrated]

While reading http://ggvis.rstudio.com/interactivity.html, I noticed the code has := sprinkled in it. I assume that is a new way of providing arguments to a function? What is it exactly? ...
0
votes
0answers
10 views

Two time series within one another

I took 5 observations per individual over the course of 10 minutes (continuous measure). Individuals came from different treatment groups. There is a substantial increase in my DV over the 4 hours ...
0
votes
0answers
22 views

Transformation of growth function with two pulses

I'm trying to linearize the following exponential growth function: $$ y = ae^\frac{t}{b}+(1-a) e^\frac{t}{c} $$ To preempt any question regarding why I'm doing this: I'm trying to regress this ...
0
votes
1answer
41 views

Time series forecasting with R

I try to forecast my web visitors on the web site for 10 future days using time series. My time series is daily. I have used an auto.arima() model. Considering ...
0
votes
2answers
84 views

Choose model for time series forecasting with R

I try to forecast my web visitors on the web site for 10 future days using time series. I have used a auto.arima() model My time series is daily. How can I choose ...
1
vote
1answer
33 views

linear mixed model on continuous, zero-trunctated data

I have a dataset with one continuous response variable (time), a 'treatment' explanatory variable and 5 other fixed factors: ...
0
votes
0answers
8 views

How to loop set of commands with different variable each time in R? [migrated]

I am quite a newbie in R coding, thus I really need your help to run a looping command in R. I have a big table ("variable_table.txt") with columns as below: ...
0
votes
0answers
37 views

integral probability transformation

I have a data matrix and I want to get samples from the distribution that each row has by integral probability transformation method. I don't know what should I do? Any idea about it?? Here I have put ...