Use this tag for any *on-topic* question that (a) must have an `R`-based solution yet (b) is not *just* about how to program in `R`.

learn more… | top users | synonyms

1
vote
0answers
22 views

How to Obtain “Right” Parameters of Multinomial Logit Model (or Other Conditional Models) in R?

I started to use the function multinom of R package nnet in order to fit several conditional ...
5
votes
1answer
85 views
0
votes
0answers
17 views

Combination of normal and gamma distribution in R [on hold]

I have to solve this problem: A machine comes with a 2 year warranty. As a statistician you are told that (i) The total number of hours for which a machine is used over the course of 2 years follows ...
1
vote
0answers
26 views

Plotting fitted values for an nlme model

I just got the output of my lme (nlme) model called shalit5 with syntax: ...
0
votes
0answers
10 views

Construct matrix of stacked variables in VAR regression

I am trying to NOT use packages for the estimation of models in order to have a deeper understanding of how things work. Currently, I am trying to estimate a VAR(1) (vector autoregression of first ...
0
votes
0answers
22 views

Help interpreting R linear model fit [duplicate]

I have observed variables power$values. I am trying to model this process using a second set of observations, such that $P = M\cdot X + B$. $P$ is the function ...
1
vote
0answers
18 views

lme / lmer - split-plot with Non orthogonal subdesign

I have an agricultural field experiment (testing a plant protection agent): Split plot design with: ...
1
vote
2answers
48 views

Understanding dummy (manual or automated) variable creation in GLM

If a factor variable (e.g. gender with levels M and F) is used in the glm formula, dummy variable(s) are created, and can be found in the glm model summary along with their associated coefficients ...
1
vote
2answers
37 views

what does the correlation of Random forest regression tool in R represent

I've built a random forest model (regression model) using randomForest package in R, and I calculate the correlation between the predicted values and the actual ones in order to know how the trained ...
0
votes
0answers
15 views

Lsmeans: Is this what I did?

after doing the linear mixed model with lme4, I have used lsmeans for pairwise comparison with this command: lsmeans(lmer52, pairwise~color, adjust="tukey") I am ...
0
votes
0answers
25 views

Fitting an ANOVA with too many predictors in R. No p-values but how can I still interpret the model?

So I've fit an ANOVA model to 32 predictors and 32 data points. The summary output simply gives me the SS for each predictor and no F-stat or p-value. Is there any way to still make some sort of ...
0
votes
0answers
31 views

How to do Regression Discontinuity Design in R [closed]

I am having trouble with doing regression discontinuity design in R. Could anyone show me a syntax for R to do RDD? The exercise I have is y= wealth x=winning margin covarites= education, past ...
0
votes
0answers
30 views

Splitting factors in R [migrated]

I have a factor with values of the form Single (w/children), Married (no children), ...
0
votes
0answers
38 views

Converting factors to numeric values in R [migrated]

I have factors in R that are salary ranges of the form $100,001 - $150,000, over $150,000, ...
0
votes
0answers
17 views

What is the limit of variables that can be used in R to create matrix scatter diagrams? [closed]

R crashes after trying to create a matrix scatter diagram with 47 variables that are in a CSV file being read by my R workspace. I have already set my limit number to NA by using limitNo=NA which ...
1
vote
1answer
53 views

Constants in a DLM Model R

Good afternoon, I am attempting to fit a state space model of the form: $$ (S_t- \mu) = G*(S_{t-1} - \mu) + E_t $$ $$ Y = F*S_t + v_t $$ Where $Y$ is nx1, $G$ is 3x3, $S_t$ is 3x1, $\mu$ is 3x1, and ...
0
votes
0answers
17 views

Calculate first difference by group in R [migrated]

I was wondering if someone could help me calculate the first difference of a score by group. I know it should be a simple process but for some reason I'm having trouble doing it..... yikes Here's an ...
0
votes
0answers
12 views

Nonempty Numeric vector? [migrated]

So I run this loop: (my data file is very big, .csv) ...
0
votes
1answer
53 views

I want to learn about ROC curve — what is the canonical textbook?

I want to learn about Receiver-Operator-Characteristic curves, and metrics. I have read through online webpages with some basics, and I have used MATLAB built-ins to create ROC plots. It tells me ...
0
votes
0answers
11 views

warning message from ezANOVA function in R [migrated]

I am new to R and I am trying to use ezANOVA to do a repeated measure factorial anova. So I have a data frame named mus.df, which looks like the following (with more rows): ...
1
vote
1answer
27 views

code needed for p values in GLMM

I need to get p values for the fixed effects in the following GLMM's I ran. Does anyone know of code that I can run that will give me the p values I need? At the moment the output from the ANOVA only ...
4
votes
2answers
47 views

Absolute (i.e., not just relative) probabilities in chi-squared test for proportions

Why do the absolute probabilities affect the p-value of a chi-square test so much? For example: ...
0
votes
0answers
26 views

Problem with year as a factor GLMM

So I need to do a GLMM, I do it this way, with package lme4 glmer(y~x1+x2+x3+year+(1|x4),family=binomial In my data, year is a factor (4 levels). So when I run my glmer, I have my result like this x1 ...
0
votes
1answer
44 views

Transformation of latitudes to include them a linear model

I have in a dataset a variable latitude that contains values such as 39° 37' 39" N and ...
3
votes
1answer
118 views

Manually calculated chi-squared statistic differs from that given by chisq.test in R

I'm using R to do a chi-squared test on two sets of data to check if they follow a distribution. In the first case the chi-squared statistic given by chisq.test ...
1
vote
0answers
34 views

Fit a GARCH (1,1) - model with covariates in R

I have some experiences with time series modelling, in the form of simple ARIMA models and so on. Now I have some data that exhibits volatility clustering, and I would like to try to start with ...
0
votes
0answers
16 views

How to merge datasets in STATA conditionally? [migrated]

I have written a program which runs fine in R. But I need to convert it to STATA, in which I am relatively new. Since STATA allows you only to run a single dataset, I need to merge the data. My first ...
0
votes
1answer
32 views

Trying to use Holt-Winters to fit this data

I'm trying to fit the data in this message (daily temperatures) using a Holt-Winters technique in R, but can't get the seasonal example in here to work ...
0
votes
0answers
18 views

How to fit a model for a censored binary outcomes?

Suppose I have a data frame such that: ...
4
votes
1answer
24 views

Using log-linear models for presence/absence data in wildlife

I'm working on a project wherein I compare the presence/absence of a number of bird and herptile species between wetlands that have received three different treatments. The populations were surveyed ...
0
votes
1answer
29 views

Ways to simplify a neural network in R for interpretation

I would like to try to make some sense of a neural network. The neural network has a single hidden layer and is used on 30-40 attributes, which are used to classify the probability that the ...
0
votes
0answers
20 views

What is the sampling design and how to declare it in the survey()

I have a sample design that can be resumed in: Split the city in X areas and, for each area, sample 5% of the residences and get some informations about it; For each residence, interview ALL ...
1
vote
0answers
32 views

Fit and predict logistic regression model for censored data?

Suppose I have a data frame such that: ...
1
vote
3answers
143 views

Monte Carlo integration help needed

I'm trying to simulate these two integrals using Monte Carlo simulation: $$ \int_{-\infty}^\infty \exp(-x^2) dx, \quad \mbox{and } \int_{-\infty}^\infty \exp(-|x|) dx . $$ When I use ...
0
votes
0answers
31 views

Cannot do Tukey test in multcomp

After performing series of linear mixed models in lme4 to justify which model with which level of interaction to be used, now I would like to do the Tukey's test for multiple comparison. So first, I ...
1
vote
0answers
41 views

lmer() parametric bootstrap testing for fixed effects

I am performing a parametric bootstrap to test whether I need a specific fixed effect in my model or not. I have mainly done this for exercise and I am interested if my procedure so far is correct. ...
0
votes
0answers
18 views

Two-way interaction: interpret output from LMM in lmer

I have asked a question in this topic relating interpreting two- and three-way interactions in this link: How to interpret 2-way and 3-way interaction in lmer? ...
1
vote
1answer
28 views

Change in output depending on mirt version

I have a matrix which I'm trying to run through the mirt function of the mirt package: ...
1
vote
0answers
35 views

Posterior Density in R

I'm new to the site, and to Bayesian statistics and was hoping to get some help. I'm currently working through some study exercises and am required to compute the mean and variance of the posterior ...
2
votes
1answer
45 views

Observed variables in R's lavaan

I am running a SEM on lavaan in R. The model consists of latent variables [N1 to N3], two dummy choice variables [du1 and du2] and observed satisfaction variable [SV] (beside the observed variables). ...
2
votes
0answers
71 views

How to get the regression from a plot?

I have a dependent variable C and an independent variable VPT. VPT is the average volume per ...
0
votes
0answers
14 views

Confirmatory factor analysis about technology acceptance model in R

I tried to do a cfa with lavaan package in R. I'm not sure, if SO is the right stackexchange plattform, if mathematics fits better just tell me and i will move it. Here is my model: I know how to ...
0
votes
2answers
45 views

Confirmatory Factor Analysis with R lavaan

I tried to do a CFA with the lavaan package in R. Here is my model: I know how to define my latent variables like this: ...
1
vote
0answers
56 views

Reading the output from a GLMM run in R

I am a complete novice and dummy when it comes to statistics so I apologise in advance... I have been asked to report the results of my GLMMs (I ran two) in a table. This table must state: effect, ...
0
votes
0answers
5 views

Setting Contrasts for ANOVA in R [migrated]

I've been attempting to perform an ANOVA in R recently on the attached data frame. My question revolves around the setting of contrasts. My design is a 3x5 within-subjects design. There are 3 ...
1
vote
1answer
30 views

Meta-analysis of RR and OR calculated from 2x2 tables in R using metafor

Background My question concerns the calculation of risk ratios and odds ratios for meta-analysis using the metafor package. I know it looks long, but please bear ...
1
vote
0answers
31 views

Leaps() or AIC for model selection

I am deciding how many predictors to include in my model - I currently have 4. When I use the leaps() function, the smallest value for the residual standard error ...
1
vote
1answer
54 views

Interpretation of Maximum likelihood estimation

I have some problem to interpret the result of MLE estimation : Is it possible to get some advise about how to interpret it? the log likelihood function : $\sum^{n}_{i=1}\log\left( \phi\left( ...
2
votes
1answer
67 views

Non parametric Wilcoxon Signed Rank test

I have the following data vector(in fact its 2392 data points long): ...
9
votes
1answer
172 views

Testing whether two regression coefficients are significantly different (in R ideally)

If this is a duplicate question, please point to the right way, but the similar questions I've found here haven't been sufficiently similar. Suppose I estimate the model $$Y=\alpha + \beta X + u$$ ...