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

4
votes
1answer
3k views

Duncan’s statistical test for blocks designed experiment with full factorial scheme

EDIT: Already got an answer to question 4 (programming). Question will remain on theoretical issues about factorial experiment designed in blocks and Duncan's test. Given one experiment designed in ...
4
votes
2answers
436 views

R p-value half to SPSS rANOVA

I have done rANOVA in SPSS and then in R and got two different p-values from the same model. While SPSS gives 0.032, R gives 0.0162, which when rounded is a half. Other data are exactly the same. 1. ...
1
vote
0answers
436 views

Bounded response variable [-1;1] - Should I transform it?

I am planning to use two response variables. One is bounded between 0 and 1, and I guess I can use a binomial (or related) error structure. The second variable is bounded between -1 and 1. I am not ...
18
votes
4answers
14k views

How to reconstruct original data using a small number of principal components?

I have a big dataset of $\pm 40000$ observations, each containing $784$ variables. Because this dataset is extremely large I want to perform a dimensionality reduction. Now everywhere I read that I ...
-1
votes
1answer
154 views

Methods For Estimating Trend in R [closed]

Do you know how i can get a code for estimating trend by Mitcherlich and logistic method in R?
1
vote
2answers
174 views

Measure the relation/association between the outcome and the independent variables

I am running a model (logistic regression) with 20 independent variables in R. Before running the model I calculated the correlation between all the variables and finally selected my variables by ...
0
votes
0answers
38 views

Performance indicator for imputation method using R

I have a 10 imputed air quality data using 7 different method of single imputation. can someone show how to compute MSE,RMSE,PA and MAE for my data, without manually type the equation in r. ...
1
vote
1answer
317 views

Correct formula for standardized Student's t-distribution

I am wondering about the correct formula of the standardized Student's t distribution. In the rugarch package on page 15 it is given as: Substituting $\frac{(\nu-2)}{\nu}$ into 49 we obtain the ...
0
votes
1answer
183 views

The coefficient of one variable in Cox regression becames negative when doing multiple variable regression

I am doing Cox proportional regression. I first did Cox regression with only one variable var; its coefficient 0.8752721 was about what I expected and is easy to ...
7
votes
1answer
10k views

How to test for overdispersion in Poisson GLMM with lmer() in R?

I have the following model: > model1<-lmer(aph.remain~sMFS1+sAG1+sSHDI1+sbare+season+crop +(1|landscape),family=poisson) ...and this is the summary ...
2
votes
1answer
339 views

What does it imply when an estimate is not inside its 95% confidence interval? [closed]

What does it actually imply when a 95% CI does not contain an estimate (coefficient or parameter). Is there some model assumption that has not been satisfied? Or it means something else? I know when ...
4
votes
0answers
403 views

Mixed-effect modeling with paired observations & bounded response variables

I am quite new in the field of mixed-effect modeling. For a beginner like me, I guess I combine several levels of complication in my analysis: paired observations & bounded response variables. I ...
1
vote
0answers
540 views

Converting ARMA models to infinite AR process in R

I'm trying to recreate some test statistics that use the infinite AR representation of normal ARMA models. I found out about the function ARMAtoMA but have not been able to find the same functionality ...
1
vote
0answers
786 views

How to rank predictor variables in logistic regression in R [closed]

I have created a logistic regression model in R. The dependent variable is binary whether or not a landscape transitioned to another cover class denoted by 1s and 0s, and the independent or predictor ...
2
votes
2answers
410 views

Is it correct to say the “smooth curve fitted by LOESS”?

I use the package scatter.smooth in R, and I want to have a figure text describing the line in the scatterplot for my report. Is is okay to say "the line is a ...
0
votes
0answers
639 views

Restricting model parameters in logistic models in R

Is there any function in R that can solve the problem like this example from the SAS website: Beginning in SAS 9.3, PROC FMM can be used as an alternative to ...
2
votes
1answer
880 views

