I don't know why Y does not get its type inferred correctly.  But you
can do:
eltype(df[2])[df[i,2] for i in 1:size(df,1)]

On Thu, 2015-06-18 at 20:21, SG <[email protected]> wrote:
> #= This line adds functions to take  
>    an AR(2) model for US inflation  
> =# 
>  
> using DataFrames 
>  
> function lag0(x,p) 
>      R::Int32=size(x,1) 
>      C::Int32=size(x,2) 
>  
> # Take the first R-p rows of matrix x 
>      x1=x[1:(R-p),:] 
>      return out=[zeros(p,C); x1] 
>  
> end 
>  
>  
> #load inflation datatable 
> #df=readtable("inflation.csv") 
>  
> df=DataFrame() 
> df[:A]=1:8 
> df[:B]=10:17 
>  
> ##################################
> # Way of converting DataArray to Array  #
> ##################################
> Y=[df[i,2] for i in [1:size(df,1)]] 
>  
> ## >>>> type of (Y) is now "Any"  
>  
>  
> T=size(Y,1) 
> X=[ones(T,1) lag0(Y,1) lag0(Y,2)] 
> inv(X'*X)
>
> ==========================================================
>
> Hi All, 
>
> I am posting again the issue. I found when I create an Array as shown 
> above, the type of Array 
> changed to "Any" which is not acceptable for the base Inverse function(an 
> error occurred). 
> I am wondering why Julia does not assume the type of original data, here in 
> the example, Int64.
>
> Many thanks, 
>
>
>
>
>
>
> On Thursday, June 18, 2015 at 7:23:16 PM UTC+2, SG wrote:
>>
>> Thank you, I will cut it down and post it again soon. 
>>
>> On Thursday, June 18, 2015 at 7:01:16 PM UTC+2, Stefan Karpinski wrote:
>>>
>>> I think these sample programs may be too big for people to review for 
>>> you. If you can pare the problem down to an example that can be posted in 
>>> an email, you've more likely to get help.
>>>
>>> On Thu, Jun 18, 2015 at 11:11 AM, SG <[email protected]> wrote:
>>>
>>>>
>>>> Hi All, 
>>>>
>>>> I am a novice to Julia. 
>>>>
>>>> While I am running the attached julia program, I found "inverse" 
>>>> function throws an error? 
>>>> However it worked well in Matlab. Can you help me? Many thanks.
>>>>
>>>>
>>>>
>>>>
>>>

Reply via email to