similar to: How to generate variance of a new observation based on a linear regression model

Displaying 20 results from an estimated 20000 matches similar to: "How to generate variance of a new observation based on a linear regression model"

2010 Jul 21
2
Variance of the prediction in the linear regression model (Theory and programming)
Hi, folks, Here are the codes: ############## y=1:10 x=c(1:9,1) lin=lm(log(y)~x) ### log(y) is following Normal distribution x=5:14 prediction=predict(lin,newdata=x) ##prediction=predict(lin) ############### 1. The codes do not work, and give the error message: Error in eval(predvars, data, env) : numeric 'envir' arg not of length one. But if I use the code after the pound sign, it
2010 Jun 22
2
Verify the linear regression model used in R ( fundamental theory)
Hi, folks, As I understand, Least-squares Estimate (second-moment assumption) and the Method of Maximum Likelihood (full distribtuion assumption) are used for linear regression. I do >?lm, but the help file does not tell me the model employed in R. But in the book 'Introductory Statistics with R', it indicates R estimate the parameters using the method of Least-squares. However it
2010 Jun 21
2
How to predict the mean and variance of the dependent variable after regression
Hi, folks, As seen in the following codes: x1=rlnorm(10) x2=rlnorm(10,mean=2) y=rlnorm(10,mean=10)### Fake dataset linmod=lm(log(y)~log(x1)+log(x2)) After the regression, I would like to know the mean of y. Since log(y) is normal and y is lognormal, I need to know the mean and variance of log(y) first. I tried mean (y) and mean(linmod), but either one is what I want. Any tips? Thanks in
2010 Jun 23
1
Estimate of variance and prediction for multiple linear regression
Hi, everyone, Night. I have three questions about multiple linear regression in R. Q1: y=rnorm(10,mean=5) x1=rnorm(10,mean=2) x2=rnorm(10) lin=lm(y~x1+x2) summary(lin) ## In the summary, 'Residual standard error: 1.017 on 7 degrees of freedom', 1.017 is the estimate of the constance variance? Q2: beta0=lin$coefficients[1] beta1=lin$coefficients[2] beta2=lin$coefficients[3]
2010 Jun 24
2
count data with a specific range
I would like to prepare the data for barplot. But I only have the data frame now. x1=rnorm(10,mean=2) x2=rnorm(20,mean=-1) x3=rnorm(15,mean=3) data=data.frame(x1,x2,x3) If there a way to put data within a specific range? The expected result is as follows: range x1 x2 x3 -10-0 2 5 1 (# points in this
2001 Sep 17
0
variance of a linear model
Hi, this question may be off topic: the unbiased estimator of the variance of the errors in a linear regression moedel with p coefficients is: sigma2=sum((y-yi)^2)/(length(y)-p-1) But what if i estimate transformations of the dependent an independent variables (e.g. Box-Cox) too? May I calculate the variance using sigma2=sum((y-yi)^2)/(length(y)-2*p-1) or should I use the first formula
2010 Jun 23
1
How to 'understand' R functions besides reading R codes
Apologize for not being clearer earlier. I would like to ask again. Thank Joris and Markleeds for response. Two examples: 1. Function 'var'. In R, it is the sum of square divided by (n-1) but not by n. (I know this in R class) 2. Function 'lm'. In R, it is the residual sum of square divied by (n-2) not by n, the same as in the least squares estimate. But the assumption following
2010 Jul 02
2
how to save summary(lm) and anova (lm) in format?
Hi, folks, I would like to copy the output of summary(lm) and anova (lm) in R to my word file. But the output will be a mess if I just copy after I call summary and anova. ##################### x=rnorm(10) y=rnorm(10,mean=3) lm=lm(y~x) summary(lm) Call: lm(formula = y ~ x) Residuals: Min 1Q Median 3Q Max -1.278567 -0.312017 0.001938 0.297578 1.310113
2012 Aug 29
3
Help on calculating spearman rank correlation for a data frame with conditions
Dear all, Suppose my data frame is as follows: id price distance 1 2 4 1 3 5 ... 2 4 8 2 5 9 ... n 3 7 n 8 9 I would like to calculate the rank-order correlation between price and distance for each id. cor(price,distance,method = "spearman") calculate a correlation for all. Then I tried to use apply(data,list='id',cor(price , distance , method =
2017 Sep 22
1
Effectiveness of llvm optimisation passes
I noticed that there is a '-run-pass' argument for llc. I am wondering if I can do a similar approach with machine level optimisations/passes for llc. Are those passes optional (so I can turn them off)? And how can I get MIR format as llc expects with '-run-pass'? Thanks a lot. Cheers, Yi On 22/9/17 15:10, Craig Topper wrote: > Have -O0 on your clang command line causes
2010 Sep 02
1
How to generate integers from uniform distribution with fixed mean
Hi, folks, runif (n,min,max) is the typical code for generate R.V from uniform dist. But what if we need to fix the mean as 20, and we want the values to be integers only? Thanks [[alternative HTML version deleted]]
2013 Sep 12
0
[LLVMdev] VmKit - Error in j3/precompiler after a big surgery to MMTk part
Hi Yi, The precompiler is in charge of translating the most common classes of the Java runtime library to llvm code (typically, java.lang.Object), in order to natively compile these classes and decrease the bootstrap time. So, if you have a segmentation fault at this stage, it means that you have broken something in the interface between MMTk and VMKit. If it can helps you: * during a first
2011 Feb 01
1
How can I index multiple linear models? (Without getting a warning.)
My code looks like this: lin = NA for(i in 1:15){ lin[i] = lm(reservesub[,3]~ reservesub[,i+3]) } For which I'm given 15 warning messages which say : "1: In lin[i] = lm(reservesub[, 3] ~ reservesub[, i + 3]) : number of items to replace is not a multiple of replacement length" I'm am able to generate the 15 different models and get the coefficients. I am able to access
2017 Sep 22
0
Effectiveness of llvm optimisation passes
Have -O0 on your clang command line causes all functions to get marked with an 'optnone' attribute that prevents opt from being able to optimize them later. You should also add "-Xclang -disable-O0-optnone" to your command line. ~Craig On Thu, Sep 21, 2017 at 10:04 PM, Yi Lin via llvm-dev < llvm-dev at lists.llvm.org> wrote: > Hi all, > > I am trying to
2008 May 15
1
ANOVA between linear models.
Hi All, I'm accustomed to performing an ANOVA to aid in choosing between linear models (for example y~x or y~x+x^2), however with different models I can't seem to do it. I'm trying to fit an exponential model of the form ye^(bt). Below is a code snippet that highlights what I'm trying to do s = rnorm(100, sd = 1, mean=10) s = s + seq(0.1,10,0.1) x = 1:length(s) model.lin = lm(s
2012 Jul 03
0
need help EM algorithm to find MLE of coeff in mixed effects model
Dear All, have a general question about coefficients estimation of the mixed model. I simulated a very basic model: Y|b=X*\beta+Z*b +\sigma^2* diag(ni); b follows N(0,\psi) #i.e. bivariate normal where b is the latent variable, Z and X are ni*2 design matrices, sigma is the error variance, Y are longitudinal data, i.e. there are ni
2006 Jul 21
2
seeking robust test for equality of variances w/ observation weights
Hello R community, I am looking for a robust test for equality of variances that can take observation weights. I realize I can do the F-test with weighted variances, but I've read that this test is not very robust. So I thought about maybe adding a "weights" argument to John Fox's code for the Levene Test (in the "car" library, "levene.test"), substituting
2012 Oct 07
1
variances of random effects in coxme
Dear R users, I'm using the function coxme of the package coxme in order to build Cox models with complex random effects. Unfortunately, I sometimes get surprising estimations of the variances of the random effects. I ran models with different fixed covariates but always with the same 3 random effects defined by the argument varlist=coxmeMlist(list(mat1,mat2,mat3), rescale = F, pdcheck = F,
2010 Jun 18
1
How to calculate the robust standard error of the dependent variable
Hi, folks linmod=y~x+z summary(linmod) The summary of linmod shows the standard error of the coefficients. How can we get the sd of y and the robust standard errors in R? Thanks! [[alternative HTML version deleted]]
2010 Jun 26
1
All a column to a data frame with a specific condition
Hi, folks, Please first look at the codes: plan_a=c('apple','orange','apple','apple','pear','bread') plan_b=c('bread','bread','orange','bread','bread','yogurt') value=1:6 data=data.frame(plan_a,plan_b,value) library(plyr) library(reshape) mm=melt(data, id=c('plan_a','plan_b'))