Blocked repeated measures ANOVA in R

I am trying to test if richness varies by treatment (Severity) over time (Block) using a repeated measures ANOVA in R. Any suggestions on how to do this correctly? I have tried, but get an error ...
7
votes
2answers
626 views

Implementation of Dirichlet cdf?

I need to compute the Dirichlet CDF, but I can only find implementations of the PDF. Do you guys know of any library (preferably in R) implementing it?
2
votes
1answer
144 views

How is the Df computed in a mixed model?

The following is the output for a mixed model example. The only difference between fm1 and fm2 is the random factor "URBAN", why the df for fm2 is 5 but not 4? Any help would be great. ...
3
votes
0answers
233 views

Pretest-posttest plus control design

I am evaluating the effect of an intervention (treatment: a lecture) on the ability to spot behavioral clues of emotions using visual stimuli using pretest-posttest plus control group experimental ...
0
votes
0answers
413 views

Confidence Bands in non linear mixed effects models

Is there a way to get confidence bands around the fitted population fixed effects curve for non linear mixed effects models fitted in R function ...
0
votes
2answers
494 views

Compute cdf and quantile of a specific distribution

I want to calculate a quantile of a specific distribution. Therefore I need the cdf. My distribution is a standardized Student's-t distribution, this can be written as \begin{align*} f(l|\nu) =(\pi (\...
2
votes
1answer
681 views

Error term/Innovation process in ARCH/GARCH processes?

I am wondering about the distribution of the error term/innovation process in a ARCH/GARCH process and its implementation, I am not sure about some points. The basic assumption is $r_t=\sigma_t*\...
2
votes
2answers
1k views

Kurtosis of a standardized Student's-t distribution?

I use the generalized form of the Student's-t distribution: \begin{align*} f(l|\nu ,\mu ,\beta) = \frac{\Gamma (\frac{\nu+1}{2})}{\Gamma (\frac{\nu}{2}) \sqrt{\pi \nu} \beta} \left(1+\frac{1}{\nu}\...
4
votes
0answers
708 views

Mixed-effects model for a strongly unbalanced design

I am somehow unsure on the best option to analyze these data. Here is my study case: The response variable is a morphometric measure, one for each individual. During 10 years, say 2000-2009, people ...
2
votes
2answers
1k views

How to calculate multi-step prediction intervals for time series data?

I need to manually calculate multi-step prediction intervals for time series data. I know packages like 'forecast' in R provide these, but I cannot use these packages as the production infrastructure ...
5
votes
2answers
4k views

Discrete-Time Event History (Survival) Model in R

I'm trying to fit a discrete-time model in R, but I'm not sure how to do it. I've read that you can organize the dependent variable in different rows, one for each time-observation, and the use the <...
2
votes
2answers
3k views

Account for spatial autocorrelation with a binomial regression model

I am using a binomial regression model for presence/absence, with 20 independent variables to test. The data has x and y coordinates and I would like to understand how can I take into account the ...
1
vote
2answers
2k views

Program Impulse Response Functions for VAR

I'm trying to program impulse response functions for a VAR model using Cholesky decomposition. The thing is I do not completely understand how I should do this when I read in the literature. Suppose I ...
3
votes
1answer
290 views

(Prediction) constrained OLS in R

I have a collection of $n$ datapoints $(y_i,\bf{x}_i)$ in $\mathbb{R}^{p+1}$ and would like to estimate the following model in R: $$\underset{\bf{b}\in\mathbb{R}^{...
4
votes
1answer
742 views

Calculate mean of one variable while controlling for another using regression

This is probably a very naive question... I'd like to estimate "adjusted" or "conditional" means for a variable (i'm unsure of the correct terminology). My data are on cortisol levels (dependent ...
2
votes
1answer
3k views

Question about reading an output for using ANOVA to compare two linear models

I tried to compare the following two models using "anova.lm()" in R: ...
1
vote
1answer
406 views

How to see how good is my model?

I am using glm to find a model using training data and then use test data to see how well the model is behaving. My response variable is ...
1
vote
1answer
831 views

How to estimate certain parameters of an AR model in R?

I need to estimate parameters of an AR model which is in the form of AR(1,11) it means that coefficients of AR orders from order 2 until order 10 are zero. How can I estimate these two parameters in <...
2
votes
1answer
823 views

What to do about Seasonality Patterns in ACF, Time Series Data

I'm dealing with a time series data and I'm trying to construct a time series model for this particular dataset. I'm new to R and tried using the the auto.arima ...
4
votes
1answer
2k views

use of weights in svyglm vs glm

I would like to know how the treatment of weights differs between svyglm and glm I am using the ...
4
votes
1answer
2k views

P value and confidence interval for two sample test of proportions disagree

I'm using R to calculate the two-sample test for equality of proportions, where the two proportions are 350/400 and 25/25. So: ...
0
votes
1answer
774 views

Optim result highly dependent on starting value

I want to fit a standardized Student's-t distribution. The log-likelihood is given by: \begin{align*} log \mathcal{L}(\nu | l_1,...,l_n)=\sum_{i=1}^n \left( log \left( (\pi (\nu-2))^{-\frac{1}{2}}\...
0
votes
1answer
313 views

When is it valid to include interaction terms in a regression model? [duplicate]

I am using logistic regression to analyze some categorical data (binary response variable and categorical -- mostly binary -- predictor variables). For my model, I have something like ...
13
votes
1answer
18k views

Interpreting interaction terms in logit regression with categorical variables

I have data from a survey experiment in which respondents were randomly assigned to one of four groups: ...
1
vote
2answers
83 views

One predictor is a linear combination of another

If I try and fit the linear regression lm(y~V1+V3,data=x) with data: ...
1
vote
0answers
1k views

Fisher information for Poisson model

Assuming the data structure given below, $$ \left[\begin{array}{l|l} y & x \\ \hline \hline y_{1} & x_{1} \\ y_{2} & x_{2} \\ \vdots & \vdots \\ y_{n} & x_{n} \\ \...
0
votes
0answers
136 views

How to calculate 95% CI for a random effect?

The R code "intervals()" gives confidence intervals for fixed effects only in a mixed model. *Is there a reason why only fixed effects' confidence intervals are provided? *Is there any way to get ...
1
vote
0answers
449 views

How to interpret the frailty terms in a coxph.penal model?

I have the following coxph model: Surv(Y) ~ genotype + treatment + age + frailty(batch) + genotype:frailty(batch) ...
0
votes
0answers
79 views

Energy estimation through machine learning

Greedings to everybody. I have the dataset which you can find here, containing many different characteristics of different houses, including their types of heating, or the number of adults and ...
6
votes
1answer
158 views

A distribution similar to the Poisson one?

I have a set of data which in my opinion can be treated as coming from a Poisson distribution (they are all positive and represent days). I need to perform several regressions, with R, using these ...
8
votes
2answers
2k views

spatial autocorrelation for time series data

I have a 20-yr dataset of an annual count of species abundance for a set of polygons (~200 irregularly shaped, continuous polygons). I have been using regression analysis to infer trends (change in ...
27
votes
4answers
15k views

Do the predictions of a Random Forest model have a prediction interval?

If I run a randomForest model, I can then make predictions based on the model. Is there a way to get a prediction interval of each of the predictions such that I ...
2
votes
1answer
1k views

R - how can I use neural networks for a binary dependent variable in R?

I have a dataset from a bank with demographic data and one variable telling if the customer is a good customer or not (binary variable). I would like to do prediction on if the customer is good or not ...
1
vote
1answer
447 views

R - Multidimensional Scaling and Missing Values

I include MDS analysis in a customer survey and have about 10 brands I want to include in the perceptual map at the end. Meaning the customers would have to rate 45 comparisons and give a similarity ...